java.lang.Object
de.grogra.ray2.tracing.ProcessorBase
de.grogra.ray2.antialiasing.NoAntialiasing
de.grogra.ray2.antialiasing.StochasticSupersampling
- All Implemented Interfaces:
Antialiasing
,Cloneable
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 Summary
Fields inherited from class de.grogra.ray2.antialiasing.NoAntialiasing
processor
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
appendStatisticsImpl
(StringBuffer stats) void
getColorOfRectangle
(double x, double y, double width, double height, Color4f color, Random random) This method has to return a color value determined for a given rectangular region on the image plane.void
initialize
(PixelwiseRenderer tracer, Scene scene) Initializes the antialiasing method using the data available through therenderer
.protected void
void
setGridSize
(int size) Sets the grid size for supersampling.Methods inherited from class de.grogra.ray2.antialiasing.NoAntialiasing
dup, setPixelXY
Methods inherited from class de.grogra.ray2.tracing.ProcessorBase
appendStatistics, clone, mergeStatistics
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface de.grogra.ray2.antialiasing.Antialiasing
appendStatistics
-
Field Details
-
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 classNoAntialiasing
-
initialize
Description copied from interface:Antialiasing
Initializes the antialiasing method using the data available through therenderer
.- Specified by:
initialize
in interfaceAntialiasing
- Overrides:
initialize
in classNoAntialiasing
- Parameters:
tracer
- the renderer which provides the needed informationscene
- the scene which is rendered
-
setGridSize
public void setGridSize(int size) Sets the grid size for supersampling. A square grid ofsize
bysize
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 asuv
coordinates for theSensor
which represents the camera.- Specified by:
getColorOfRectangle
in interfaceAntialiasing
- Overrides:
getColorOfRectangle
in classNoAntialiasing
- 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 rectangleheight
- height of the of the rectanglecolor
- The determined color of the rectangle will be stored in this parameter.random
- pseudorandom generator
-
appendStatisticsImpl
- Overrides:
appendStatisticsImpl
in classNoAntialiasing
-