PDA

View Full Version : Spheremapping and material problem !



jackmack
03-01-2005, 05:40 AM
Hi !

I have a problem with speheremapping in combination with materials.

I use spheremapping to get a good reflection of the surface like the finish of a car. It works great.

But the color of the surface is not fix. It's possible to change the color like blue-, red-, silver-finish.

This is done by a material. It works also great.
The sphere map is always the same.

I use glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
to do that.

There are also some other parts in the scene like tires, glasses, ... which are not spheremapped (in real life they do not reflect so strong like cars finish!).

Ok, I use an other material for these parts and indicate them for non-spheremapping. Great .

The really problem is the light source !!!
I must decrease values for ambient, diffuse and specular of the light. Otherwise the spheremapped parts are over-illuminated. This causes a lower-illumination
of all other not spheremapped parts. They appear too dark.

What should I do ? Enabling more light sources, one for spheremapping illumination and one for other is not good for performance.

Many Thanks

Last question: Is there an other mechanism like spheremapping to get car-finish reflections (no use of extensions and works on cheap graphics cards) ?

Relic
03-01-2005, 07:52 AM
If your sphere map contains the whole illumination and you want to use that for duller materials too, one way is to load them down as mipmaps and using the smaller maps for the duller objects by increasing the lod-bias.
Better than the view dependent sphere map is a cube map. (What is a cheap graphics card for you?)
The method with dynamically updated sphere maps is called ClearCoat360 by SGI.
More advanced methods for car finshes include BRDFs and sophisticated fragment shaders today.

jackmack
03-02-2005, 12:05 AM
Thanks for your answer.

Ok, I try it by using mipmaps. But sorry, what do you mean with lod-bias. I have never heard before.

I have no experience with Cube maps, I try it also ;) I thought spheremapping costs lowest performance.

With "cheap graphics card" I mean such cards as build in laptops like S3 Graphics Savage/X 1014 chips, 8MB.
Therefor I don't use special functions like BRDFs and sophisticated fragment shaders.

Demos of www.cult3d.com (http://www.cult3d.com) works great on this card. I thinks they couldn't use BRDFs or fragment shaders, because my card don't support that.

The example included in BRDFs download-package works great on my NVIDIA card. On ATI cards the complete scene looks like without lighting. It's very dark.

I don't want to use such dependend functions.

Maybe I understand something wrong and you can teach me more.

Thanks ...

Overmind
03-02-2005, 02:01 AM
A simple solution to your problem of the spheremaps being too bright is to decrease the brightness of the material instead of decreasing the brightness of the light.

If you look at the formulas of the lighting calculations, you'll see it doesn't make any difference if you reduce the light brightness or the material brightness, but the advantage of modifying the material is that you can use the same light source for mirrored and non-mirrored surfaces.

Relic
03-02-2005, 04:19 AM
LOD bias is an old extension, now in the core.
http://oss.sgi.com/projects/ogl-sample/registry/EXT/texture_lod_bias.txt

If your graphics board doesn't support that (S3 and 8MB for 3D? Challenging. ;) ) you can also download different texture objects of the same sphere map and use different sizes for the LOD 0.

Switch texture objects for different shininess,
like a 256*256 size for polished and the downfiltered (gluScaleImage) 16*16 size for duller materials.

jackmack
03-03-2005, 09:20 AM
Overmind: This sounds good. I think I will try this as first.

Relic: (S3 and 8MB for 3D? Challenging. ;)) ?
I know, it sounds crazy. But I am not in such position to say: "Eh, you want 3D rendering, ok, buy the newest ATI or NIVIDA card.".

My render system is not so complex like games or proffensional render tools. It's only a viewer for reduced CAD data. No animation or such things. First, a car must be look like a car not like a matchbox :rolleyes:

Thanks