Module raytracer

Class StochasticSupersampling

All Implemented Interfaces:
Antialiasing, Cloneable

public class StochasticSupersampling extends NoAntialiasing
This class implements a stratified stochastic supersampling strategy. Each pixel rectangle is divided into a square grid of strata, for each stratum a random ray is generated and its color determined.
Author:
Michael Tauer, Ole Kniemeyer
  • Field Details

    • GRID_SIZE

      public static final String GRID_SIZE
      See Also:
    • DEBUG_I

      public static int DEBUG_I
    • DEBUG_J

      public static int DEBUG_J
    • CURRENT_I

      public static int CURRENT_I
    • CURRENT_J

      public static int CURRENT_J
  • Constructor Details

    • StochasticSupersampling

      public StochasticSupersampling()
  • Method Details

    • initLocals

      protected void initLocals()
      Overrides:
      initLocals in class NoAntialiasing
    • initialize

      public void initialize(PixelwiseRenderer tracer, Scene scene)
      Description copied from interface: Antialiasing
      Initializes the antialiasing method using the data available through the renderer.
      Specified by:
      initialize in interface Antialiasing
      Overrides:
      initialize in class NoAntialiasing
      Parameters:
      tracer - the renderer which provides the needed information
      scene - the scene which is rendered
    • setGridSize

      public void setGridSize(int size)
      Sets the grid size for supersampling. A square grid of size by size strata will be used to generate the random rays.
      Parameters:
      size - size of the grid edges
    • getColorOfRectangle

      public void getColorOfRectangle(double x, double y, double width, double height, Color4f color, Random random)
      Description copied from interface: Antialiasing
      This method has to return a color value determined for a given rectangular region on the image plane. The coordinates are understood as uv coordinates for the Sensor which represents the camera.
      Specified by:
      getColorOfRectangle in interface Antialiasing
      Overrides:
      getColorOfRectangle in class NoAntialiasing
      Parameters:
      x - Describes the x position of the lower left corner of the rectangle.
      y - Describes the y position of the lower left corner of the rectangle.
      width - width of the rectangle
      height - height of the of the rectangle
      color - The determined color of the rectangle will be stored in this parameter.
      random - pseudorandom generator
    • appendStatisticsImpl

      protected void appendStatisticsImpl(StringBuffer stats)
      Overrides:
      appendStatisticsImpl in class NoAntialiasing