I want to apply effect to scene (or some meshes individually)
I’m doing it in DX10 XNA2
First of all the blinn.fx from fx composer, I load it
Effect blinn;
Texture2D diffuseMap;
blinn = Content.Load<Effect>("blinn");
diffuseMap = Content.Load<Texture2D>("diffuseMap");
and then in draw:
private void DrawModel(Model m)
{
Matrix[] transforms = new Matrix[m.Bones.Count];
float aspectRatio = graphics.GraphicsDevice.Viewport.Width / graphics.GraphicsDevice.Viewport.Height;
m.CopyAbsoluteBoneTransformsTo(transforms);
Matrix projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f),
aspectRatio, 1.0f, 10000.0f);
Matrix view = Matrix.CreateLookAt(new Vector3(0.0f, 50.0f, Zoom), Vector3.Zero, Vector3.Up);
foreach (ModelMesh mesh in m.Meshes)
{
blinn.CurrentTechnique = blinn.Techniques[0];
foreach (ModelMeshPart part in mesh.MeshParts)
blinn.Begin();
foreach (EffectPass pass in this.blinn.CurrentTechnique.Passes)
{
pass.Begin();
blinn.Parameters["ColorTexture"].SetValue(diffuseMap);
part.Effect = blinn;
pass.End();
}
}
blinn.End();
mesh.Draw();
}
}
so I first set the technique, then for each mesh part I start the effect then for each pass I set the parameters then end the pass then set the effect for the mesh part, but nothing is on the monitor :(
But with basiceffect it works, so mesh position and camera position are suitable.