-
Notifications
You must be signed in to change notification settings - Fork 20
Material
The appearence of virtual objects, the appearance of the surface, is defined by its material and the lighting in the scene. The material is a set of parameters that define the way to represent the geometry surface.
The basic color parameters are:
- diffuse, essentially the basic color of the material (RGB from 0.0 to 1.0)
- ambient, a color offset not changed by lighting
- specular, the color of specular reflections on a surface
- emissive, TODO
- transparency, a single value from 0.0 (fully transparent) to 1.0 (fully opaque)
Transparency can further be controlled with:
- enableTransparency()
- clearTransparency() - very useful when dealing with transparency glitches ;)
A material can have multiple passes. This means that different sets of material properties can be stacked. An object with that material will be rendered with each pass after the other.
Use addPass() to add a new pass, the new pass will be the active one right away. To switch between passes use setPass(i). Every call on the material will affect the currently active pass.
Sometimes it is necessary to disable depth testing, for example for HUDs or visualizing abstract data. You can disable depth testing with setDepthTest('GL_ALWAYS')
To change point size and line with use setPointSize( int ) and setLineWidth( int ).
To set the mag and min filtering mode use setMagMinFilter( mag, min ). Typical values are for example:
setMagMinFilter( GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR ) # Texturing uses tri-linear interpolation with mipmaps
setMagMinFilter( GL_LINEAR, GL_LINEAR ) # Texturing uses no mipmapping
setMagMinFilter( GL_NEAREST, GL_NEAREST_MIPMAP_NEAREST ) # Texturing uses no interpolation
PolyVR can generate a QR code on texture, setQRCode( message )