Light position problem

Started by
19 comments, last by kauna 11 years, 7 months ago

Just one question more : why do you set StencilEnable to Enable for the second pass?

Best regards!

I didn't, like i said its copy from one working project. Maybe i need to Transform vector ?
Advertisement
So wait, is the technique descriptions in the first post the same as you are using now? The text you wrote in the first message clearly states that you have enabled stencil testing for the second pass.


technique RenderDarkAtmospher
{
pass P0
{
VertexShader = compile vs_2_0 VertSceneAmbient();
PixelShader = compile ps_2_0 PixSceneAmbient();
StencilEnable = false;
ZFunc = LessEqual;
}
pass P1
{
VertexShader = compile vs_2_0 VertScene();
PixelShader = compile ps_2_0 PixScene();
ZEnable = true;
ZFunc = LessEqual;
StencilEnable = true;
AlphaBlendEnable = true;
BlendOp = Add;
SrcBlend = One;
DestBlend = One;
StencilRef = 1;
StencilFunc = Greater;
StencilPass = Keep;
}
}
[/quote]

[Edit] I guess that the stencil doesn't affect your output. But I'd look into the code a bit closer for not to just copy things blindly.
yes its same i tried delete it and false,true it but still same result. what it should be ? but i think problem is light vector

I would take it into pix and see what the value of g_vLightView


its float3


Are you familiar with the PIX debugging tool? That's what Seabolt is referring to. It comes bundled with the DirectX SDK. Look at a frame in the PIX debugger and see what the actual value (not type) of g_vLightView is being set to.

Hazard Pay :: FPS/RTS in SharpDX (gathering dust, retained for... historical purposes)
DeviantArt :: Because right-brain needs love too (also pretty neglected these days)

You can also set your light vector value manually to something like 0,0,1 to see quickly if it has some effect.

Cheers!
Ok now i open PIX and trying to use. but i think problem isnt light color or something. i think problem is that lightView here;

at HLSL lightView is float3 and he is using ->SetVector. SecVector is for float4, and vLight is vector4. its so weird :S
and he is transform vLight with matrix. maybe i should do ? but my matrixes "matrix16" not "matrix" so i dont know how to do.

Sorry for my english, i'm trying for best.

-Thanks
GPU's handle vectors in size of 4 so for that reason you won't find a function to set a 3-component vector. Don't worry about it, the 4 component vector contains the 3-component vectors information and the 4-value is just left 0. Anyway, you'll need to give a 4-component vector to the function, otherwise you may end up having some undefined behaviour.

If you have 2 matrices of the same size but different type, there is no reason that you may copy all the elements from one to another.

Otherwise _D3DXMATRIXA16 is derived from D3DXMATRIX, so any function accepting D3DXMATRIX will accept also _D3DXMATRIXA16.

Cheers!
hmm i understand i did same as they did but everything is same, nothings working. im really tried about that HLSL light. if someone can fix this i uploaded my project and worked project

EmptyProject.rar is my project, and ShadowVolume is from directxsampler i copy everything about HSLS light. if someone worked light on EmptyProject, i will so much grateful

-Thanks for everthing.
can anyone help ?
Are you sure that you want to go on with this? I don't want to be discouraging, but it seems that most of the things you have shown are way over your skills. Fixing one problem will just lead to another problem.

Have you considered using something a bit more easier for starting your graphics / game programming career? There are plenty of engine frameworks available which will give you the chance to focus on something productive instead of fighting with a single problem for days.

Beat regards!

This topic is closed to new replies.

Advertisement