• Advertisement
Sign in to follow this  

performance method

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

I want to know how is the fastest way
to get whats the lowest alpha value in a texture Edited by lomateron

Share this post


Link to post
Share on other sites
Advertisement
If the texture data never changes just do it at load time and store it out somewhere. Best case is that you'll be passing over the texels anyway so you can combine the computation with the pass; worst case is that you may need to copy it off to a staging resource, map that, and calculate from there. I don't know of any easy way to get the lowest alpha at runtime for dynamic textures; average alpha is easy as pie (just sample from the smallest mip level) but lowest? Nope.

Share this post


Link to post
Share on other sites
It is a dynamic texture, I'm still looking for the fastest way to do it, not the easiest, i dont care about complexity. I have tought about rendering to another texture that is half the number of pixels of the original texture and to each pixel of this new texture will be rendered the lowest alpha bettwen 2 pixels of the original, and do this again and again until there is small number of pixels were its faster to read all of them and compare them in one pass(i mean in one shader method pass).

Share this post


Link to post
Share on other sites
Downsampling to one pixel will work. That will be the fastest, assuming you only need the value on the GPU (e.g. for a shader to sample from).

Do you need this information on the CPU? If so, do you need to maintain interactive framerates? If not, just copy the texture data to CPU memory and run through it.

Share this post


Link to post
Share on other sites
I dont need the info in the CPU.
Can you help me on how to do that down sampling?
Is the that downsampling what i just write in my second comment or is another way. Edited by lomateron

Share this post


Link to post
Share on other sites
FWIW you may be able to speed that up a bit by downsampling by a factor of 4 or more each pass-- usually write bandwidth doesn't scale quite as well as read does (and you do a lot more writing with a 2x2 than with a 4x4 or greater, let alone need more passes/CPU time)

Share this post


Link to post
Share on other sites
If the texture is 1D and instead of RGBA, it has R, will it be faster if I increase the factor from 4 to 7? just to ask, i really dont think it will be.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement