Haptek Lights and Materials

  • 3 Replies


  • Trusty Member
  • ********
  • Replicant
  • *
  • 560
Haptek Lights and Materials
« on: February 27, 2009, 09:40:31 pm »
  Gathered all the info I could find, should be useful while working with the Hapexplorer and possibly for the camera.  I'm going to copy and paste rather than spend additional time trying to put it in some type of order in an attempt to have it make sense.

From HaptekSDK

From Haptek hypertext referance

From  /SetMaterial

Ambient, Diffuse, and Specular are all reflection-filters for light sources in the scene.
Emissive is a color internal to the object and is independant of lights in the scene.
Ambient, Diffuse, Specular, and Emissive are all 4-component colors, each component 0 - 1.
Specular power is a scalar value in the range of 0.1 to about 200, it modifies the size of the specular highlight.

i0=  Which property to set.
i0=0  Ambient Color
1  Diffuse Color
2  Specular Color
3  Emissive Color
4  Specular Power, If specular power is being set, the red component is used.
5  Use Environment Map
r=  red component
g=  green component
b=  blue component
a=  alpha (tranparency) component
i1=  useenvironment map?

   boolean flag for properties such as Use Environment Map

\setmaterial [i0= 1 r= 1 g= 1 b= 0 a= 0]
Sets the material's diffuse property to yellow.
\setmaterial[i0= 5 i1= 1]
Turns on the environment map. Note: Environment Maps are set in the scene file. One per scene.
\setmaterial[i0= 4 r= 20]
Change the Specular Power to 20

From Scene File

LightingFileName=   data\standard\standardLight.hap
# This file specifies the lighting. Each light may be modified during runtime, but as of this writing,
# the number of lights may not. So choose your initial number of lights well!

From \SetLight  found in Haptek hypertext Reference.

\SetLight index   prev    next   
player 4.11.10+

set the properties of a light

i0=  light number
i1=  light parameter
i1=0  Color.  use r,g,b
1  Position. (For Point Lights)  use f0, f1, f2
2  Direction(For Directional Lights)  use f0, f1, f2
3  Type. (Indicates what sort of light it is, see light type codes just below)  use i2
4  Enable. (On/Off)  use f0
i2=  light type (only if parameter = type)
i2=1  Ambient
3  Directional
5  Point
f0=  (f0)
r=  (r)
X=  (X)
f1=  (f1)
g=  (g)
Y=  (Y)
f2=  (f2)
b=  (b)
Z=  (Z)

\setlight [i0= 1 i1= 0 r= 1 g= 1 b= 0]
Set light 1's color to Yellow.
\setlight [i0= 1 i1= 1 f0= -30 f1= 0 f2= 0]
Set light 1's position to be -30 units along the X Axis. This is not useful if light 1 is an ambient or directional light.
\setlight [i0= 1 i1= 3 i2= 5]
Set light 1 to be a point light source.
\setlight [i0= 0 i1= 4 f0= 0]
Turn light 0 off
\setlight [i0= 0 i1= 4 f0= 1]
Turn light 0 on
\setlight [i0= 1 i1= 2 f0= 0 f1= 0 f2= 1]
Set the direction of light 1 to be straight along the Z axis.  Not useful for ambient and point lights.

From Wiki:

Ambient light (also available light or existing light) is a term used by photographers, cinematographers and other
practitioners of the visual arts to refer to the illumination surrounding a subject or scene, specifically any and
all light not provided by the photographer[1].

Levels of ambient light are most frequently considered relative to additional lighting used as fill light, in which
 case the ambient light is normally treated as the key light. In some cases, ambient light may be used as a fill,
in which case additional lighting provides the stronger light source, for example in bounce flash photography. The
relative intensity of ambient light and fill light is known as the lighting ratio, an important factor in calculating
 contrast in the finished image.

In optics, a diffuser is any device that diffuses or spreads out or scatters light in some manner, to give soft light.
 Optical diffusers use different methods to diffuse light and can include ground glass diffusers, teflon diffusers,
holographic diffusers, opal glass diffusers, and greyed glass diffusers.

A flash diffuser spreads the light from the flash of a camera. In effect, the light will not come from one concentrated
source (like a spotlight), but rather will spread out, bounce from reflective ceilings and walls, thus getting rid of
 harsh light, and hard shadows. This is particularly useful for portrait photographers, since harsh light and hard
shadows are usually not considered flattering in a portrait.

The term specular means that light is perfectly reflected in a mirror-like way from the light source to the viewer.
 Specular reflection is visible only where the surface normal is oriented precisely halfway between the direction
of incoming light and the direction of the viewer; this is called the half-angle direction because it bisects
 (divides into halves) the angle between the incoming light and the viewer. Thus, a specularly reflecting surface
would show a specular highlight as the perfectly sharp reflected image of a light source. However, many shiny objects
 show blurred specular highlights.

This can be explained by the existence of microfacets. We assume that surfaces that are not perfectly smooth are
composed of many very tiny facets, each of which is a perfect specular reflector. These microfacets have normals
that are distributed about the normal of the approximating smooth surface. The degree to which microfacet normals
differ from the smooth surface normal is determined by the roughness of the surface.

The reason for blurred specular highlights is now clear. At points on the object where the smooth normal is close
 to the half-angle direction, many of the microfacets point in the half-angle direction and so the specular highlight
is bright. As one moves away from the center of the highlight, the smooth normal and the half-angle direction get
 farther apart; the number of microfacets oriented in the half-angle direction falls, and so the intensity of the
highlight falls off to zero. The specular highlight often reflects the color of the light source, not the color of
 the reflecting object. This is because many materials have a thin layer of clear material above the surface of the
pigmented material. For example plastic is made up of tiny beads of color suspended in a clear polymer and human skin
 often has a thin layer of oil or sweat above the pigmented cells. Such materials will show specular highlights in
 which all parts of the color spectrum are reflected equally. On metallic materials such as gold the color of the
specular highlight will reflect the color of the material.

In physics, emission is the process by which the energy of a photon is released by another entity, for example,
by an atom whose electrons make a transition between two electronic energy levels. The emitted energy is in the
form of a photon.

The emittance of an object quantifies how much light is emitted by it. This may be related to other properties
 of the object through the Stefan–Boltzmann law. For most substances, the amount of emission varies with the
 temperature and the spectroscopic composition of the object, leading to the appearance of color temperature
and emission lines. Precise measurements at many wavelengths allow the identification of a substance via emission

   This should shed some light on the subject or character.  It also puts the info in one easy place to find instead of trying to find it in the SDK.  I ramble on and wander about myself at times.   Hope Duskrider gets it up and running.



  • Administrator
  • **********************
  • Colossus
  • *
  • 6832
  • Mostly Harmless
Re: Haptek Lights and Materials
« Reply #1 on: February 28, 2009, 08:11:41 pm »
Thanks Carl, I split this into another post as it is not directly related to Hap Explorer.  People should find it interesting, well done.



  • Trusty Member
  • ********
  • Replicant
  • *
  • 560
Re: Haptek Lights and Materials
« Reply #2 on: March 01, 2009, 07:33:38 pm »
  I was just going to post that again,  I'd thought I'd done that.  I was looking for the original when I saw the recient posts.  Just coppied it to notepad so I have a copy I can find.  Hope it's helpful.



  • Administrator
  • **********************
  • Colossus
  • *
  • 6832
  • Mostly Harmless
Re: Haptek Lights and Materials
« Reply #3 on: March 01, 2009, 07:42:15 pm »
Sorry Carl, I forgot to mention it in the original thread, glad you found it and yes it looks useful reference..