Sign in to follow this  
ARB1130

Can GPU get near fragment information?

Recommended Posts

For example,there are 3x3 pixels. (x,y)=(0~2,0~2) Can I get fragments informations near my excuting fragment. Thank you !^_^

Share this post


Link to post
Share on other sites
Do you mean on the GPU (instead of CPU), in a pixel shader? If so, no, not for the currently executing frame. You could store the previous frame to a texture and read from that, however.

If you want to get information from the GPU to the CPU (readback) you can do that as well (as simply as glReadPixels()...) but it will be rather slow and also won't be current (the frame has to finish before you can read it).

Share this post


Link to post
Share on other sites
For each pixel in the image plane, cast 3x3 rays, with the centre ray being the look-at for that pixel.

The outer 8 rays would be spaced out so that they would match the look-at vectors for the respective neighbouring pixels on the image plane.

It's very easy to visualize when you think of it as rendering to a 3x3 image plane, and then downsampling it to match the true image plane size of 1x1 by using simple averaging.

Share this post


Link to post
Share on other sites
No, you can't get any information that is intrinsic to a fragment aside from the current fragment. There is no guarantee that there even IS a nearby fragment. Your entire polygon could rasterize to a single pixel... there is simply no way to know that.

It is possible to index into a texture "around" the fragment's corresponding texel, though... that can be quite useful in some situations.

Share this post


Link to post
Share on other sites

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