Material script question

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
User avatar
celic
Gnome
Posts: 363
Joined: Wed Mar 23, 2005 11:05 am
Location: Chisinau/Moldova
Contact:

Material script question

Post by celic »

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!
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

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.
User avatar
celic
Gnome
Posts: 363
Joined: Wed Mar 23, 2005 11:05 am
Location: Chisinau/Moldova
Contact:

Post by celic »

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.
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.
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.
Sorry, which shaders do you mean? I had no experience with them. Should the video card support shaders just for environment mapping? :)
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.
So, as I understood there will be a four passes script!?
User avatar
celic
Gnome
Posts: 363
Joined: Wed Mar 23, 2005 11:05 am
Location: Chisinau/Moldova
Contact:

Post by celic »

BTW, is there available a full list of material's script tokens?
I guess there is not a complete list in the material manual :?
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 8
Contact:

Post by haffax »

Manual section 3.1 should be complete. If you miss something, tell us, so that it can be added.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

celic wrote:
sinbad wrote:
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.
Sorry, which shaders do you mean? I had no experience with them. Should the video card support shaders just for environment mapping? :)
The shaders are referred to in Example_Advanced.material, read the material section of the manual for how it all hangs together.

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!?
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.
User avatar
celic
Gnome
Posts: 363
Joined: Wed Mar 23, 2005 11:05 am
Location: Chisinau/Moldova
Contact:

Post by celic »

I tried to use the material from the Shadows demo, I mean the material used by the Athene model which is normal mapped, but I've got an error in the logs, saying that the technique is not supported by the hardware.
But why? The Shadows demo is running ok on my computer.. :?
Post Reply