Jump to content

  • Log In with Google      Sign In   
  • Create Account


Pixel processing question - kill/discard a pixel


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
2 replies to this topic

#1 Volgogradetzzz   Members   -  Reputation: 534

Like
0Likes
Like

Posted 19 February 2014 - 02:17 AM

Hello. Can you please explain me how pixel processing works in this cases:

1. I have a texture with data (some color after clear or some data after previous pass) and I'm processing a pixel which already have some data. If I discard that pixel - what will happen? Will the existing data stay or it will be gone?

2. I have a pixel which will be processed several times in render pass. If first process is successful and in the next one discard will be called - will the data from first draw stay or it will be discarded too? Will the next calls process that pixel or after killing it all subsequent drawings will be killed too?

3. What is the best way to not to change a data in texture. Say, I have some condition - if it's true I'll write new data. If false - I want to keep an old data.



Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 6685

Like
3Likes
Like

Posted 19 February 2014 - 02:37 AM


1. I have a texture with data (some color after clear or some data after previous pass) and I'm processing a pixel which already have some data. If I discard that pixel - what will happen? Will the existing data stay or it will be gone?

A pixel is just a small memory block. It contains some data. A pixel-shader have an input and output and some processing in between. If you discard the pixel in the shader, then the shader output (=pixel) will not be writen to the memory block. That means, the previous pixel content is still there.

 

 

 


2. I have a pixel which will be processed several times in render pass. If first process is successful and in the next one discard will be called - will the data from first draw stay or it will be discarded too? Will the next calls process that pixel or after killing it all subsequent drawings will be killed too?

See above, it will stay.

 

 

 


3. What is the best way to not to change a data in texture. Say, I have some condition - if it's true I'll write new data. If false - I want to keep an old data.
 

There are several ways and the best way depends on the concrete situation. Eg you can discard it in the shader, you can utilize the z-buffer, alpha mask or stencil mask. All of these methods are really useful, but which to use depends on the effect you want to archive.


Edited by Ashaman73, 19 February 2014 - 02:38 AM.


#3 Volgogradetzzz   Members   -  Reputation: 534

Like
0Likes
Like

Posted 19 February 2014 - 03:47 AM

Thank you!






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