Contents User Forum Source Index APIs by Task APIs by Level Data


G3D::SuperShader::Material Class Reference

Describes the properties of a material to be used with SuperShader. More...

#include <SuperShader.h>

List of all members.

Public Member Functions

void enforceDiffuseMask ()
 Material ()
bool operator!= (const Material &other) const
bool operator== (const Material &other) const
bool similarTo (const Material &other) const

Public Attributes

float bumpMapScale
bool changed
Component diffuse
Component emit
Texture::Ref normalBumpMap
Component reflect
Component specular
Component specularExponent
Component transmit

Friends

class SuperShader


Detailed Description

Describes the properties of a material to be used with SuperShader.

Each of the Component fields can be set to a scalar constant, a color, a texture map, or the product of a color and a texture map. Unused components are optimized away by the SuperShader.

Beta API; subject to change in future releases. Illumination Equation:

dst1 = underlying value in frame buffer evt = environment map ambUp, ambDn = ambient map up and down values (ideally, environment map convolved with a hemisphere)

dst2 = dst1 * transmission + evt[n] * reflection + lerp(ambDn, ambUp, n.y/2 + 0.5) * diffuse + emissive + SUM OVER LIGHTS { light * (diffuse * NdotL + specular * NdotH^specularExponent)}

When choosing material properties, the transmission, diffuse, and specular terms should sum to less than 1. The reflection and specular terms are technically the same value and should be equal; the difference is that specular only applies to lights and reflection to the environment (less lights), a concession to artistic control.

Note that most translucent materials should be two-sided and have comparatively low diffuse terms. They should also be applied to convex objects (subdivide non-convex objects) to prevent rendering surfaces out of order.


Constructor & Destructor Documentation

G3D::SuperShader::Material::Material (  )  [inline]


Member Function Documentation

void G3D::SuperShader::Material::enforceDiffuseMask (  ) 

If Material::changed is true, copies the diffuse texture's alpha channel to all other maps.

Call before rendering with this material.

bool G3D::SuperShader::Material::operator!= ( const Material other  )  const [inline]

bool G3D::SuperShader::Material::operator== ( const Material other  )  const [inline]

To be identical, two materials must not only have the same images in their textures but must share pointers to the same underlying Texture objects.

bool G3D::SuperShader::Material::similarTo ( const Material other  )  const

Returns true if this material uses similar terms as other (used by SuperShader), although the actual textures may differ.


Friends And Related Function Documentation

friend class SuperShader [friend]


Member Data Documentation

Multiply normal map alpha values (originally on the range 0-1) by this constant to obtain the real-world bump height.

Should already be factored in to the normal map normals.

If the diffuse texture is changed, set this to true.

Defaults to true.

Diffuse reflection of lights.

The alpha channel is used as a mask, e.g., to cut out the shape of a leaf or a billboard, but does NOT encode transparency. Use the transmit member to specify (optionally colored) transparency.

Glow without illuminating other objects.

RGB*2-1 = tangent space normal, A = tangent space bump height.

If NULL bump mapping is disabled.

Perfect specular (mirror) reflection of the environment.

Specular (glossy) reflection of lights.

Translucency.

Can be colored.


The documentation for this class was generated from the following file:
Generated on Thu Aug 2 11:40:47 2007 for G3D by doxygen 1.5.2
Hosted by SourceForge.net Logo