Esempio n. 1
0
  private void benchmarkKD(Renderer renderer) {
    // Experiment with different settings for parameters for grid

    StringBuilder sb;
    System.err.println("------------------------");
    System.err.println("Starting extended BVH benchmark");
    System.err.println("------------------------");

    Scene scene = SceneFactory.getBVHScene();

    for (int i = 20; i < 200; i += 50) {
      System.err.println("KD leaf contents: " + i);
      sb = new StringBuilder();
      sb.append(
          "nbSpheres | nbIntersections"
              + i
              + " | mem"
              + i
              + " | buildtime"
              + i
              + " | rendertime"
              + i
              + '\n');

      Settings.KDTREE_ELEMENTS_IN_LEAF = i;

      iterate(renderer, sb, scene);

      toFile(sb.toString(), "kdtree" + i);
    }
  }
Esempio n. 2
0
  private void benchmarkAll(Renderer renderer) {
    StringBuilder sb;
    HashMap<String, Scene> scenes = new HashMap<String, Scene>();
    scenes.put("basic", new Scene());
    scenes.put("grid", SceneFactory.getGridScene());
    scenes.put("KD", SceneFactory.getBVHScene());

    // Compare all different acceleration structures with one another

    for (String sceneType : scenes.keySet()) {
      sb = new StringBuilder();
      sb.append(
          "nbSpheres | nbIntersections"
              + sceneType
              + " | mem"
              + sceneType
              + " | buildtime"
              + sceneType
              + " | rendertime"
              + sceneType
              + '\n');

      System.err.println("------------------------");
      System.err.println("Starting " + sceneType + " benchmark");
      System.err.println("------------------------");

      Scene scene = scenes.get(sceneType);
      iterate(renderer, sb, scene);

      System.out.println("Writing stats to file");

      toFile(sb.toString(), sceneType);
    }
  }