Re: Textures and Lighting

New Message Reply Date view Thread view Subject view Author view

John Rohlf (jrohlf++at++tubes)
Mon, 9 Jan 95 11:48:48 PST


>
>
> Hi,
>
> it's me again. This time I got a fairly easy question (I hope):
>
> I`ve got a global material, lighting and texture environment:
>
> /* create an infinitly far away light source */
> lt = pfNewLight(arena);
> pfLightPos(lt, 0.0f, -0.5f, -1.0f, 0.0f);
> pfLightOn(lt);
>
> /* create global light model */
> lm = pfNewLModel(arena);
> pfLModelAmbient(lm, 0.5f, 0.5f, 0.5f);
> pfApplyLModel(lm);
>
> /* create global material */
> mt = pfNewMtl(arena);
> pfMtlColor(mt, PFMTL_AMBIENT, 0.3f, 0.3f, 0.3f);
> pfMtlColor(mt, PFMTL_DIFFUSE, 0.8f, 0.8f, 0.8f);
> pfMtlColorMode(mt, PFMTL_FRONT, PFMTL_CMODE_AD);
> pfApplyMtl(mt);
>
> /* create global texture environment */
> te = pfNewTEnv(arena);
> pfTEnvMode(te, PFTE_DECAL); // opaque texture (3 components)
> pfTEnvComponent(te, PFTE_COMP_OFF); // no component selection
> pfApplyTEnv(te); // set global texture environment
>
> Finally when setting
>
> pfEnable(PFEN_LIGHTING);
> pfDisable(PFEN_TEXTURE);
> pfOverride(PFSTATE_ENTEXTURE, PF_ON);
>
> I get shaded geometries. The geometries themselves got local geostates defining
> nothing but the texture function. This way, when overriding texturing off, my
> geometries are shaded. But when I globally enable texturing through
>
> pfEnable(PFEN_TEXTURE);
> pfOverride(PFSTATE_ENTEXTURE, PF_OFF);
>
> I only get texture but no lighting. Why? Can this behaviour be changed? If yes,
> how?

        The PFTE_DECAL texture environment replaces the polygon color
        with the texture color, thereby clobbering your illumination.
        Use the PFTE_MODULATE texture environment to retain
        lighting effects.


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:51 PDT

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