Sign in to follow this  
gmarkou

DX bug, CG bug or my bug?

Recommended Posts

gmarkou    122
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
ET3D    810
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
gmarkou    122
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this