IBL & Skybox rendering problem

Hi everyone.

I’ve been trying to get IBL implemented in to me little engine for a few weeks now. So far I’ve had no luck with even rendering a skybox and I have tried, copying other peoples shader, models and textures with not luck what so ever. My own code and models don’t work either, hens the borrowing thinking it my be a problem with my texturing or my model. At this point I don’t think it can be as none of the models and textures from rbwhitaker tutorials nor any from Kosmonaut3d’s work in my program nor anything I made myself.

This is the most I have ever got from it, and only if a set culling to CullMode.None, or CullCounterClockwise, otherwise its a completely bank black screen, and I know its not from the clear call as i’ve tested it by clearing the buffer to pink, its always black on display.

Basically my draw call, very basic nothing fancy.

public void Draw(Matrix World, Matrix View, Matrix Projection, Vector3 CameraPosition)
{
            graphics.RasterizerState = RasterizerState.CullClockwise;
            shaderEffect.CurrentTechnique = shaderEffect.Techniques["DrawSkybox"];

            graphics.Clear(new Color(1, 0, 1, 1));

            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (ModelMeshPart part in mesh.MeshParts)
                {
                    shaderEffect.Parameters["World"].SetValue(World);
                    shaderEffect.Parameters["View"].SetValue(View);
                    shaderEffect.Parameters["Projection"].SetValue(Projection);

                    shaderEffect.Parameters["CameraPosition"].SetValue(CameraPosition);

                    shaderEffect.Parameters["SkyBoxTexture"].SetValue(skyboxCube);

                    shaderEffect.CurrentTechnique.Passes[0].Apply();

                }
                mesh.Draw();
            }

            graphics.RasterizerState = RasterizerState.CullCounterClockwise;
}

The current shader is a updated version of the one found here: http://rbwhitaker.wikidot.com/skyboxes-3

Oh, and I did change the PreMultiplyAlpha to false as rbwhitaker suggested in his tutorial.

that loop doesn’t make sense, as you are not doing anything to the MeshParts you are looping over. I guess what you really want to do inside this loop is assign your shader to the MeshParts.

 part.Effect = shaderEffect;

also there is no point in setting up your shaderEffect inside this loop, you are just repeating the exact same steps over and over again. You can do that before the loops.

OMG, thank you so much, you have no idea how long I have struggled with this, if I wasn’t overjoyed I would feel great shame for missing that simple missing line of code. Was so sure the Draw method was fine that I never truly looked over it in fine detail nor did I rewrite it manually which would of relieved the mistake. The foreach draw calls were just artifacts of my hours of changing and chopping. you were right about never applying the effect to the mesh (part.Effect = shaderEffect;).

Thank you.