A couple Problems

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
User avatar
Longstreet
Halfling
Posts: 94
Joined: Tue Jan 20, 2004 10:41 am

A couple Problems

Post by Longstreet »

First, I'm trying to do normal mapping in blender. I have exported the mesh and material with normal mapping using the tool. However, when I plop the model into the demo I get crazy stuff. I'm sure this is just my ignorance on shaders, but I don't know where to search out the problem.

http://andromedaspace.com/assets/files/screenshot_1.png
http://andromedaspace.com/assets/files/screenshot_2.png

Second, I think the mesh is exported backwards (mirrored). Here is that mesh attatched to the larger object (it's the two pods near the front). Notice it slants to the right, while it slants to the left when exported in ogre.

http://andromedaspace.com/assets/files/AG-BS-1v002.jpg

Here is the material script exported from Blender:

Code: Select all

material UpperPodT
{
    technique 
    { 
        pass 
        { 
            ambient 1 1 1 
            diffuse 0 0 0  
            specular 0 0 0 0 
            vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture 
            { 
                param_named_auto worldViewProj worldviewproj_matrix 
                param_named_auto ambient ambient_light_colour 
            } 
        } 
        pass 
        { 
            ambient 0 0 0  
            iteration once_per_light 
            scene_blend add 
            vertex_program_ref Examples/BumpMapVPSpecular 
            { 
                param_named_auto lightPosition light_position_object_space 0 
                param_named_auto eyePosition camera_position_object_space 
                param_named_auto worldViewProj worldviewproj_matrix 
            } 
            fragment_program_ref Examples/BumpMapFPSpecular 
            { 
                param_named_auto lightDiffuse light_diffuse_colour 0  
                param_named_auto lightSpecular light_specular_colour 0 
            } 
            texture_unit 
            { 
                texture UpperPodTNormal.png 
                colour_op replace 
            } 
            texture_unit 
            { 
                cubic_texture nm.png combinedUVW 
                tex_coord_set 1 
                tex_address_mode clamp 
            } 
            texture_unit 
            { 
                cubic_texture nm.png combinedUVW 
                tex_coord_set 2 
                tex_address_mode clamp 
            } 
        } 
        pass 
        { 
            lighting off 
            vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture 
            { 
                param_named_auto worldViewProj worldviewproj_matrix 
                param_named ambient float4 1 1 1 1 
            } 
            scene_blend dest_colour zero 
            texture_unit 
            { 
                texture UpperPodTDiffuse.png 
            } 
        } 
    } 
    technique 
    { 
        pass 
        { 
            ambient 1 1 1 
            diffuse 0 0 0  
            specular 0 0 0 0 
            vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture 
            { 
                param_named_auto worldViewProj worldviewproj_matrix 
                param_named_auto ambient ambient_light_colour 
            } 
        } 
        pass 
        { 
            ambient 0 0 0  
            iteration once_per_light 
            scene_blend add 
            vertex_program_ref Examples/BumpMapVP 
            { 
                param_named_auto lightPosition light_position_object_space 0 
                param_named_auto eyePosition camera_position_object_space 
                param_named_auto worldViewProj worldviewproj_matrix 
            } 
            texture_unit 
            { 
                texture UpperPodTNormal.png 
                colour_op replace 
            } 
            texture_unit 
            { 
                cubic_texture nm.png combinedUVW 
                tex_coord_set 1 
                tex_address_mode clamp 
                colour_op_ex dotproduct src_texture src_current 
                colour_op_multipass_fallback dest_colour zero 
            } 
        } 
        pass 
        { 
            lighting off 
            vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture 
            { 
                param_named_auto worldViewProj worldviewproj_matrix 
                param_named ambient float4 1 1 1 1 
            } 
            scene_blend dest_colour zero 
            texture_unit 
            { 
                texture UpperPodTDiffuse.png 
            } 
        } 
    } 
}
Thanks,
Have your machines contact my machines.
reimpell
OGRE Contributor
OGRE Contributor
Posts: 570
Joined: Mon Mar 01, 2004 10:35 am
Location: Hamburg, Germany

Post by reimpell »

If you have a mesh with a normal map applied, be sure to use the -t OgreXMLConverter option to create the tangent map for the mesh. Otherwise the normap map can't work. Also note that, afaik, Blender still has no normal map support for other geometries than a plane. Therefore a correct normal map will look wrong inside Blender. See the corresponding release log of Blender 2.36.

For the mirror problem, be sure that you don't have any negative scale on the object (n key). Either apply the object transformation to the mesh (Object -> Clear/Apply -> Apply Size/Rotation) or clear it (alt + s, enter, alt + r, enter). Also check your normals afterwards (enable "draw normals" in editing mode or press the p key to see the mesh in the internal game engine).
User avatar
Longstreet
Halfling
Posts: 94
Joined: Tue Jan 20, 2004 10:41 am

Post by Longstreet »

Thanks. That apears to have solved the mirror thing. But it still looks like something is messed up with the normal mapping. When I zoom in on the model I can see the colors of the map blended with the diffuse colors. I don't know how this works.

http://andromedaspace.com/assets/files/screenshot_3.png
Have your machines contact my machines.
Post Reply