views:

19

answers:

1

I currently have a R8G8B8 floating point render target and want to use it as a R24 target. The code

//cg
out = float4(v, v, v, v);

seems to clamp out between 0 and 1.

What's the proper way to write/read to a floating point texture in Cg?

+1  A: 

In OpenGL, you need to use a floating point texture format, such as R32F or RGBA32F. Then you won't get clamping. I bet it's the same in D3D.

Matias Valdenegro
Are you sure? After all the graphic chip has it's internal storage type.
VJo
Yes i'm sure. A "normal" texture such as GL_RGB8 is a integer normalized texture, which contains values in the [0,1] range. You NEED a floating point texture to represent values outside that range.
Matias Valdenegro