Jump to content
  • Advertisement
Sign in to follow this  
AquaMacker

Applying Phong Lighting, bad trouble !

This topic is 2300 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

[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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites
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.)

Share this post


Link to post
Share on other sites
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 ?

Share this post


Link to post
Share on other sites

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.)

Share this post


Link to post
Share on other sites

[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]

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!