texture/material limitation for ray- and pathtracing

Hi there,

I'm working on a 3D-Viewer for loading OBJ-files with the OpenCascade-rendering-technology. It works perfectly, but now I run into a possible limitation regarding materials/textures. In the Graphic3d_RM_RASTERIZATION-mode I can load any OBJ-file with hundrets of different materials with textures and all will be displayed accordingly. If I switch to the Graphic3d_RM_RAYTRACING-mode (and furthermore the GlobalIllumation = True for pathtracing) only roundabout 70 materials with their textures are displayed correctly, the rest fall back to a default material. See the attachted images for further explanation.

Is there a limitation inside OpenCascade? If I use CAD-Assistent with the same test-files I get the same visual result for raytracing/pathtracing and missing materials.

I'm using the currently latest OpenCascade-version 7.9.3.

Thanks for your help.

gkv311 n's picture

Currently this is a hard-coded limit in the code OpenGl_RaytraceGeometry.hxx. It should be possible to extend it or make it configurable, but for this one have to modify OCCT:

class OpenGl_RaytraceGeometry : public BVH_Geometry<Standard_ShortReal, 3>
{
public:

  //! Value of invalid offset to return in case of errors.
  static const Standard_Integer INVALID_OFFSET = -1;

  //! Maximum number of textures used in ray-tracing shaders.
  //! This is not restriction of the solution implemented, but
  //! rather the reasonable limit of the number of textures in
  //! various applications (can be increased if needed).
  static const Standard_Integer MAX_TEX_NUMBER = 32;
Kevin Kesslau's picture

Thanks for your answer, with this I can work.