1
votes

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;
}
1
The code fragment you showed is useless. It's much more interesting to see the shaders themself. The result coming out all black indicates that the shaders are not run in the first place or that some uniforms are not properly set. We need to see the shader code, and ideally also the Irrlicht binding code to the shaders.datenwolf
But the generated FRAG file are about 5200 lines of code :/user5752447
Well, go ahead and post it. We need to see it. Don't use pastebin, just drop it into SO. To save yourself some formatting open it in some editor and apply one indentation (4 spaces or one tab) beforehand, so that it shows up properly. BTW: 5.2k LoC is quite a lot for a fragment shader.datenwolf
Thanks for your help, here is link to Generated Blender VERT File mat_Material.vert and here is link to Generated Blender FRAG file mat_Material.frag, and the original Irrlicht VERT file opengl.vert, and finally the original Irrlicht FRAG file opengl.frag (need to click on those links to see the contents)user5752447

1 Answers

3
votes

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.