Applying Phong Lighting, bad trouble !

Started by
14 comments, last by NightCreature83 12 years ago
[attachment=7988:??.jpg]

[font=verdana,geneva,sans-serif]Hi~

Right is normal.
Left is Error !!!

I use..
same X File....
same FX File...
app code is almost same...

Why happen this problem ?[/font]

Advertisement

app code is almost same...

That's the reason tongue.png
On the left you are rendering with flat shading, on the right with smooth shading turned on.

On the left you are rendering with flat shading, on the right with smooth shading turned on.


First of All, Thanks you very much...

But I can't understand very well...

How change flat shading to smooth shading ?

Flag change ? D3DRS_SHADEMODE ?

I use shader. not FF.

please more...
How change flat shading to smooth shading ?
D3DRS_SHADEMODE has effect also when using shaders, it isn't related only to the fixed-function pipeline like some other render states.
When you set D3DSHADE_FLAT, it won't interpolate COLOR attibutes over triangles, so you'll get flat shading if you're using per-vertex lighting, even when you do it "manually" in shaders. (The situation would be different with per-pixel lighting, because texture coordinates - and thus normals - will still be interpolated normally.)
Thank you very much...smile.png
I don't set FLAT...

This problem still unsolved...

But I was helped your wording ( per-vertex lighting, per-pixel lighting )...

Would you get sample code or sample project or URL ?

I don't set FLAT...

This problem still unsolved...

But I was helped your wording ( per-vertex lighting, per-pixel lighting )...

Would you get sample code or sample project or URL ?


Could it just be that you are using triangle face normals instead of interpolated vertex normals for your lighting?

Can you give us some more information on what you are doing here? (shaders, etc.)
I wish speak very detaily....

But English sooooooooooooooooooooooooooooooooooo hard wink.png

[font=verdana,geneva,sans-serif]This is part of shader code.

vs

output.normalW = mul( float4( input.normalL, 0.0f ), mWorldInvTrans ).xyz;

float3 posW = mul( float4( input.posL, 1.0f ), mWorld ).xyz;

output.toEyeW = EyePosW - posW;

output.posH = mul( float4( input.posL, 1.0f ), mWVP );

output.tex0 = input.tex0;


Left and Right use same This shader code...
"interpolated vertex normals" is blendweight normal ?

This is not skininfo object. Not use LoadMeshHierachyFromX() but use LoadMeshFromX().[/font]

This topic is closed to new replies.

Advertisement