This is code sample in document
"3D graphic with xna 4.0". And When I built sample code about "Shawdow effect" in this book has failed'. I have edit it but it were not good. Like this:
-Picture effect shadow:
effect shadow[
^]
-Picture my code:
my picture[
^]
-3D graphic with xna 4.0 code:
code sample shadow[
^]
-My code:
my code[
^]
Hope you help me!!
#-------------(edit - elybob)-----------
#
# opened up the two folders in Compare++ (folder diff mode)
# Below is the information which is relivant from the code (diff-wise)
# wording is in terms of original posters perspective
#-----------------------------------------------
and it says that the content folders are the same.
there are 2 files which are not the same.
Game1.cs (mine):
new PPPointLight(new Vector3(0, 1000, -1000), Color.White * .85f, 2000000),
new PPPointLight(new Vector3(0, 1000, 1000), Color.White * .85f, 2000000),
theirs:
new PPPointLight(new Vector3(0, 1000, -1000), Color.White * .85f, 20000),
new PPPointLight(new Vector3(0, 1000, 1000), Color.White * .85f, 20000),
note that I'm setting the 20000
00 vs 20000
and I've added in my Draw(mine):
GraphicsDevice.SamplerStates[0] = SamplerState.AnisotropicClamp;
in PrelightingRenderer.cs:
(mine):
void drawDepthNormalMap()
{
graphicsDevice.SetRenderTargets(normalTarg);
graphicsDevice.Clear(Color.White);
foreach (CModel model in Models)
{
model.CacheEffects();
model.SetModelEffect(depthNormalEffect, false);
model.Draw(Camera.View, Camera.Projection,
((FreeCamera)Camera).Position);
model.RestoreEffects();
}
graphicsDevice.SetRenderTargets(depthTarg);
graphicsDevice.Clear(Color.White);
foreach (CModel model in Models)
{
model.CacheEffects();
model.SetModelEffect(depthNormalEffect, false);
model.Draw(Camera.View, Camera.Projection,
((FreeCamera)Camera).Position);
model.RestoreEffects();
}
graphicsDevice.SetRenderTargets(null);
}
theirs:
void drawDepthNormalMap()
{
graphicsDevice.SetRenderTargets(normalTarg, depthTarg);
graphicsDevice.Clear(Color.White);
foreach (CModel model in Models)
{
model.CacheEffects();
model.SetModelEffect(depthNormalEffect, false);
model.Draw(Camera.View, Camera.Projection,
((FreeCamera)Camera).Position);
model.RestoreEffects();
}
graphicsDevice.SetRenderTargets(null);
}
also (mine):
graphicsDevice.SamplerStates[0] = SamplerState.AnisotropicClamp;
graphicsDevice.SamplerStates[1] = SamplerState.AnisotropicClamp;
graphicsDevice.SamplerStates[2] = SamplerState.AnisotropicClamp;
lightMesh.Meshes[0].Draw();
theirs:
lightMesh.Meshes[0].Draw();