Class TClassicRayTracer

Unit

Declaration

type TClassicRayTracer = class(TRayTracer)

Description

Classic Whitted-style ray-tracer. See [https://castle-engine.io/vrml_engine_doc/output/xsl/html/section.classic_ray_tracer.html] for documentation.

Make sure that VRML2Lights in states are properly initialized if you plan to render VRML 2.0 nodes. TCastleSceneCore and descendants do this for you automatically.

Source: scene/castleraytracer.pas (line 138).

Hierarchy

Show Additional Members:

Overview

Fields

Public Octree: TBaseTrianglesOctree;
Public Image: TCastleImage;
Public CamPosition: TVector3;
Public CamDirection: TVector3;
Public CamUp: TVector3;
Public Projection: TProjection;
Public SceneBGColor: TVector3;
Public Background: TAbstractBackgroundNode;
Public PixelsMadeNotifier: TPixelsMadeNotifierFunc;
Public PixelsMadeNotifierData: Pointer;
Public FirstPixel: Cardinal;
Public InitialDepth: Cardinal;
Public FogNode: TFogNode;
Public GlobalLights: TLightInstancesList;
Public OwnsGlobalLights: boolean;

Methods

Public procedure ExecuteStats(const Stats: TStrings);
Protected procedure AppendStats(const Stats: TStrings; const RenderingTime: Single); override;
Public procedure Execute; override;
Public destructor Destroy; override;

Properties

Public property BaseLights: TLightInstancesList read GlobalLights write GlobalLights; deprecated 'use GlobalLights';
Public property OwnsBaseLights: Boolean read OwnsGlobalLights write OwnsGlobalLights; deprecated 'use OwnsGlobalLights';

Description

Fields

Public Octree: TBaseTrianglesOctree;

This item is declared in ancestor TRayTracer.

Spatial structure (that contains geometry with materials) to render. You can create it using e.g. CreateOctreeVisibleTrianglesForScene for TCastleScene. Must be set before calling Execute.

Source: scene/castleraytracer.pas (line 58).

Public Image: TCastleImage;

This item is declared in ancestor TRayTracer.

Image where the ray-tracer result will be stored. Must be set before calling Execute.

We will not resize given here Image. Instead we will use it's current size — so you just have to set Image size as appropriate before calling this method.

For every pixel, we calculate it's color and store it by TCastleImage.Color[X, Y, 0] := xxx method. We don't modify alpha channel of the image.

Using TRGBFloatImage class is advised if you want the full color information. Otherwise color precision is lost beyond 8 bits, and values above 1.0 are clamped.

Source: scene/castleraytracer.pas (line 74).

Public CamPosition: TVector3;

This item is declared in ancestor TRayTracer.

Camera view. CamDirection and CamUp do not have to be normalized — we will correct them here if needed. CamUp will be automatically corrected to be orthogonal to CamDirection if necessary, you only make sure it's not parallel to CamDirection.

Source: scene/castleraytracer.pas (line 82).

Public CamDirection: TVector3;

This item is declared in ancestor TRayTracer.

Camera view. CamDirection and CamUp do not have to be normalized — we will correct them here if needed. CamUp will be automatically corrected to be orthogonal to CamDirection if necessary, you only make sure it's not parallel to CamDirection.

Source: scene/castleraytracer.pas (line 82).

Public CamUp: TVector3;

This item is declared in ancestor TRayTracer.

Camera view. CamDirection and CamUp do not have to be normalized — we will correct them here if needed. CamUp will be automatically corrected to be orthogonal to CamDirection if necessary, you only make sure it's not parallel to CamDirection.

Source: scene/castleraytracer.pas (line 82).

Public Projection: TProjection;

This item is declared in ancestor TRayTracer.

Camera projection properties.

Source: scene/castleraytracer.pas (line 85).

Public SceneBGColor: TVector3;

This item is declared in ancestor TRayTracer.

Default background color, if scene doesn't have Background node with skyColor.

Source: scene/castleraytracer.pas (line 88).

Public Background: TAbstractBackgroundNode;

This item is declared in ancestor TRayTracer.

Scene Background node.

Source: scene/castleraytracer.pas (line 91).

Public PixelsMadeNotifier: TPixelsMadeNotifierFunc;

This item is declared in ancestor TRayTracer.

Callback notified (if assigned) about writing each image pixel. This way you can display somewhere, or store to file, partially generated image. This callback gets information (in PixelsMadeCount) about how many pixels were generated (this includes also pixels skipped in case FirstPixel > 0).

The pixels are written in the order of TSwapScanCurve for TClassicRayTracer, and in order dependent on TPathTracer.SFCurveClass for TPathTracer. When shadow cache will be implemented to TClassicRayTracer, then configurable SFCurveClass may be done also for TClassicRayTracer.

Remember that pixels not done yet have the same content as they had when you Execute method started. In other words, if you set PixelsMadeNotifier <> nil, then often it's desirable to initialize Image content with some color (e.g. black) before calling Execute. Otherwise at the time of Execute call, the pixels not done yet will have undefined colors.

Source: scene/castleraytracer.pas (line 110).

Public PixelsMadeNotifierData: Pointer;

This item is declared in ancestor TRayTracer.

This item has no description.

Source: scene/castleraytracer.pas (line 111).

Public FirstPixel: Cardinal;

This item is declared in ancestor TRayTracer.

Initial pixel to start rendering from. By setting this to something > 0, you can (re-)start rendering from the middle. Useful to finish the job of a previous terminated ray-tracer process.

Must be in [0 .. Image.Width * Image.Height] range. Setting to Image.Width * Image.Height makes the ray-tracer do nothing.

Source: scene/castleraytracer.pas (line 120).

Public InitialDepth: Cardinal;

Limit for recursion depth. 0 means that only primary rays will be cast, 1 means that primary rays and 1 ray into mirror / transmitted / shadow, and so on.

Source: scene/castleraytracer.pas (line 145).

Public FogNode: TFogNode;

Fog to render. Set FogNode <> Nil to render a fog, following VRML 2.0/X3D lighting equations. FogNode.TransformScale is used.

Source: scene/castleraytracer.pas (line 150).

Public GlobalLights: TLightInstancesList;

Lights shining on everything, like a headlight.

Source: scene/castleraytracer.pas (line 153).

Public OwnsGlobalLights: boolean;

This item has no description.

Source: scene/castleraytracer.pas (line 154).

Methods

Public procedure ExecuteStats(const Stats: TStrings);

This item is declared in ancestor TRayTracer.

Do ray-tracing, like Execute, additionally gathering some statistics. The statistics will be added to the given string list.

Source: scene/castleraytracer.pas (line 128).

Protected procedure AppendStats(const Stats: TStrings; const RenderingTime: Single); override;

This item has no description.

Source: scene/castleraytracer.pas (line 140).

Public procedure Execute; override;

This item has no description. Showing description inherited from TRayTracer.Execute.

Do ray-tracing, writing a ray-traced image into the Image.

Source: scene/castleraytracer.pas (line 161).

Public destructor Destroy; override;

This item has no description.

Source: scene/castleraytracer.pas (line 162).

Properties

Public property BaseLights: TLightInstancesList read GlobalLights write GlobalLights; deprecated 'use GlobalLights';

Warning: this symbol is deprecated: use GlobalLights

This item has no description.

Source: scene/castleraytracer.pas (line 156).

Public property OwnsBaseLights: Boolean read OwnsGlobalLights write OwnsGlobalLights; deprecated 'use OwnsGlobalLights';

Warning: this symbol is deprecated: use OwnsGlobalLights

This item has no description.

Source: scene/castleraytracer.pas (line 158).


Generated by PasDoc 0.17.0.snapshot.