PDA

View Full Version : alternative to opengl lighting?



satan
06-20-2002, 04:07 AM
Hi everybody!

Is there any good alternative to OpenGL lighting. I know that there is per-pixel-lighting but most I found about it is:
a) with bump-mapping (which I don't need at the moment)
b) with register combiners (NVIDIA only, so what about supporting other cards)
c) very, very, slow

My development plattform is a 450MHz K6-2 with a GeForce2-MX running Linux. So is there any way to get good lighting on this or do I have to go the OpenGL lighting way with proper tesselation of my models?

Any help is highly welcome!

zed
06-20-2002, 11:34 AM
why not bumpmapping.
u can use dot3 (often refered to bumpmapping)
this is very easy to use + works well on a gf2mx (far better than tessalating your model with more triangles + using opengl lighting)

satan
06-20-2002, 03:28 PM
If you say it's fast enough i will give it a try.
Any links to any good docs are welcome, too.

I have read Ron Fraziers articles about per pixel lighting and think i understand the basic s. But since it's using register combiners it would be NVIDIA only http://www.opengl.org/discussion_boards/ubb/frown.gif.
And is there any easy way to create a normal map?
I think NVIDIA provide a photoshop plugin but that will not help me on Linux.

thx for the advice

Jeeeez
06-21-2002, 05:46 AM
Hey,

Here is a method i tried with some success.

Converted a bmp to greyscale in order to get heights for each pixel.

Created triangles with a pixel and the 4 surrounding pixels. For example 1 triangle would be the pixel, the pixel directly above, and one to the side. From these three points, you can find the normal. This is where I fluffed a bit. The heights were scaled to [0,1]. I used 1 for the distance between each pixel. This enabled me to compute the cross product in order to get the normal for the triangle.
So after that, you have 4 normals for 4 triangles. Average them and you have a normal for the pixel.

Hope that helps

J

satan
06-21-2002, 08:51 AM
To Jeeeez: At least I understand it http://www.opengl.org/discussion_boards/ubb/smile.gif, thx

Some other perhaps stupid question to the dot3 stuff:

1) What shall I do with untextured Objects?
I think there is no need for a normal map, since they have flat surfaces.

2) Every Light = 1 pass, right?

3) Does anyone know about any Demos (may be on Win I just want to look at the quality and perfomance) showing more than a simple cube and running with more than 10fps?

And last but not least what I need the lighting for. I am working on a little engine to give non-opengl-coders the possibility to use 3d graphics in their apps (of course not in C/C++, cause I think they do not need just another engine and I am not good in them, too http://www.opengl.org/discussion_boards/ubb/smile.gif). So I am trying to keep it very generic. I would like to have it usable for all kind of visualization tasks.
So I am a little bit worried about the number of lights possible with dot3, types of lightsources, complexity of per vertex operations and many more
But I just don't like OpenGLs lighting, 'cause I have to tesselate my objects even for diffuse lighting.

Perhaps I should just dive into the dot3 stuff and try what I can do and then take another look, but any help on this trial and error is highly welcome.

I think I should do more coding and less thinking (or was it the other way round?).

jmathies
06-21-2002, 09:36 AM
Originally posted by satan:
Hi everybody!

Is there any good alternative to OpenGL lighting. I know that there is per-pixel-lighting but most I found about it is:

My development plattform is a 450MHz K6-2 with a GeForce2-MX running Linux. So is there any way to get good lighting on this or do I have to go the OpenGL lighting way with proper tesselation of my models?

Any help is highly welcome!

Maybe I'm missing something here.. unless your looking for extrememly accurate lighting
results the simplest way to simulate lighting
is with a double pass. There are countless
demos out there that show you haw to do it.

Regards,
Jim

satan
06-21-2002, 10:17 AM
Originally posted by jmathies:
Maybe I'm missing something here.. unless your looking for extrememly accurate lighting
results the simplest way to simulate lighting
is with a double pass. There are countless
demos out there that show you haw to do it.

Regards,
Jim



If it is just called double pass lighting then i just never heard of it.
I do not look for very accurate lighting but for a more accurate lighting than OpenGL offers. I'd like to have ambient, diffuse, specular (the ambient should not be the problem) lighting without the need to tesselate my objects and I'd like to have spot lights and point lights, both with distance attenuation of some kind. And all I found was related to per pixel lighting (it is always an option for me to implement several lighting techniques and let the user decide which to use, but this would be of course more code to write and for my own apps i'd really like to have accurate lighting, if my HW can do it - and the per pixel stuff I have seen was very impressive).