Odd GLSL Problem

Started by
5 comments, last by elFarto 17 years, 5 months ago
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
Advertisement
seems strange try normalizing th reflection vector in the fragment shader (though i doubt thatll help)
possibly email nvidia about it otherwise
Nope, normalising the reflection vector didn't make any difference :(

Regards
elFarto
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?
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]
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.
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

This topic is closed to new replies.

Advertisement