NVIDIA IndeX API nvidia_logo_transpbg.gif Up
nv::index::IPhong_gl Class Referenceabstract

Simple OpenGL Phong material property. More...

#include <imaterial.h>

Inherits mi::base::Interface_declare< 0x9202fbb8, ... >.

Public Member Functions

virtual void set_ambient (const mi::math::Color_struct &ka)=0
 Sets the ambient term of the material. More...
 
virtual const mi::math::Color_struct & get_ambient () const =0
 Returns the ambient term of the material. More...
 
virtual void set_diffuse (const mi::math::Color_struct &kd)=0
 Sets the diffuse term of the material. More...
 
virtual const mi::math::Color_struct & get_diffuse () const =0
 Returns the diffuse term of the material. More...
 
virtual void set_specular (const mi::math::Color_struct &ks)=0
 Sets the specular term of the material. More...
 
virtual const mi::math::Color_struct & get_specular () const =0
 Returns the specular term of the material. More...
 
virtual void set_shininess (mi::Float32 shininess)=0
 Sets the specular shininess. More...
 
virtual mi::Float32 get_shininess () const =0
 Returns the specular shininess. More...
 
virtual void set_opacity (mi::Float32 opacity)=0
 Sets the opacity of the material. More...
 
virtual mi::Float32 get_opacity () const =0
 Returns the opacity of the material. More...
 

Detailed Description

Simple OpenGL Phong material property.

An implementation of the material base class provides the material properties for the standard Phong lighting model as implemented in OpenGL. The following terms define the material properties:

  • Ambient term. An ambient term accounts for light bounced around in the scene as if it comes from everywhere. The ambient light does not appear to come from any particular direction but from all directions. Therefore, the ambient lighting term does not depend on a light's position. Let the parameter KA represent the material's ambient reflectance and the parameter global_ambient represent the color of the incoming ambient light then the ambient term is: ambient = KA x global_ambient
  • Diffuse term. The diffuse term accounts for directed light reflected off the surface equally in all directions. In a microscopic scale, diffuse materials are rough and reflect light bounces off in all directions. The amount of light reflected is proportional to the angle of incidence of the incoming light (Lambertian reflectance). Let the parameter KD represent the material's diffuse reflectance, the parameter light_diffuse represent the color of the diffuse incoming light contribution, the parameter N represent the normal at a surface position, the parameter L represent the normalized incident direction of the incoming light, and P the surface position to be shaded, then the diffuse term is: diffuse = KD x global_diffuse x max(dot(L, N), 0.0)
  • Specular term. The specular term represents light scattered mostly around the mirroring direction at the surface position. The specular term is most striking on shiny surfaces and its contribution depends on the surface's orientation towards the viewer/camera. The specular term is affected by the specular color contribution of the light sources and the material as well as by the surface's shininess. Shinier surfaces have smaller, tighter highlights and less shiny materials have larger highlights. Let the parameter KS represent the material's specular reflectance, the parameter light_specular represent the color of the specular incoming light contribution, the parameter shininess represent the material's shininess, the parameter N represent the normal at a surface position, the parameter L represent the normalized incident direction of the incoming light, the parameter V represent the normalized incident vector towards the camera, the parameter H represent the normalized vector halfway between V and L, and P the surface position to be shaded, then the diffuse term is: specular = KS x global_specular x pow(max(dot(N, H), 0.0), shininess)

The term that describes the surface's light reflectance then is: surface_color = ambient + diffuse + specular

Member Function Documentation

 get_ambient()

virtual const mi::math::Color_struct & nv::index::IPhong_gl::get_ambient ( ) const
pure virtual

Returns the ambient term of the material.

Returns
color of ambient term

 get_diffuse()

virtual const mi::math::Color_struct & nv::index::IPhong_gl::get_diffuse ( ) const
pure virtual

Returns the diffuse term of the material.

Returns
color of diffuse term

 get_opacity()

virtual mi::Float32 nv::index::IPhong_gl::get_opacity ( ) const
pure virtual

Returns the opacity of the material.

Returns
opacity value

 get_shininess()

virtual mi::Float32 nv::index::IPhong_gl::get_shininess ( ) const
pure virtual

Returns the specular shininess.

Returns
shininess value

 get_specular()

virtual const mi::math::Color_struct & nv::index::IPhong_gl::get_specular ( ) const
pure virtual

Returns the specular term of the material.

Returns
color of specular term

 set_ambient()

virtual void nv::index::IPhong_gl::set_ambient ( const mi::math::Color_struct &  ka)
pure virtual

Sets the ambient term of the material.

Parameters
[in]kaAmbient term, the alpha component is ignored.

 set_diffuse()

virtual void nv::index::IPhong_gl::set_diffuse ( const mi::math::Color_struct &  kd)
pure virtual

Sets the diffuse term of the material.

Parameters
[in]kdDiffuse term, the alpha component is ignored.

 set_opacity()

virtual void nv::index::IPhong_gl::set_opacity ( mi::Float32  opacity)
pure virtual

Sets the opacity of the material.

Parameters
[in]opacityFully opaque at 1.0, fully transparent at 0.0.

 set_shininess()

virtual void nv::index::IPhong_gl::set_shininess ( mi::Float32  shininess)
pure virtual

Sets the specular shininess.

Parameters
[in]shininessShininess, typical values are between 5 and 100

 set_specular()

virtual void nv::index::IPhong_gl::set_specular ( const mi::math::Color_struct &  ks)
pure virtual

Sets the specular term of the material.

Parameters
[in]ksSpecular term, the alpha component is ignored.

The documentation for this class was generated from the following file: