error when calling rtGeometryInstanceSetMaterial

Hi, when calling rtGeometryInstanceSetMaterial, I sometimes get the following error:

Unknown error (Details: Function "RTresult _rtGeometryInstanceSetMaterial(RTgeometryinstance, unsigned int, RTmaterial)" caught exception: Assertion failed: "iter != m_map.end() : Non-existent ID removed from reference set", file: /root/sw/wsapps/raytracing/rtsdk/rel4.0/src/Objects/VariableReferenceSet.cpp, line: 92)

What exactly does this mean? I’m on 4.0.2 with cuda 8.

Cheers,
Anders

That’s an internal OptiX error and happened when replacing a material on a GeometryInstance.
It should be fixed in OptiX 4.1.0 which was released last week during GTC.
Please give that a try and let us know if that solves it.

A workaround in OptiX 4.0.2 was to remove the previous material with setMaterialCount(0) and then add the new one with addMaterial().

Thanks Detlef, upgrading to 4.1 has fixed it, and also given me a pretty hefty performance increase!

Awesome! Thanks for reporting back.