sphere & normal maping with multi texturing??

Started by
17 comments, last by skow 21 years, 7 months ago
Just one texture ? But if you have a texture for the car''s color and a texture for the car''s shininess (spheremap) then you NEED two textures (even though you can use only one texture unit simultaneously if you do it in multipass, but that''s a performance hit).
Do you mean that you don''t have a texture for the car''s color, but you have a single flat color instead ?
Advertisement
ok i did a bad job explaing what i am doing...

I do have 2 textures for the car...(the normal texture and the sphere maped texture (shinnyness))

but i have the car divided up in to parts that are a bit more "reflective" IE windows. So i want them to show more of the sphere map...So i make an additional texture for the sphere map(with a greater contrast).

it would be nice to use glcolor4 and use one texture for the sphere map...but im getting by fine with a few
if I understand correctly, you have :
- one rgb texture for the car''s color,
- one rgb (or luminance) texture for the car''s shininess,
- a set of call to glColor4f in order to have an alpha component.

And you want to :
- first render your car''s color (texture),
- secondly add the shininess (texture), modulated by an alpha component (glColor4f) so that some parts of the car are not shiny, some parts are a bit shiny and some parts are very shiny.

Is that right ?
Yeah BLEND just combines the textures without being able to set the alpha (glcolor4)

and yeah you understand correctly
The method described below assumes you don''t need the RGB component of glColor4f. If you need it, it is still possible but you need to use the ARB_texture_env_combine extension (or OpenGL1.3+).

for each vertex, you have to call glColor3f(shininess, shininess, shininess) where shininess is the intenisty of the spheremap texture between 0 and 1. That is, shininess will be very close to 1 when you''ll render the glasses.

And the algorithm is :

disable lighting

activate texture unit 0 and texture unit 1 and disable all other texture units (if your card supports more than 2 texture units).

in the first texture unit :
bind the car''s shininess texture (spheremap).
set the texture environment to MODULATE

in the second texture unit :
bind the car''s color texture.
set the texture environment to ADD (available in the ARB_texture_env_add extension, or in OpengL1.3+ kernel)

That''s all. Hope that does the trick.
wow that sounds like just what i need! thanks!

ill give her a try
quote:Original post by vincoof
ShadowMaster : Why do you send texture coordinates for texture unit 2 : glMultiTexCoord2fARB(GL_TEXTURE2_ARB, mGroups[loop1].tris[loop2].u[loop3], mGroups[loop1].tris[loop2].v[loop3]) ?
Because you don''t use a 3rd texture unit (in fact, you don''t show it in your code but you could use it outside this code) this line will send useless coordinates, isn''t it ?


Sorry About that, I did have 3 Textures at one stage, but forgot to remove that line.

quote: because all todays graphics cards support OpenGL1.1 and a few cards still doesn''t support OpenGL1.3

I did not realizie this! I''m trying hard to get my games to work on as many machines as possible (including a work around for multiple textures). Are there many cards that don''t support multiple textures?

Thanks for pointing out GL_DECAL too



http://nap.mega.net.kg

Home: EvilEntities ;)
OpenGL1.3 is not available for everyone, but the GL_ARB_texture_env_combine extension can be used as well, so there''s something like 80%+ of todays graphics cards that supports that feature. That''s not real statistics, just my approximations.

Go to delphi3D.net and get to the 3D Hardware Info section. There you can see which graphics card/driver combo supports the ARB_texture_env_combine extension. Don''t forget to also check equivalent extensions such as EXT_texture_env_combine

Almost all todays graphics cards support multitexturing. Get to delphi3D.net again and look for the ARB_multitexture extension (and equivalent extensions too). I''d say (again, not real statistics) that 95%+ of todays graphics cards support multitexturing. Still, you have to do something for the other 5% - at the very least warn the user (eg through a dialog box) and exit, at best simulate multitexturing in multipass.
That''s a very usefull page, thanks!

-Shadow


http://nap.mega.net.kg

Home: EvilEntities ;)

This topic is closed to new replies.

Advertisement