PDA

View Full Version : FBO precision for GPU volume rendering



alfalf3
06-04-2007, 06:53 AM
Hi,

I am developing some GPU raycasting volume rendering and I encountered some precision problems.
To retrieve starting and ending points, I draw bounding box’s front faces and back faces on FBO and set them as input of my cg fragment shader.
The problem is that the direction computed is not accurate when I zoom on the volume (when the camera is far away it looks fine, but when I move on, big pixels effect appear)

The color textures are defined as:


glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F_ARB, mWindowWidth, mWindowHeight,0, GL_RGBA, GL_FLOAT, 0);My graphic card is GeForce7600GT
Have you experience the same thing? How could I retrieve accurate 3D positions?

Vincent

kon
06-04-2007, 08:14 AM
First, using RGBA16F will be enough and faster. I'm using this and clamp_to_edge for texparameters.
Without seeing a picture of your result it's difficult to say, but I guess you should change the stepsize in your shader. How many iterations are you doing and what is your stepsize?

alfalf3
06-04-2007, 10:15 AM
Thanks for your reply,
I changed with RGBA16F but it's not better unfortunately.
I noticed something strange to me.
If I don't use the FBO and compute the direction vector with the camera position and the first position encoded with texture coordinate everything is ok I get perfect rendering
But If I use the position encoded with color, I get the same effect as FBO sort of big aliasing...
It seems that I don't get float precision encoding position with colors, maybe I only have 8bit precision per component...
But I need to store these intermediate results (sarting 3D position) in texture... Is there any R32G32B32 texture format??? How can I do that?
Thanks in advance

kon
06-04-2007, 10:42 AM
RGBA16F means 16bit float for each channel.
In your first post you are using three components for internal format, but four for format. Correct that and test with glGetError()!

You are using glColor3f for the coordinates,aren't you?
First you could try to render the rays with and without using the FBO to test if this looks the same.

Jackis
06-04-2007, 01:56 PM
alfalf3

when passing color from vertex to pixel shader (I mean, vertex output and pixel input COLOR0 and COLOR1), theay are evaluated with limited precision on most hardware. If you need float precision - pass them via TEXCOORD.

alfalf3
06-04-2007, 03:39 PM
Thanks for your answers,
Indeed this is something I have noticed, there is a loss of precision using color instead of texcoord; but is there the same loss if I use FBO with color textures attached on?
I tried to better explain my problem here : http://alfalf3.neuf.fr/
I am wondering why I can't get the same precision rendering front faces on FBO and use them in my pixel shader? :confused:

alfalf3
06-04-2007, 11:31 PM
You solved my problem.
I didn't realize that I had also to use other shaders to build my FBO from texcoord.
Thanks for your help