Archived

This topic is now archived and is closed to further replies.

jeppa

Per Pixel Lighting question

Recommended Posts

jeppa    122
i''m reading some paper about per-pixel lighting,and my question is it:is possible to make per-pixel lighting with 2 texture(one 2D Texture and other 1D Texture) whitout using the register combiners(nvidia cards)???? Thanks in advance

Share this post


Link to post
Share on other sites
Yann L    1802
With two 2D textures, but without regcoms: yes. First texture is the normal map, second your standard decal texture. The dotproduct can be computed using the ARB_texture_env_dot3 extension.

But this is somewhat limited: you can only have a diffuse component (no specular), it only applies to bumpmapping (eg. not BRDF) and it''s cheesy looking (no renormalization).

You can do nice diffuse bumpmapping with renormalize using 2 passes and one cubemap. If you want to go further, then you need 3 texture units and/or regcoms.

Another per-pixel lighting method is BRDF (bidirectional reflectance distribution function). This can be implemented using 2 cubemaps. Although regcoms are needed, but perhaps you could get the effect using some extended texenv function.

/ Yann

Share this post


Link to post
Share on other sites
zedzeek    529
>>But this is somewhat limited: you can only have a diffuse component (no specular)<<

5this aint really a limitation, notice in the realworld there aint really that many items that have noticable specular + even those objects that have it need to be under the right conditions eg sunlight.

http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites
Yann L    1802
quote:

5this aint really a limitation, notice in the realworld there aint really that many items that have noticable specular + even those objects that have it need to be under the right conditions eg sunlight.



That''s true, but under some circumstances (eg. daytime lighting), even relatively diffuse surfaces can rather quickly get a highlight (with a lower glossiness, though). Subtile effects like these can considerably increase realism. And if you have a combiner left, just put this specular term in, even an approximated one can be very nice.

/ Yann

Share this post


Link to post
Share on other sites
davepermen    1047
quote:
Original post by zedzeek
>>But this is somewhat limited: you can only have a diffuse component (no specular)<<

5this aint really a limitation, notice in the realworld there aint really that many items that have noticable specular + even those objects that have it need to be under the right conditions eg sunlight.

http://uk.geocities.com/sloppyturds/gotterdammerung.html


there is _NO_ diffuse only surface on this whole world (show me one)

and i see speculars everywhere.. only not with high exponent, yes (but thats even bether for registercombiners)

but never forget, lighting does not work the way nvidia teaches it to us for todays hardware... thats why a) there is no diffuseonly b) the whole does not look that realistic anyways..

but we need another 10 years to get global illumination finally solved (if you want to win some prices, go for metropolis raytracing.. only 2 implementations yet, and its the most advanced way of doing the lighting, basically let the thing solve itself directly.. sort of)

"take a look around" - limp bizkit
www.google.com

Share this post


Link to post
Share on other sites
zedzeek    529
>>there is _NO_ diffuse only surface on this whole world (show me one)<<

looking around at the moment i see perhaps 10,000 objects with perhaps 5 that have an obvious specular reflection, not a high percentage ( no doubt others have it as well but i go by the cg rule if u cant see it u can ignore it )
its the same with shading + shadows, look at the world look at photos etc ppl resemble more closely quake1 shading than quake3''s shading. ie just a decal texture. quake3 looks better but it doesnt look more realistic.

http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites
davepermen    1047
well.. i can see them on every surface..
you must be blind..

think about it.. diffuse measn INDEPENDEND on viewdirection. when ever i look at something from a different angle, it looks different..

but well.. don''t forget lighting is only a particlesystem, and does not calc cosine or powers of dotproducts at all... its all just a fake..

well.. as the question was about the perpixelattentuation-demo, i just put some infos out..

one time the attentuation works like this:

2d map = x^2 + y^2
1d map = z^2

what you need to do in the texenv is calculating 1-x^2-y^2-z^2

to do so you have to unsigned invert the first texture, then subtracting the other one..
depending on texenv-extensions you can do this, but it would be more nice to only use one add for example..

2dmap = 1-x^2-y^2
1dmap = z^2
if you use this you could simply subtract z^2..

it just depends on the combiners you have (texenv combiners..)


the other one is the exp(-x^2-y^2-z^2)..

this can be expanded to exp(-x^2-y^2)*exp(-z^2)

2dmap: exp(-x^2-y^2)
1dmap: exp(-z^2)

do a multiplication

done

"take a look around" - limp bizkit
www.google.com

Share this post


Link to post
Share on other sites