Jump to content

  • Log In with Google      Sign In   
  • Create Account


performance method


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 lomateron   Members   -  Reputation: 302

Like
0Likes
Like

Posted 26 September 2012 - 01:26 PM

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

Edited by lomateron, 26 September 2012 - 04:15 PM.


Sponsor:

#2 mhagain   Crossbones+   -  Reputation: 7565

Like
0Likes
Like

Posted 26 September 2012 - 05:31 PM

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.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#3 lomateron   Members   -  Reputation: 302

Like
0Likes
Like

Posted 26 September 2012 - 06:34 PM

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).

#4 phil_t   Crossbones+   -  Reputation: 3222

Like
0Likes
Like

Posted 26 September 2012 - 07:31 PM

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.

#5 lomateron   Members   -  Reputation: 302

Like
0Likes
Like

Posted 26 September 2012 - 08:05 PM

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, 26 September 2012 - 08:43 PM.


#6 InvalidPointer   Members   -  Reputation: 1398

Like
0Likes
Like

Posted 26 September 2012 - 11:12 PM

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)
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.

#7 lomateron   Members   -  Reputation: 302

Like
0Likes
Like

Posted 13 October 2012 - 01:05 AM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS