tex2D strange error.

Hello.

I’m building a dynamic rendering engine with optix and I have any questions about textures.

1)I create material per geometry/instance and then I create the variable to set the sampler. If I want create a material and after change, removing the bind sample to this instance, how I can do this? set null not working.

Step:
Frame 1

  • create material
  • load sampler
  • declare variable and set sampler
  • create geometry/instance and bind material (OK, working)

Frame 2

  • get variable from previous instance
  • set (null) (not working)
  1. I have a geometry with diffuse and normalmap textures working great. If I insert a new geometry with new material with only diffuse but not normalmap and inside of device code I test a specific variable with information about textures exists and not execute the tex2D of normalmap the exception throws error.

//the program not enter here but return exception in tex2D
if (xUseDiffuseNormalSpecular & 2)
{
float3 normalMapT = make_float3(tex2D(xNormalTexture, texcoord.x, texcoord.y));

}

3)What the best option for performance:

  • Dynamic branching or new program, in the previows question I could create separated programs for all combinations diffuse, diffuse-normal, normal, nothing. And set to material.

Thanks and sorry the bad english.

Hi, look into OptiX Programing Guide section 3.3 Textures. Bottom part of this section discusses bindless textures (‘As of version 3.0, OptiX supports bindless textures’).

\o/ Perfect, thank you for the answer.