Jump to content
  • Advertisement
Sign in to follow this  
gmarkou

DX bug, CG bug or my bug?

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

Hi, I have just add range fog on a normalmap shader (written in Cg, runs on February DirectX) and the last line is : finalcolor.xyz = light_m * color.xyz + lerp ( // the fog color float3 (0.2, 0.2, 0.2), // <---- here is the "error" // the pixel color att * ( light_m*color.xyz * diffuse.xyz * diff + specular.xyz * pow(spec,shine)) * attenuation, // the percentange between fog and pixel color... fog_att); The problem : When fog color is (0.2, 0.2, 0.2), everything runs fine. When fog color is (0.2, 0.2, 0.3), there is no fog at all... Any suggestions / ideas??? p.s. tested on ATI Radeon x1900 and nVidia 7800 GTX. (edit : nVidia 7800, not 9700... :) ) [Edited by - gmarkou on April 15, 2006 7:52:19 PM]

Share this post


Link to post
Share on other sites
Advertisement
Does Cg produce assembly code that you could look at? That should tell you if there's a difference between the two shaders, and might show what the problem is.

I suspect the difference comes from the use of an extra constant (since a replicate swizzle works for (0.2, 0.2, 0.2) but not for the other value. You could also try to use other replicated values to see if the code works with them.

Share this post


Link to post
Share on other sites
Thanks for the quick reply.
Yes, Cg produces assembly instructions and, yes, there is actually a difference between the two shaders. I'm not familliar with asm shader instructions so it will take me a while to rtfm and figure out what's going on. I'll post any "discoveries" back here.

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!