openglglslshaderirrlicht

Why Blender exported shader (*.frag, *.vert) are turning into black color in Irrlicht


I ran into "official tuto 10 Shader" in Irrlicht 1.8.3, and i modified this official example to use the shader that I exported from Blender using the addon: http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Game_Engine/Export_GLSL

The exported material is just composed of simple diffuse and specular color that is not black at all, but in Irrlicht it looks Black

Here is part of the shader tuto in Irrlicht SDK (i just modified the names of the shader loaded) assuming no CG used, and advanced Shader used.

case video::EDT_OPENGL:
    if (UseHighLevelShaders)
    {
        if (!UseCgShaders)
        {
            /**I MODIFIED NAMES OF THE ORIGINAL FRAG VERT FILES BELOW*/
            psFileName = "../../media/mat_Material.frag";//opengl.frag";
            vsFileName = "../../media/mat_Material.vert";//opengl.vert";
        }
        else
        {
            // Use HLSL syntax for Cg
            psFileName = "../../media/d3d9.hlsl";
            vsFileName = psFileName; // both shaders are in the same file
        }
    }
    else
    {
        psFileName = "../../media/opengl.psh";
        vsFileName = "../../media/opengl.vsh";
    }
    break;
}

Solution

  • Looking at the shader files you posted the problem is obvious: The uniforms used by the Blender Game Engine and the uniforms used by Irrlicht are very different (different name, different semantics). You can't simply drop an arbitrary shader file into an existing engine and expect it to "just" work. You have to adjust it so that it matches the host rendering code that loads it.