Re: pfLightSource and texture projection

New Message Reply Date view Thread view Subject view Author view

Brian Furtaw (brian++at++sgi.com)
Thu, 11 Nov 1999 12:10:11 -0500


For the projection frustum bring in your far clipping plane and cut down
the FOV might be too much for the spotlight texture. In the examples on
the pfLightSource man page they are using far clip of 100.0f and FOV 60
degrees. You might be to far away from the iluminated object for the
resolution of your light map. Make sure you have positioned the light
somewhere close to the object you are iluminating at first to get
everything working, and make sure you the observer are somewhere you can
see it.

Notice they us fog in the manpage to attenuate the light source once you
get the light working you could try playing with that.

One question though what graphics hardware are you rendering this on?

Brian

rvandepo++at++csc.com wrote:
>
> I am currently implementing a pfLightSource with texture projection enabled. I
> am following the example given in the man page but can't get the thing to work;
> the entire scene gets darker and the projected texture is vaguely visible for a
> split second at start up. Perhaps somebody has some idea what is going on; a
> code example will be appreciated too!
>
> Any feedback would be welcome!
>
> Thanks,
>
> Rene
>
> -----
>
> The code I have been using is given below
>
> tex = new pfTexture;
> tex->loadFile("spotlight.inta");
>
> frust = new pfFrustum;
> frust->makeSimple(60.0f);
> frust->setNearFar(1.0f, 1000.0f);
>
> lamp = new pfLightSource;

You realize the line below has a syntax error it should be....
lamp->setAttr(PFLS_PROJ_TEX, tex);

> lamp->setAttr(PFLS_PROJ_TEX. tex);
> lamp->setAttr(PFLS_PROJ_FRUST, frust);
> lamp->setMode(PFLS_PROJTEX_ENABLE, 1);
> lamp->setPos(0.0f, 0.0f, 1.0f, 1.0f); // w = 1.0f for local light
> lamp->setDir(0.0f, 1.0f, -1.0f); // I tried a few combinations
>
> dcs = new pfDCS;
> dcs->addChild(lamp);
> scene->addChild(dcs);
>
> dcs->setCoord(coord); // coord is a pfCoord with the eye point coordinates
>
> lm = new pfLightModel;
> lm->setLocal(PF_ON);
> lm->apply();
> //pfOverride(PFSTATE_LIGHTMODEL, PF_ON);
>
> pfEnable(PFEN_LIGHTING);
> //pfOverride(PFSTATE_ENLIGHTING, PF_ON);
>
> // Modelview matrix corresponds to a view in the y direction
> // pfMaterial has been applied
> // Geometry has got normals
>
> lamp->on();
>
> Draw scene
>
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com

-- 
    ----oOOo----    ----oOOo----    ----oOOo----    ----oOOo----

Brian Furtaw (brian++at++sgi.com) Graphics Guru Office:(301)572-3293 Fax: (301)572-3280 12200-G Plum Orchard Drive OpenGL/Performer/OpenInventor/ImageVision Silver Spring, Maryland 20904 Optimizer/React/PCI Device Drivers


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Thu Nov 11 1999 - 09:16:24 PST

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