Jump to content
  • Advertisement
Sign in to follow this  
devronious

Stumped...

This topic is 4782 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Just wanted to say how great this Whidbey beta 2 vide is. Super job to MS! I'm still stumped and am wondering if anyone would know why my lighting is messed up. I created a directional light. The direction is 0,-1,0. Everything below the xz plane is non-lit. Everyhing about the xz plane is too much lit, fully lit. But right at the plane itself there is some blending that looks correct. Thanks in advance to anyone that can shed some light on this, Devin

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by devronious
Just wanted to say how great this Whidbey beta 2 vide is. Super job to MS!

I'm still stumped and am wondering if anyone would know why my lighting is messed up. I created a directional light. The direction is 0,-1,0. Everything below the xz plane is non-lit. Everyhing about the xz plane is too much lit, fully lit. But right at the plane itself there is some blending that looks correct.

Thanks in advance to anyone that can shed some light on this,

Devin



Posting up some code might help. There aer various other factors that could contribute to your main conflict.

Share this post


Link to post
Share on other sites
the following is my render function for the particles that are not shading correctly and also the device setup...


public void DrawParticles()
{
device.RenderState.Lighting = true;
device.SetTexture(0, texture);
if (particles != null && particles.GetLength(0) > 0)
{
foreach (Particle part in particles)
{
device.SetStreamSource(0, part.vbuffer, 0);
device.VertexFormat = CustomVertex.PositionNormalTextured.Format;
device.DrawPrimitives(PrimitiveType.TriangleList, 0, (part.vbvertices.GetLength(0) / 3));
}
}
}

public void Reset()
{

device.Reset(presentParams);
device.Lights[0].Type = LightType.Directional;
// device.Lights[0].Position = new Vector3(0, 1000.0f, 0);
device.Lights[0].Direction = new Vector3(0, -1, 0);
device.Lights[0].Enabled = true;
device.RenderState.CullMode = Cull.CounterClockwise;
device.RenderState.ZBufferEnable = true;
device.RenderState.ShadeMode = ShadeMode.Gouraud;
device.RenderState.SourceBlend = Blend.SourceAlpha; //set the source to be the source's alpha
device.RenderState.DestinationBlend = Blend.InvSourceAlpha; //set the destination to be the inverse of the source's alpha
device.RenderState.AlphaBlendEnable = true; //enable this.texture = TextureLoader.FromFile(device, "tex.bmp");

texture = TextureLoader.FromFile(device, "tex.dds");
hltexture = TextureLoader.FromFile(device, "hilight.dds");


Microsoft.DirectX.Direct3D.Material mat = new Material();
mat.Diffuse = Color.White;
mat.Ambient = this.ambient;
device.Material = mat;

viewpoint.Reset();
grid.Reset();
foreach (Particle part in particles)
part.Reset();
this.ucsicon = new UCSIcon(this);

}



[Edited by - Coder on October 10, 2005 12:28:03 AM]

Share this post


Link to post
Share on other sites
dunno, but perhaps the normals of your particles are incorrect or facing away from the light source?
Has nothing to do with your question, but I would recommend putting the particles into one vertex-buffer, if possible, and render them all with as less draw-calls as possible.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!