Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

gsus

"sum all pixels" shader

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

Hi... How can i sum all pixels of a texture with a shader? The Texture is really small (16x16 or 32x32) for every side of an cube map, and it will contain float values. One could try to to manually create mipmaps, cos mipmap creation is not supportet for float tex`s, right?. Maybe i could use a global variable? But how can i read this value back? tnx, gsus

Share this post


Link to post
Share on other sites
Advertisement
Offset your texcoord in the shader by 1/16 or 1/32 each time starting from (0,0) until (1,1).



"C lets you shoot yourself in the foot rather easily. C++ allows you to reuse the bullet!"

Share this post


Link to post
Share on other sites
There is no way to get the value back in a "variable". You can
render to an image or use NVidia''s pixel data range to get it
into a vertex array. But its simply a loop, as the previous poster has pointed out. This means that your hardware needs
to have the state of the art pixel shader 3.0 support. The final
answer has to be written into the resulting image. Basically, all you have to do is to run the pixel shader while rendering
one pixel with texture mapping enabled and correct texture chosen. The resulting image will have the summed color. This
is ofcourse subject to hardware limitations.

SporadicFire.

Share this post


Link to post
Share on other sites
you sure the floating point mipmaps can''t be automatically generated??

I''d try to do that, since everything else would be way slower.

Share this post


Link to post
Share on other sites
...ive read somewhere than mipmap creation is not hardware accelarated for float buffers.

i will do mipmap creation by hand.. tnx anyway

Share this post


Link to post
Share on other sites

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