Particle Geometry 3.9

Arbitrary 3d point data can be rendered as particles, which as actual surface geometry with a predefined shape like sphere or tube. The particle primitive allows to describe masses of positional 3d elements all sharing the same shape in a very compact form. Furthermore, mental ray is able to implement optimized high performance algorithms to handle and shade those shapes efficiently.

object "nameobject"
    particle (spheres|tubes)[parameters]
    end map
end object

The object header is similar to the headers for all other geometry types, but the standard group...end group block is replaced with a particle statement followed by a map...end map block. The particle statement determines the particle shape that should be used to render the map content as surfaces, as follows:

particle spheres [ radius ("field_name"|Rscalar) ]

Renders the particles as spheres, in other words spherical surface geometry.

This type of geometry requires a radius parameter, either different per particle, or, a global constant one that is shared on all particles. If no explicit radius is given, then the value will be taken from the map field called "radius". If such a field in the map is global then all particles will all have the same radius, otherwise each particle gets its own radius.

The radius option can be used to pick a different field name of the map to drive the radius, or set an explicit value Ras a global override.

particle tubes [ radius0 ("field_name"|R0scalar) ]
               [ radius1 ("field_name"|R1scalar) ]
               [ radius  ("field_name"|Rscalar) ]
               [ length  ("field_name"|Lscalar) ]
               [ direction ("field_name"|Dvector) ]

Renders the particles as tubes, in other words cylindric surface geometry without caps.

This type of geometry requires two radii parameters radious0 and radius1 for each end, or, alternatively, one radius parameter radius for both, a direction and a length. The values for direction and length will be taken from the map fields called "direction" and "length", respectively. In case the map has two fields called "radius0" and "radius1", either global or per element, they will be taken as the radii of the tubes, where "radius0" is the radius of the cylinder at the start position (the position of the particle) and "radius1" is the radius of the cylinder at the tip. Alternatively, if the map has a field called "radius" it will drive both radius0 and radius1.

The optional directives radius0, radius1, radius, direction, and length can be used to pick a different field name of the map to drive the related value, or to set an explicit constant value as a global override.

All primitives have a position by default, which is taken from the position field of the map, see below.

The choice of natively supported shapes may be extended in future versions.

The map block contains the actual point data, which provides the 3d positions and optional parameters to control the particle properties for rendering. It shares the syntax of the body with the regular map data scene element, this time just placed inline after the particle statement. It supports both inline data definition like this:

map "declaration_name"
end map
Or, external files may be referenced instead, like this:
end map

Here are simple examples for particle objects:

declare map "particles" (
	dim 3,
	scalar "radius",
	scalar array 3 "color"
end declare

object "waterflow"
	visible on
	shadow 3
	transparency 3
	reflection 3
	refraction 3
	finalgather 3

	particle "spheres"

	map "particles"
            { 13.762719 1.794316 -2.098288, 0.097847, 0.260175 0.369913 0.739825 },
	    { 13.541430 1.830263 -0.920364, 0.021481, 0.536173 0.231913 0.463827 },
	    { 13.856024 1.850546 -1.919924, 0.264916, 0.730303 0.134849 0.269697 }
        end map
end object

object "bubbles"
	particle "spheres"	
            [ "" ]
	end map
end object

Particle objects may use standard material shaders as any other surface geometry, no special shader is required to shade particles. However, in order to adjust shading properties per particle new shader API functions are available to detect the individual element out of a particle map. As a convenience, new base shaders are available which perform such tasks, and may be used in shader graphs to drive input parameters on other shaders.

Copyright © 1986-2011 by mental images GmbH