Class PathTracer
java.lang.Object
com.marginallyclever.ro3.apps.pathtracer.PathTracer
PathTracer performs multithreaded path tracing (aka ray tracing with bounces)-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddProgressListener(ProgressListener listener) voidvoidfireAndDisplayOneRay(int x, int y, int traceDepth) Fire one ray through the pixel at (x,y) and display the path on screen.Get the depth map buffer containing the distance information for each pixel.doublegetImage()Get the rendered image buffer containing the path traced scene.doubledoubleintintintlongGet the timestamp when the path tracing started.booleanbooleanCheck if the path tracer is currently processing.voidstatic longmix64(long z) voidvoidsetActivateToneMap(boolean activate) voidsetActiveCamera(Camera camera) Set the camera to be used for rendering the scene.voidsetExposure(double arg0) voidsetLightSamplingProbability(double probability) voidsetMaxContribution(double limit) voidsetMaxDepth(int maxDepth) voidsetMinBounces(int count) voidsetSamplesPerPixel(int samplesPerPixel) voidsetSize(int width, int height) Set the size of the canvas.voidstart()voidstop()void
-
Field Details
-
CHANNEL_VIEWPORT_U
public static final int CHANNEL_VIEWPORT_U- See Also:
-
CHANNEL_VIEWPORT_V
public static final int CHANNEL_VIEWPORT_V- See Also:
-
CHANNEL_HEMISPHERE_U
public static final int CHANNEL_HEMISPHERE_U- See Also:
-
CHANNEL_HEMISPHERE_V
public static final int CHANNEL_HEMISPHERE_V- See Also:
-
CHANNEL_RUSSIAN_ROULETTE
public static final int CHANNEL_RUSSIAN_ROULETTE- See Also:
-
CHANNEL_LIGHT_SAMPLING
public static final int CHANNEL_LIGHT_SAMPLING- See Also:
-
CHANNEL_BSDF_SAMPLING
public static final int CHANNEL_BSDF_SAMPLING- See Also:
-
-
Constructor Details
-
PathTracer
public PathTracer()
-
-
Method Details
-
stop
public void stop() -
start
public void start() -
getStartTime
public long getStartTime()Get the timestamp when the path tracing started.- Returns:
- the start time in milliseconds
-
setSize
public void setSize(int width, int height) Set the size of the canvas. Destroys the previous image and creates a new one.- Parameters:
width- the widthheight- the height
-
getImage
Get the rendered image buffer containing the path traced scene.- Returns:
- the rendered image as a BufferedImage
-
getDepthMap
Get the depth map buffer containing the distance information for each pixel.- Returns:
- the depth map as a BufferedImage
-
getNormalMap
-
setActiveCamera
Set the camera to be used for rendering the scene.- Parameters:
camera- the camera to use for path tracing
-
isRunning
public boolean isRunning()Check if the path tracer is currently processing.- Returns:
- true if the worker is active and not done or cancelled, false otherwise
-
fireAndDisplayOneRay
public void fireAndDisplayOneRay(int x, int y, int traceDepth) Fire one ray through the pixel at (x,y) and display the path on screen.- Parameters:
x- the x coordinate of the pixely- the y coordinate of the pixel
-
visualize
public void visualize() -
mix64
public static long mix64(long z) -
getMaxDepth
public int getMaxDepth() -
setMaxDepth
public void setMaxDepth(int maxDepth) -
getSamplesPerPixel
public int getSamplesPerPixel() -
setSamplesPerPixel
public void setSamplesPerPixel(int samplesPerPixel) -
addProgressListener
-
addPropertyChangeListener
-
getMaxContribution
public double getMaxContribution() -
setMaxContribution
public void setMaxContribution(double limit) -
getLightSamplingProbability
public double getLightSamplingProbability() -
setLightSamplingProbability
public void setLightSamplingProbability(double probability) -
getMinBounces
public int getMinBounces() -
setMinBounces
public void setMinBounces(int count) -
setExposure
public void setExposure(double arg0) -
getExposure
public double getExposure() -
setActivateToneMap
public void setActivateToneMap(boolean activate) -
isActivateToneMap
public boolean isActivateToneMap() -
savePreferences
public void savePreferences() -
loadPreferences
public void loadPreferences()
-