<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.xna.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Direct3D 10 </title><link>http://forums.xna.com/forums/29.aspx</link><description>Only questions about the Direct3D 10 API are permitted here.</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 0.0)</generator><item><title>Re: Wierd flashing when rendering simple diffuse lighting</title><link>http://forums.xna.com/forums/thread/186848.aspx</link><pubDate>Sat, 06 Jun 2009 23:39:05 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:186848</guid><dc:creator>Jman</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/186848.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=29&amp;PostID=186848</wfw:commentRss><description>I figured it out. I wasn&amp;#39;t following the packing rules for some of my constant buffers.&lt;br /&gt;</description></item><item><title>Re: Wierd flashing when rendering simple diffuse lighting</title><link>http://forums.xna.com/forums/thread/186445.aspx</link><pubDate>Fri, 05 Jun 2009 18:14:32 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:186445</guid><dc:creator>Jman</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/186445.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=29&amp;PostID=186445</wfw:commentRss><description>I&amp;#39;m writing the whole thing in C++, using the Direct3D10 SDK. I&amp;#39;m not using the XNA Game Studio.&lt;br /&gt;</description></item><item><title>Re: Wierd flashing when rendering simple diffuse lighting</title><link>http://forums.xna.com/forums/thread/186438.aspx</link><pubDate>Fri, 05 Jun 2009 18:02:28 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:186438</guid><dc:creator>FortisVenaliter Productions</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/186438.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=29&amp;PostID=186438</wfw:commentRss><description>Check that you properly set the VertexDeclaration on the GraphicsDevice</description></item><item><title>Wierd flashing when rendering simple diffuse lighting</title><link>http://forums.xna.com/forums/thread/186427.aspx</link><pubDate>Fri, 05 Jun 2009 17:42:57 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:186427</guid><dc:creator>Jman</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/186427.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=29&amp;PostID=186427</wfw:commentRss><description>I have been trying to get a very simple pixel shader going that just applies diffuse lighting ( N dot L ) for a single directional light source. My pixel shader code is as follows:&lt;br /&gt;
&lt;br /&gt;
cbuffer cb0 : register(b0)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp; float4 vCameraPos;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; float4 vGlobalAmbient;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
cbuffer cb1 : register(b1)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp; float4 vAmbient;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; float4 vDiffuse;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; float4 vSpecular;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; int bDiffuseMap;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; int bGlossMap;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; int bNormalMap;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; int bBumpMap;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
cbuffer cb2 : register(b2)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp; float3 vLightColor;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; float3 vLightDir;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; int nLightType;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; float SomeOtherFloat;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
struct PS_INPUT&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp; float4 vPosProj : SV_POSITION;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; float2 vTexUV&amp;nbsp;&amp;nbsp; : TEXCOORD0;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; float3 vNormWorld : TEXCOORD1;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; float3 vPosWorld&amp;nbsp; : TEXCOORD2;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
// entry point&lt;br /&gt;
float4 main( PS_INPUT vert ) : SV_Target&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp; float4 color;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; color.a = vAmbient.a;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; float3 lightVec = normalize( vLightDir );&lt;br /&gt;
&amp;nbsp;&amp;nbsp; float3 vectorToLight = normalize( vert.vPosWorld - lightVec );&lt;br /&gt;
&amp;nbsp;&amp;nbsp; float fDiffuse = saturate( dot( vert.vNormWorld, vectorToLight ) );&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; color.rgb = vLightColor * vAmbient.rgb;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; color.rgb += vDiffuse.rgb * fDiffuse * vLightColor;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; return color;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
When I run this shader in my engine, the model it is rendering flashes between ambient-only and diffuse-lit very rapidly. I have determined that the problem is in the shader code, not my engine, and it is the statement that computes the fDiffuse variable. When I omit that line, and substitute a constant value for fDiffuse, the flashing goes away, but I am left with plain old ambient lighting.&lt;br /&gt;
&lt;br /&gt;
Has anyone else seen this happening? Am I doing something wrong? plz help!&lt;br /&gt;</description></item></channel></rss>