Hello everyone!
I have a car mesh and want to make it look nice.
So, I have a generic texture (the car texture), then a greyscale texture with the shadows (some parts of the car should be darker), a normal map texture, a bump map texture and finally an environment spherical map texture.
Does anyone know how approximatively should look the script? How many passes should there exist, etc?
Thanks in advance!
Material script question
- celic
- Gnome
- Posts: 363
- Joined: Wed Mar 23, 2005 11:05 am
- Location: Chisinau/Moldova
- Contact:
- sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
- Contact:
Firstly, why don't you combine the static lighting texture with the car texture? That would save you a texture unit and make no difference to the end result.
I doubt you need both a normal map and a greyscale bump map, unless you intend to do parallax mapping, which on a car I doubt would be worthwhile. Just normal mapping should be fine, and that's covered in the examples (see Examples_Advanced.material).
As for the environment map, if you want this to be affected by the normal map, you'll need to alter the normal mapping shaders to do it. Luckily there is one free texture unit (assuming a base 4-unit target) for you to plonk the envmap in. But basically you'll have to use the calculated per-pixel normal to look up the envmap - how exactly you use it depends on whether it's a sphere map or a cubic environment map. There are several example bump-map cubic environment shader examples, such as in the Cg package from nVidia.
I doubt you need both a normal map and a greyscale bump map, unless you intend to do parallax mapping, which on a car I doubt would be worthwhile. Just normal mapping should be fine, and that's covered in the examples (see Examples_Advanced.material).
As for the environment map, if you want this to be affected by the normal map, you'll need to alter the normal mapping shaders to do it. Luckily there is one free texture unit (assuming a base 4-unit target) for you to plonk the envmap in. But basically you'll have to use the calculated per-pixel normal to look up the envmap - how exactly you use it depends on whether it's a sphere map or a cubic environment map. There are several example bump-map cubic environment shader examples, such as in the Cg package from nVidia.
- celic
- Gnome
- Posts: 363
- Joined: Wed Mar 23, 2005 11:05 am
- Location: Chisinau/Moldova
- Contact:
I think because it could serve for some effects, for example to change the intensity of the light map, and control the darkness level. Also I guess it could be blended with some color, this will make a cool light effect when using coloured lights.sinbad wrote:Firstly, why don't you combine the static lighting texture with the car texture? That would save you a texture unit and make no difference to the end result.
Sorry, which shaders do you mean? I had no experience with them. Should the video card support shaders just for environment mapping?As for the environment map, if you want this to be affected by the normal map, you'll need to alter the normal mapping shaders to do it.
So, as I understood there will be a four passes script!?Luckily there is one free texture unit (assuming a base 4-unit target) for you to plonk the envmap in. But basically you'll have to use the calculated per-pixel normal to look up the envmap - how exactly you use it depends on whether it's a sphere map or a cubic environment map.
- celic
- Gnome
- Posts: 363
- Joined: Wed Mar 23, 2005 11:05 am
- Location: Chisinau/Moldova
- Contact:
- haffax
- OGRE Retired Moderator

- Posts: 4823
- Joined: Fri Jun 18, 2004 1:40 pm
- Location: Berlin, Germany
- x 8
- Contact:
- sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
- Contact:
No - every pass has a number of texture units available (the number depends on the card, but 4 is a reasonable minimum to assume these days). You need to get away from thinking that every effect is a separate pass - offline modellers 'think' this way but realtime systems try to combine as many effects into one pass as possible for efficiency, and because more complex operations can be performed within a pass versus between passes.celic wrote:The shaders are referred to in Example_Advanced.material, read the material section of the manual for how it all hangs together.sinbad wrote:Sorry, which shaders do you mean? I had no experience with them. Should the video card support shaders just for environment mapping?As for the environment map, if you want this to be affected by the normal map, you'll need to alter the normal mapping shaders to do it.![]()
No, you don't need shaders for per-vertex env mapping. But, you want normal maps too which DO require shaders - and if you want the env map to be affected by the normal map, it has to be in the shader. Per-vertex env mapping can be done without shaders, but even so, for optimal performance, you're best to fold the relatively cheap env mapping into the existing normal mapping shader (even at the vertex level) rather than add an extra pass.
So, as I understood there will be a four passes script!?
- celic
- Gnome
- Posts: 363
- Joined: Wed Mar 23, 2005 11:05 am
- Location: Chisinau/Moldova
- Contact: