PerPixel Lighting

How to make perpixel lighting using COMBINE texture env, not NVIDIA register combiners?
Is there any good tutor?
Thanks.

You can’t. At least not with extensions supported on contemporary consumer hardware.

You’ll need fragment shaders for that. <- called pixel shaders in Direct3D lingo

Originally posted by WM:
[b]How to make perpixel lighting using COMBINE texture env, not NVIDIA register combiners?
Is there any good tutor?
Thanks.

[/b]

Using the DOT3 extenstion, you can do per-pixel lighting.

[This message has been edited by Gorg (edited 03-02-2002).]

as gorg saiz plain old dot3 (part of opengl1.3) is good enuf
theres no need for register combiners (though perhaps register combiners will give u a nicer finished product they are not necessary at all)

for simple diffuse and ambient perpixel lighting you can use the dot3-ext, yes… if you want more, you need register-combiners, possibly even texture-shaders, or simply the fragment-shaders from ati (wich are the best anyways )

here, for some register-combiners-features: http://tyrannen.starcraft3d.net/PerPixelLighting

btw, if you want perpixellighting WITHOUT bumpmapping, you can even get it to work without the dot3-ext… just use tangent-space lighting and you get the dot3 of the point_to_light vector and the surface normal (0,0,1) very simple: use simply the z-component of the light…

daveperman,

You can’t do tangent space lighting without extensions, though, can you? I mean, apart from calculating it yourself…

I’ve done some per-pixel Blinn-style specular lighting without using extensions ( bump mapping is of cause not possible ). I have some screenshots on my site ( also, I explained how it worked somewhere on the board ).

Here it is,
http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/004436.html

Originally posted by PH:
I’ve done some per-pixel Blinn-style specular lighting without using extensions ( bump mapping is of cause not possible ). I have some screenshots on my site ( also, I explained how it worked somewhere on the board ).

Cass has shown that you can do per-pixel lighting with an unextended opengl 2 years ago.
http://www.opengl.org/developers/code/features/oimfinal/perpixel.html

[This message has been edited by Gorg (edited 03-03-2002).]

I guess you’re refering to OIM ? Yes, I’ve read that but that requires 12 passes ( last time I looked ). I simply use a 2D lookup table with spherical coordinates.

jwatte:
first: its permen, not perman (how often did i now had to write that? i dunno…)

ok… yes you’re right, you can’t do it in hardware without using extensions for vertex programs/vertex shaders…

but doing it in software is no big thing… for every vertex {
calculate point_to_light
transform trough tangentspace-matrix of the vertex
set as texcoord for normalization-cubemap OR normalize and set to glColor (wrong but for small triangles working… used this in my demo http://tyrannen.starcraft3d.net/PerPixelLighting )
}

i did not used any hardware-extensions except register-combiners (and for opengl1.1, cubemaps…,oh and VAR of course to speed up, but thats secondary… )

you can do it without tangentspace (without bumpmapping) if you have the dot3-ext… then you can simply give per vertex the point_to_light and the normal into yetanother normalization-cubemap and dot3 in the texenv.
all you have to do for this is one: binding the normal-array as texcoods for the normalmap, and setting up a nice texmatrix and bind the vertex-pos in the other for the point_to_light map…

it was my first perpixellighting-demo at all… no vertexprograms even planned then