Re: Using PFSTATE_LIGHTS and pfLightSource

New Message Reply Date view Thread view Subject view Author view

Marcin Romaszewicz (marcin++at++asmodean.engr.sgi.com)
Wed, 13 Jan 1999 11:35:45 -0800 (PST)


>
> Hello pfAll,
>
> I want to use certain lights for certain geometry.
> In the man page of pfGeoState I read that I can set an array of lights
> to use for the geometry that uses this pfGeoState
> (attribute PFSTATE_LIGHTS).
>
> If I use pfLightSource lights I get the following error every frame
>
> ERROR #91 lmbind - index 195 for target 1100 not found: ERR_USERERROR

This array of lights is only for pfLight*'s, anything that's passed to
setAtttr with PFSTATE_LIGHTS will be cast to a pfLight*, so I'm not surprised
that you had problems.

> The notes in the pfLightSource man page tell something about using
> this option but it also mentions pfLights
>
> If you want light sources to affect only portions of the scene, then set
> one or more pfLights on the pfGeoStates which are attached to the
> pfGeoSets that you wish to illuminate (see pfGeoState::setAttr and
> PFSTATE_LIGHTS for further details).
>
> When I use pfLight lights the objects in the scene are dark.
>
> If I don't set the light array at the geostate then the scene is
> lighted as expected, in both cases (pfLightSource and pfLight).

Are you certain that the lights are set up correctly? The pfLightModel
manpage lists the following 5 requirements for illumination to be applied
to geometry:

 1. Lighting must be enabled: pfEnable(PFEN_LIGHTING)

 2. A pfLightModel must be applied: pfLightModel::apply

 3. A pfMaterial must be applied: pfMaterial::apply

 4. One or more pfLights must be on: pfLight::on

 5. Illuminated geometry must have normals: pfGeoSet::setAttr,
      PFGS_NORMAL3

So, once you setAttr with the PFSTATE_LIGHTS token, make sure you also
setAttr with the PFSTATE_LIGHTMODEL, PFSTATE_*MTL tokens.


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Wed Jan 13 1999 - 11:35:57 PST

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.