Jump to content
  • Advertisement
Sign in to follow this  
fredrum

OpenGL color as tex3d corrdinates in CG shader

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

Hello, maybe someone here will be able to help me spot what I am doing wrong. I am trying to do a 3D lut CG shader as in, http://http.developer.nvidia.com/GPU...chapter24.html that gets its data from my small OpenGL test program. The problem is that I can't pass a texture colour to my tex3D() call as the xyz coordinates. This is what I am trying to do, it compiles but the tex3D() returns black, float3 colorXYZ = tex2D( testTexture, inUV).rgb; output.pixel = tex3D( lut, colorXYZ ).rgb; I did some testing to make sure my 'colorXYZ' rgb values were within 0.0-1.0. Also I made test and the following works and looks like I would expect. ----------------------------------------------- float3 colorXYZ = tex2D( testTexture, inUV).rgb; output.pixel = colorXYZ; ----------------------------------------------- and ----------------------------------------------- float3 testUV = float3(inUV[0], 0.0, inUV[1]); output.pixel = tex3D( lut, testUV ).rgb; ----------------------------------------------- So I am wondering what could be the difference that breaks my 'colorXYZ' lookup coordinates? What is the difference between, float3 colorXYZ = tex2D( testTexture, sUV).rgb; and float3 testUV = float3(UV[0], 0.0, UV[1]); both should be just float3's right? Is anything else passed along by the tex2D that makes the data not suitable as texture coordinates? I am sure this is how they do it in the OpenEXR example application source. I am using cg-runtime, i think it is called, when I compile the shader from within the application, and I am working in arbfp1. Grateful for any suggestions. cheers fred

Share this post


Link to post
Share on other sites
Advertisement


After some soulsearching I decided that the problem lied in my sketchy at best knowledge of OpenGL rather than the in shader. And after finding a similar article,
http://developer.nvidia.com/forums/index.php?act=Print&client=printer&f=14&t=995
I found the comment "i was missing the cgGLEnableTextureParameter(lookup); call."
I stuck that into my code and it now works!
Annoying that the cg shader worked before I added those, until I tried doing the dependent texture lookup.

cheers
fred

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!