Problem with Transform

Hi,

I was just playing with the glass example in the SDK.

Instead of tranforming the .obj geometry point by point to new world space positions in ObjLoader.cpp, I’ve instead passed load() an identity transform and used the OptiX Transform nodes.

The geometry appears in the correct positions when rendered; however, the rendered result has blotchy blue artifacts all over it. Can somebody look at the example code snippet I added and please tell me if there’s anything obviously wrong with it?

Thanks for your time.

Modified code beginning at around line 321 of glass.cpp:

[  const float matrix_3[4*4] = { 1,  0,  0,  0, 
                                0,  1,  0,  0, 
                                0,  0,  1,  0, 
                                0,  0,  0,  1 };

const optix::Matrix4x4 identity( matrix_3 );

  std::string prog_path = std::string(sutilSamplesPtxDir()) + "/glass_generated_triangle_mesh_iterative.cu.ptx";
  Program mesh_intersect = _context->createProgramFromPTXFile( prog_path, "mesh_intersect" );

  ObjLoader objloader0( (path + "/cognacglass.obj").c_str(), _context, geomgroup[0], material[0] );
  objloader0.setIntersectProgram( mesh_intersect );
  objloader0.load( identity );
  ObjLoader objloader1( (path + "/wineglass.obj").c_str(),   _context, geomgroup[1], material[0] );
  objloader1.setIntersectProgram( mesh_intersect );
  objloader1.load( identity );
  ObjLoader objloader2( (path + "/waterglass.obj").c_str(),  _context, geomgroup[2], material[0] );
  objloader2.setIntersectProgram( mesh_intersect );
  objloader2.load( identity );
  
  Group group = _context->createGroup();
  group->setChildCount( 3u );
  group->setAcceleration(_context->createAcceleration("Bvh", "Bvh"));
  
  Transform transform0 = _context->createTransform();
  transform0->setChild( geomgroup[0] );
  group->setChild( 0, transform0 );
  transform0->setMatrix( false, matrix_0, 0 );

  Transform transform1 = _context->createTransform();
  transform1->setChild( geomgroup[1] );
  group->setChild( 1, transform1 );
  transform1->setMatrix( false, matrix_1, 0 );

  Transform transform2 = _context->createTransform();
  transform2->setChild( geomgroup[2] );
  group->setChild( 2, transform2 );
  transform2->setMatrix( false, matrix_2, 0 );
   
  Group maingroup = _context->createGroup();
  
  maingroup->setChildCount( 3 );

  maingroup->setChild( 0, transform0 );
  maingroup->setChild( 1, transform1 );
  maingroup->setChild( 2, transform2 );

Please check if it’s the cyan exception color by changing this line inside the example to another color:
m_context[“bad_color”]->setFloat( 0.0f, 1.0f, 1.0f );
If yes, that happened because you made the scene hierarchy deeper. Increase the stack size until the stack overflow exceptions go away.

Thank you!

That solved my problem.