Skip to content
Häfner edited this page Mar 24, 2021 · 10 revisions

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.

Basic colors and transparency

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 ;)

Material passes

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.

Depth testing

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')

Point size and line with

To change point size and line with use setPointSize( int ) and setLineWidth( int ).

Mag/min filtering

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

QR Codes

PolyVR can generate a QR code on texture, setQRCode( message )

Clone this wiki locally