gi with different material parameters

hello:
I’m testing optix as a offline renderer and meet a situation which need your help. Currently I have same geometry and but each have a different material parameter (like diffuse color, diffuse map id, …etc). I found it seems i could only assign the material parameter id to the geometry instance like gi[“matParamID”]=xx , but if i create multiple gis then I lose the memory for instancing.
Is there better option to still keep the instancing and using different material paramter id?

thanks

OptiX can look up variables at different scopes depending on the program domain. I explained that yesterday here:
[url]https://devtalk.nvidia.com/default/topic/1037339/optix/correct-ways-to-declare-variables-from-host-api-optix5-1/[/url]

You need to be able to identify your material parameters in some way.
If you’re concerned that storing some material parameters ID per GeometryInstance is wasting too much space, and the number of different materials is not too many, you can also store that ID at the Material node and have it accessible in the any hit and closest hit programs.
You would need one Material node per different Material ID in that case. Anyhit and closesthit programs should be shared. I did that for a long time.
In my OptiX introduction examples I preferred to reduce the number of Material nodes by putting the material index parameter at the GeometryInstance.

thanks Detlef! after I double check I found I created accerlation for each gi and in that i lost instancing.
after using one accerlation for all instance. it’s fixed.
cheers