ewan_s
11-04-2003, 05:02 AM
My application contains a large number (100’s) of 3d models (max 1000 triangles), the models have material properties but no textures so in order to see the model detail correctly I’ll need to light them. Problem is with so many models plus the lighting the FPS drops through the floor.
The 3d models are static in my world, as are the lights there just global directional lights really. The camera position is dynamic; the user can fly around the 3D world and look at the objects from any position.
So to speed things up I thought I’d calculate the static lighting effects for each vertex of the model (work out the combined effect of ambient, emissive, diffuse lights/materials following the math in the red book) and uses these per vertex colours rather then the lighting in opengl when I render the model. This way I can put all the model drawing inside a display list and the end result should be significantly faster than using the dynamic lighting in opengl as the calculations only need to be done once and then everything is stored in the list.
However, this approach falls down when I need to consider the specular part of the light/material because this component relies on camera position, which is dynamic. I think I have two options.
1. recalculate all the vertex colours whenever the camera moves, but this will probably be slower than the original opengl lighting!
2. Find a way to mix and match i.e. use the per vertex colour I pre-calculate for the static light effects and then use the open gl lighting for the dynamic specular component.
Questions is how would I achieve the later?
Has anyone done this?
Is it even possible?
Alternatively are there any other techniques I could try ?
Thanks in advance
Ewan
The 3d models are static in my world, as are the lights there just global directional lights really. The camera position is dynamic; the user can fly around the 3D world and look at the objects from any position.
So to speed things up I thought I’d calculate the static lighting effects for each vertex of the model (work out the combined effect of ambient, emissive, diffuse lights/materials following the math in the red book) and uses these per vertex colours rather then the lighting in opengl when I render the model. This way I can put all the model drawing inside a display list and the end result should be significantly faster than using the dynamic lighting in opengl as the calculations only need to be done once and then everything is stored in the list.
However, this approach falls down when I need to consider the specular part of the light/material because this component relies on camera position, which is dynamic. I think I have two options.
1. recalculate all the vertex colours whenever the camera moves, but this will probably be slower than the original opengl lighting!
2. Find a way to mix and match i.e. use the per vertex colour I pre-calculate for the static light effects and then use the open gl lighting for the dynamic specular component.
Questions is how would I achieve the later?
Has anyone done this?
Is it even possible?
Alternatively are there any other techniques I could try ?
Thanks in advance
Ewan