Jump to content
  • Advertisement
Sign in to follow this  
ARB1130

Can GPU get near fragment information?

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

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
Advertisement
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
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!