Sign in to follow this  

Odd GLSL Problem

This topic is 4073 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 seem to have come across an extremely odd problem in GLSL. I've managed to simplify the problem to multiplying 2 textures together. Here are some screenshots to help explain (note the gl_FragColor line): texture1 texture2 texture1 * texture2 Both texture1 and texture2 are fine by themselves, but multiplying them together, they go completely transparent (and it's nothing todo with the alpha component, as the original error occured when doing texture1.rgb * texture2.rgb, with the alpha component set to 1.0). Does anyone have any ideas why this is occuring? I'm running a GF6800GT, Driver version 91.47 (altho I've seen it on earlier versions), Windows 2000. Thanks & Regards elFarto

Share this post


Link to post
Share on other sites
If you multiply to a temp variable, and then clamp all four components of that temp variable to the range of 0.0 to 1.0, does that change anything?

Share this post


Link to post
Share on other sites
Hi,

I tried

vec4 temp = clamp(texture1 * texture2, 0.0, 1.0);

gl_FragColor = temp;



and

vec4 temp = clamp(texture1, 0.0, 1.0) * clamp(texture2, 0.0, 1.0);

gl_FragColor = temp;


and

vec4 temp = clamp(clamp(texture1, 0.0, 1.0) * clamp(texture2, 0.0, 1.0), 0.0, 1.0);

gl_FragColor = temp;



None of them made a difference.

Also, this produces the same effect. :(

gl_FragColor = texture1 + texture2;



Regards
elFarto

[Edited by - elFarto on October 22, 2006 4:13:59 AM]

Share this post


Link to post
Share on other sites
If you're absolutely sure all your texture binding is correctly done and all samplers are initialized with the correct texture image units when rendering with both textures, this calls for a deeper analysis of what the compiler generated.

Search for the "nvEmulate" tool on developer.nvidia.com, enable the shader objects source, assembly and logfile output and then run your three GLSL programs. Make sure you rename the output files after each run, then diff the output.
First check if there have been errors in the infolog files.
If not, analyze if the assembly code makes sense.
If not, file a reproducer to NVIDIA.

Share this post


Link to post
Share on other sites
I downloaded the nvEmulate program, and looked at the output. The log file was empty, and the assembler for the shader looked sane, but I'm no expert on assembler.

So I went to make a reproducer, I stripped everything out of my application that wasn't needed, and replace the lovely model with a quad. And guess what, It worked :( I compared assembler produced from the one that works and they are the same, bar the location of the textures.

So I'm quite stumped :(

Regards
elFarto

Share this post


Link to post
Share on other sites

This topic is 4073 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.

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