Beispiel #1
0
  void Scene::createHairAccel()
  {
    if (g_hair_accel == "default") 
    {
      if (isStatic()) {
        int mode =  2*(int)isCompact() + 1*(int)isRobust(); 
        switch (mode) {
        case /*0b00*/ 0: accels.add(BVH4::BVH4OBBBezier1v(this,isHighQuality())); break;
        case /*0b01*/ 1: accels.add(BVH4::BVH4OBBBezier1v(this,isHighQuality())); break;
        case /*0b10*/ 2: accels.add(BVH4::BVH4OBBBezier1i(this,isHighQuality())); break;
        case /*0b11*/ 3: accels.add(BVH4::BVH4OBBBezier1i(this,isHighQuality())); break;
        }
      } 
      else 
      {
        int mode =  2*(int)isCompact() + 1*(int)isRobust();
        switch (mode) {
	case /*0b00*/ 0: accels.add(BVH4::BVH4Bezier1v(this)); break;
        case /*0b01*/ 1: accels.add(BVH4::BVH4Bezier1v(this)); break;
        case /*0b10*/ 2: accels.add(BVH4::BVH4Bezier1i(this)); break;
        case /*0b11*/ 3: accels.add(BVH4::BVH4Bezier1i(this)); break;
        }
      }   
    }
    else if (g_hair_accel == "bvh4.bezier1v"    ) accels.add(BVH4::BVH4Bezier1v(this));
    else if (g_hair_accel == "bvh4.bezier1i"    ) accels.add(BVH4::BVH4Bezier1i(this));
    else if (g_hair_accel == "bvh4obb.bezier1v" ) accels.add(BVH4::BVH4OBBBezier1v(this,false));
    else if (g_hair_accel == "bvh4obb.bezier1i" ) accels.add(BVH4::BVH4OBBBezier1i(this,false));
    else THROW_RUNTIME_ERROR("unknown hair acceleration structure "+g_hair_accel);
  }
Beispiel #2
0
  void Scene::createHairAccel()
  {
    if (g_hair_accel == "default") 
    {
      if (isStatic()) {
        int mode =  2*(int)isCompact() + 1*(int)isRobust(); 
        switch (mode) {
        case /*0b00*/ 0: accels.add(BVH4Hair::BVH4HairBezier1(this,isHighQuality())); break;
        case /*0b01*/ 1: accels.add(BVH4Hair::BVH4HairBezier1(this,isHighQuality())); break;
        case /*0b10*/ 2: accels.add(BVH4Hair::BVH4HairBezier1i(this,isHighQuality())); break;
        case /*0b11*/ 3: accels.add(BVH4Hair::BVH4HairBezier1i(this,isHighQuality())); break;
        }
      } 
      else 
      {
        int mode =  2*(int)isCompact() + 1*(int)isRobust();
        switch (mode) {
	case /*0b00*/ 0: accels.add(BVH4::BVH4Bezier1(this)); break;
        case /*0b01*/ 1: accels.add(BVH4::BVH4Bezier1(this)); break;
        case /*0b10*/ 2: accels.add(BVH4::BVH4Bezier1i(this)); break;
        case /*0b11*/ 3: accels.add(BVH4::BVH4Bezier1i(this)); break;
        }
      }   
    }
    else if (g_hair_accel == "bvh4.bezier1"     ) accels.add(BVH4::BVH4Bezier1(this));
    else if (g_hair_accel == "bvh4.bezier1i"    ) accels.add(BVH4::BVH4Bezier1i(this));
    else if (g_hair_accel == "bvh4hair.bezier1" ) accels.add(BVH4Hair::BVH4HairBezier1(this,false));
    else if (g_hair_accel == "bvh4hair.bezier1i") accels.add(BVH4Hair::BVH4HairBezier1i(this,false));
    else throw std::runtime_error("unknown hair acceleration structure "+g_hair_accel);
  }
Beispiel #3
0
  void Scene::createTriangleAccel()
  {
    if (g_tri_accel == "default") 
    {
      if (isStatic()) {
        int mode =  2*(int)isCompact() + 1*(int)isRobust(); 
        switch (mode) {
        case /*0b00*/ 0: 
#if defined (__TARGET_AVX__)
          if (has_feature(AVX2)) // on AVX machines BVH8 gives lower performance, only enable on AVX2!
	  {
            if (isHighQuality()) accels.add(BVH8::BVH8Triangle8SpatialSplit(this)); 
            else                 accels.add(BVH8::BVH8Triangle8ObjectSplit(this)); 
          }
          else 
#endif
          {
            if (isHighQuality()) accels.add(BVH4::BVH4Triangle4SpatialSplit(this));
            else                 accels.add(BVH4::BVH4Triangle4ObjectSplit(this)); 
          }
          break;

        case /*0b01*/ 1: accels.add(BVH4::BVH4Triangle4vObjectSplit(this)); break;
        case /*0b10*/ 2: accels.add(BVH4::BVH4Triangle4iObjectSplit(this)); break;
        case /*0b11*/ 3: accels.add(BVH4::BVH4Triangle4iObjectSplit(this)); break;
        }
      } 
      else 
      {
        int mode =  2*(int)isCompact() + 1*(int)isRobust();
        switch (mode) {
        case /*0b00*/ 0: accels.add(BVH4::BVH4BVH4Triangle4ObjectSplit(this)); break;
        case /*0b01*/ 1: accels.add(BVH4::BVH4BVH4Triangle4vObjectSplit(this)); break;
        case /*0b10*/ 2: accels.add(BVH4::BVH4BVH4Triangle4iObjectSplit(this)); break;
        case /*0b11*/ 3: accels.add(BVH4::BVH4BVH4Triangle4iObjectSplit(this)); break;
        }
      }
    }
    else if (g_tri_accel == "bvh4.bvh4.triangle1")    accels.add(BVH4::BVH4BVH4Triangle1ObjectSplit(this));
    else if (g_tri_accel == "bvh4.bvh4.triangle4")    accels.add(BVH4::BVH4BVH4Triangle4ObjectSplit(this));
    else if (g_tri_accel == "bvh4.bvh4.triangle1v")   accels.add(BVH4::BVH4BVH4Triangle1vObjectSplit(this));
    else if (g_tri_accel == "bvh4.bvh4.triangle4v")   accels.add(BVH4::BVH4BVH4Triangle4vObjectSplit(this));
    else if (g_tri_accel == "bvh4.triangle1")         accels.add(BVH4::BVH4Triangle1(this));
    else if (g_tri_accel == "bvh4.triangle4")         accels.add(BVH4::BVH4Triangle4(this));
#if defined (__TARGET_AVX__)
    else if (g_tri_accel == "bvh4.triangle8")         accels.add(BVH4::BVH4Triangle8(this));
#endif
    else if (g_tri_accel == "bvh4.triangle1v")        accels.add(BVH4::BVH4Triangle1v(this));
    else if (g_tri_accel == "bvh4.triangle4v")        accels.add(BVH4::BVH4Triangle4v(this));
    else if (g_tri_accel == "bvh4.triangle4i")        accels.add(BVH4::BVH4Triangle4i(this));
#if defined (__TARGET_AVX__)
    else if (g_tri_accel == "bvh8.triangle8")         accels.add(BVH8::BVH8Triangle8(this));
#endif
    else throw std::runtime_error("unknown triangle acceleration structure "+g_tri_accel);
  }
Beispiel #4
0
  void Scene::createTriangleAccel()
  {
    if (g_tri_accel == "default") 
    {
      if (isStatic()) {
        int mode =  2*(int)isCompact() + 1*(int)isRobust(); 
        switch (mode) {
        case /*0b00*/ 0: 
#if defined (__TARGET_AVX__)
          if (has_feature(AVX))
	  {
            if (isHighQuality()) accels.add(BVH8::BVH8Triangle4SpatialSplit(this)); 
            else                 accels.add(BVH8::BVH8Triangle4ObjectSplit(this)); 
          }
          else 
#endif
          {
            if (isHighQuality()) accels.add(BVH4::BVH4Triangle4SpatialSplit(this));
            else                 accels.add(BVH4::BVH4Triangle4ObjectSplit(this)); 
          }
          break;

        case /*0b01*/ 1: accels.add(BVH4::BVH4Triangle4vObjectSplit(this)); break;
        case /*0b10*/ 2: accels.add(BVH4::BVH4Triangle4iObjectSplit(this)); break;
        case /*0b11*/ 3: accels.add(BVH4::BVH4Triangle4iObjectSplit(this)); break;
        }
      } 
      else 
      {
        int mode =  2*(int)isCompact() + 1*(int)isRobust();
        switch (mode) {
        case /*0b00*/ 0: accels.add(BVH4::BVH4BVH4Triangle4ObjectSplit(this)); break;
        case /*0b01*/ 1: accels.add(BVH4::BVH4BVH4Triangle4vObjectSplit(this)); break;
        case /*0b10*/ 2: accels.add(BVH4::BVH4BVH4Triangle4iObjectSplit(this)); break;
        case /*0b11*/ 3: accels.add(BVH4::BVH4BVH4Triangle4iObjectSplit(this)); break;
        }
      }
    }
    else if (g_tri_accel == "bvh4.bvh4.triangle1")    accels.add(BVH4::BVH4BVH4Triangle1ObjectSplit(this));
    else if (g_tri_accel == "bvh4.bvh4.triangle4")    accels.add(BVH4::BVH4BVH4Triangle4ObjectSplit(this));
    else if (g_tri_accel == "bvh4.bvh4.triangle1v")   accels.add(BVH4::BVH4BVH4Triangle1vObjectSplit(this));
    else if (g_tri_accel == "bvh4.bvh4.triangle4v")   accels.add(BVH4::BVH4BVH4Triangle4vObjectSplit(this));
    else if (g_tri_accel == "bvh4.triangle1")         accels.add(BVH4::BVH4Triangle1(this));
    else if (g_tri_accel == "bvh4.triangle4")         accels.add(BVH4::BVH4Triangle4(this));
    else if (g_tri_accel == "bvh4.triangle1v")        accels.add(BVH4::BVH4Triangle1v(this));
    else if (g_tri_accel == "bvh4.triangle4v")        accels.add(BVH4::BVH4Triangle4v(this));
    else if (g_tri_accel == "bvh4.triangle4i")        accels.add(BVH4::BVH4Triangle4i(this));
#if defined (__TARGET_AVX__)
    else if (g_tri_accel == "bvh4.triangle8")         accels.add(BVH4::BVH4Triangle8(this));
    else if (g_tri_accel == "bvh8.triangle4")         accels.add(BVH8::BVH8Triangle4(this));
    else if (g_tri_accel == "bvh8.triangle8")         accels.add(BVH8::BVH8Triangle8(this));
#endif
    else THROW_RUNTIME_ERROR("unknown triangle acceleration structure "+g_tri_accel);
  }
Beispiel #5
0
  Scene::Scene (RTCSceneFlags sflags, RTCAlgorithmFlags aflags)
    : flags(sflags), aflags(aflags), numMappedBuffers(0), is_build(false), needTriangles(false), needVertices(false),
      numTriangles(0), numTriangles2(0), 
      numBezierCurves(0), numBezierCurves2(0), 
      numSubdivPatches(0), numSubdivPatches2(0), 
      numUserGeometries1(0), 
      numIntersectionFilters4(0), numIntersectionFilters8(0), numIntersectionFilters16(0),
      commitCounter(0)
  {
#if !defined(__MIC__)
    lockstep_scheduler.taskBarrier.init(TaskScheduler::getNumThreads());
#else
    lockstep_scheduler.taskBarrier.init(MAX_MIC_THREADS);
#endif
    if (g_scene_flags != -1)
      flags = (RTCSceneFlags) g_scene_flags;

    geometries.reserve(128);

#if defined(__MIC__)
    accels.add( BVH4mb::BVH4mbTriangle1ObjectSplitBinnedSAH(this) );
    accels.add( BVH4i::BVH4iVirtualGeometryBinnedSAH(this) );
    accels.add( BVH4Hair::BVH4HairBinnedSAH(this) );
    accels.add( BVH4i::BVH4iSubdivMeshBinnedSAH(this) );

    if (g_verbose >= 1)
      {
	std::cout << "scene flags: static " << isStatic() << " compact = " << isCompact() << " high quality = " << isHighQuality() << " robust = " << isRobust() << std::endl;
      }

    if (g_tri_accel == "default" || g_tri_accel == "bvh4i")   
      {
	if (g_tri_builder == "default") 
	  {
	    if (isStatic())
	      {
		if (g_verbose >= 1) std::cout << "STATIC BUILDER MODE" << std::endl;
		if ( isCompact() )
		  accels.add(BVH4i::BVH4iTriangle1MemoryConservativeBinnedSAH(this));		    
		else if ( isHighQuality() )
		  accels.add(BVH4i::BVH4iTriangle1ObjectSplitBinnedSAH(this));
		else
		  accels.add(BVH4i::BVH4iTriangle1ObjectSplitBinnedSAH(this));
	      }
	    else
	      {
		if (g_verbose >= 1) std::cout << "DYNAMIC BUILDER MODE" << std::endl;
		accels.add(BVH4i::BVH4iTriangle1ObjectSplitMorton(this));
	      }
	  }
	else
	  {
	    if (g_tri_builder == "sah" || g_tri_builder == "bvh4i" || g_tri_builder == "bvh4i.sah") {
	      accels.add(BVH4i::BVH4iTriangle1ObjectSplitBinnedSAH(this));
	    }
	    else if (g_tri_builder == "fast" || g_tri_builder == "morton") {
	      accels.add(BVH4i::BVH4iTriangle1ObjectSplitMorton(this));
	    }
	    else if (g_tri_builder == "fast_enhanced" || g_tri_builder == "morton.enhanced") {
	      accels.add(BVH4i::BVH4iTriangle1ObjectSplitEnhancedMorton(this));
	    }
	    else if (g_tri_builder == "high_quality" || g_tri_builder == "presplits") {
	      accels.add(BVH4i::BVH4iTriangle1PreSplitsBinnedSAH(this));
	    }
	    else if (g_tri_builder == "compact" ||
		     g_tri_builder == "memory_conservative") {
	      accels.add(BVH4i::BVH4iTriangle1MemoryConservativeBinnedSAH(this));
	    }
	    else if (g_tri_builder == "morton64") {
	      accels.add(BVH4i::BVH4iTriangle1ObjectSplitMorton64Bit(this));
	    }

	    else THROW_RUNTIME_ERROR("unknown builder "+g_tri_builder+" for BVH4i<Triangle1>");
	  }
      }
    else THROW_RUNTIME_ERROR("unknown accel "+g_tri_accel);


#else
    createTriangleAccel();
    //accels.add(BVH4::BVH4Triangle1vMB(this));
    accels.add(BVH4::BVH4Triangle4vMB(this));
    accels.add(BVH4::BVH4UserGeometry(this));
    createHairAccel();
    accels.add(BVH4::BVH4OBBBezier1iMB(this,false));
    createSubdivAccel();

#endif
  }
Beispiel #6
0
  Scene::Scene (RTCSceneFlags sflags, RTCAlgorithmFlags aflags)
    : flags(sflags), aflags(aflags), numMappedBuffers(0), is_build(false), needTriangles(false), needVertices(false),
      numTriangleMeshes(0), numTriangleMeshes2(0), numTriangles(0), numTriangles2(0), numBezierCurves(0), numBezierCurves2(0), numUserGeometries1(0), 
      numIntersectionFilters4(0), numIntersectionFilters8(0), numIntersectionFilters16(0)
  {
    if (g_scene_flags != -1)
      flags = (RTCSceneFlags) g_scene_flags;

    geometries.reserve(128);

#if defined(__MIC__)
    accels.add( BVH4mb::BVH4mbTriangle1ObjectSplitBinnedSAH(this) );
    accels.add( BVH4i::BVH4iVirtualGeometryBinnedSAH(this) );
    accels.add( BVH4Hair::BVH4HairBinnedSAH(this) );

    if (g_verbose >= 1)
      {
	std::cout << "scene flags: static " << isStatic() << " compact = " << isCompact() << " high quality = " << isHighQuality() << " robust = " << isRobust() << std::endl;
      }

    if (g_tri_accel == "default" || g_tri_accel == "bvh4i")   
      {
	if (g_tri_builder == "default") 
	  {
	    if (isStatic())
	      {
		if (g_verbose >= 1) std::cout << "STATIC BUILDER MODE" << std::endl;
		if ( isCompact() )
		  accels.add(BVH4i::BVH4iTriangle1MemoryConservativeBinnedSAH(this));		    
		else if ( isHighQuality() )
		  accels.add(BVH4i::BVH4iTriangle1ObjectSplitBinnedSAH(this));
		else
		  accels.add(BVH4i::BVH4iTriangle1ObjectSplitBinnedSAH(this));
	      }
	    else
	      {
		if (g_verbose >= 1) std::cout << "DYNAMIC BUILDER MODE" << std::endl;
		accels.add(BVH4i::BVH4iTriangle1ObjectSplitMorton(this));
	      }
	  }
	else
	  {
	    if (g_tri_builder == "sah" || g_tri_builder == "bvh4i" || g_tri_builder == "bvh4i.sah") {
	      accels.add(BVH4i::BVH4iTriangle1ObjectSplitBinnedSAH(this));
	    }
	    else if (g_tri_builder == "fast" || g_tri_builder == "morton") {
	      accels.add(BVH4i::BVH4iTriangle1ObjectSplitMorton(this));
	    }
	    else if (g_tri_builder == "fast_enhanced" || g_tri_builder == "morton.enhanced") {
	      accels.add(BVH4i::BVH4iTriangle1ObjectSplitEnhancedMorton(this));
	    }
	    else if (g_tri_builder == "high_quality" || g_tri_builder == "presplits") {
	      accels.add(BVH4i::BVH4iTriangle1PreSplitsBinnedSAH(this));
	    }
	    else if (g_tri_builder == "compact" ||
		     g_tri_builder == "memory_conservative") {
	      accels.add(BVH4i::BVH4iTriangle1MemoryConservativeBinnedSAH(this));
	    }
	    else if (g_tri_builder == "morton64") {
	      accels.add(BVH4i::BVH4iTriangle1ObjectSplitMorton64Bit(this));
	    }

	    else throw std::runtime_error("unknown builder "+g_tri_builder+" for BVH4i<Triangle1>");
	  }
      }
    else throw std::runtime_error("unknown accel "+g_tri_accel);


#else
    createTriangleAccel();
    accels.add(BVH4MB::BVH4MBTriangle1v(this));
    accels.add(BVH4::BVH4UserGeometry(this));
    createHairAccel();
#endif
  }