I have a .mesh that uses both an alpha map and a normal map. I've written material scripts that do them separately, but not together. What I have below does not work...
My alpha map is included in my diffuse texture as the alpha layer ("alphaDiffuse.tga"). My normal map is called "normal.tga".
Code: Select all
material ___Default
{
// This is the preferred technique which uses both vertex and
// fragment programs, supports coloured lights
technique
{
// Base ambient pass
pass
{
// base colours, not needed for rendering, but as information
// to lighting pass categorisation routine
ambient 1 1 1
diffuse 0 0 0
specular 0 0 0 0
// Really basic vertex program
// NB we don't use fixed function here because GL does not like
// mixing fixed function and vertex programs, depth fighting can
// be an issue
vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
{
param_named_auto worldViewProj worldviewproj_matrix
param_named_auto ambient ambient_light_colour
}
}
// Now do the lighting pass
// NB we don't do decal texture here because this is repeated per light
pass
{
// base colours, not needed for rendering, but as information
// to lighting pass categorisation routine
ambient 0 0 0
// do this for each light
iteration once_per_light
scene_blend add
// Vertex program reference
vertex_program_ref Examples/BumpMapVP
{
param_named_auto lightPosition light_position_object_space 0
param_named_auto worldViewProj worldviewproj_matrix
}
// Fragment program
fragment_program_ref Examples/BumpMapFP
{
param_named_auto lightDiffuse light_diffuse_colour 0
}
// Base bump map
texture_unit
{
texture normal.tga
colour_op replace
}
// Normalisation cube map
texture_unit
{
cubic_texture nm.png combinedUVW
tex_coord_set 1
tex_address_mode clamp
}
}
// Decal pass
pass
{
// base colours, not needed for rendering, but as information
// to lighting pass categorisation routine
lighting off
// Really basic vertex program
// NB we don't use fixed function here because GL does not like
// mixing fixed function and vertex programs, depth fighting can
// be an issue
vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
{
param_named_auto worldViewProj worldviewproj_matrix
param_named ambient float4 1 1 1 1
}
// The alpha_rejection value is the alpha tolerance
cull_hardware none
scene_blend dest_colour zero
shading phong
alpha_rejection greater 200
texture_unit
{
texture alphaDiffuse.tga
tex_coord_set 0
colour_op modulate
scale 1 1
scroll 0 0
rotate 0
}
}
}
}
What do I need to do to get my normal+alpha map working?
Thanks!!