RENDER Function
Generates a ray-traced rendered image from one or more predefined objects.
Usage
result = RENDER(object1, ..., objectn)
Input Parameters
objecti—A previously-defined object. Valid object types include CONE, CYLINDER, MESH, SPHERE, and VOLUME.
Returned Value
result—A 2D byte array (image) of size X-by-Y.
Keywords
Info—A 3-by-4 double-precision floating-point array used to return the automatically calculated view as: [viewpoint, top_left_viewplane, bottom_left_viewplane, bottom_right_viewplane].
For example, you could define the variable k to contain this default view as follows:
k = DBLARR(3, 4)
RENDER(object, Info=k)
Lights—A double-precision floating-point array defining the position and intensity (x,y, z, intensity) of all point light sources in the scene. It is of size 4-by-number_of_lights.
If this keyword is omitted, then a single light source is defined; this light source coincides with the automatically generated viewer’s eye-point.
Sample—A long integer containing the number of randomly distributed rays to fire per pixel to perform anti-aliasing. The default is Sample=1.
Scale—If present, indicates that the resultant image should be scaled prior to conversion to bytes. By default, all generated shaded values are assumed to be in the range {0...1} (see Discussion below).
Shadows—If present, indicates that shadow rays should be fired so that all points on all objects are not visible to all light sources. If not present, every point in a scene is visible to each light source.
Note: |
For most visualization applications, you will want to omit the Shadows keyword, since this causes the ray tracer to run much faster. |
Transform—A 4-by-4 double-precision floating-point array containing the local transformation matrix whose default is the identity matrix.
View—A 3-by-4 double-precision floating-point array used to override the auto-generation of the view to that specified. Uses the same format as is used for the Info keyword.
X—An integer defining the width of the byte image to be returned. Defaults to 256.
Y—An integer defining the height of the byte image to be returned. Defaults to 256.
Discussion
RENDER generates an image from one or more objects using a technique called “ray tracing.” The size of the returned byte image is X-by-Y, where X and Y each default to 256 unless overridden with the X and Y keywords. The returned image can be displayed using either the TV or TVSCL procedure.
Numerous objects can be rendered in the same scene. RENDER automatically generates the viewing information such that all objects are visible and the observer’s viewpoint is on the positive Z axis looking towards the origin into the scene with a slight perspective. The Transform or the View keyword can be used to alter the default view. For more information, see the PV‑WAVE User Guide.
The Lights keyword can be used to pass in an array of locations and intensities of point light sources. Except for the default light source (when none are specified by keyword), the light sources specified are not transformed. For best results, the sum of the intensities of light sources should equal 1.
The Scale keyword should be used in the following cases to ensure that all objects in the resulting image are in proportionate intensity if:
the sum of the light source intensities is greater than 1
there exists a material property in the scene such that
Color(i) * (Kamb(i) + Kdiff(i) + Ktran(i)) > 1.
If all of the values are less than 1, then the Scale keyword is not required, but you may wish to view the resultant image using TVSCL to improve the contrast.
By default, shadow rays are turned off and thus all points on all objects are visible to all lights. The firing of shadow rays can be turned on using the Shadows keyword.
Example
WINDOW, Xsize=256, Ysize=256
TV, RENDER(SPHERE())
See Also
CONE, CYLINDER, MESH, RENDER24, SPHERE, SHADE_VOLUME, TV, TVSCL, VOLUME
For more information, see the PV‑WAVE User Guide.