Jump to content

View more

View more

Image of the Day

雑魚は多めにして、爽快感重視にしつつ・・・(´・ω・`)
早いとこ、ベースを作って、完成にもっていかないとね。
タイトルもまだ迷ってるだよなぁ。 
#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Pixel processing question - kill/discard a pixel

4: Adsense

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 nikitablack   Members   

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



#2 Ashaman73   Members   

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

Ashaman

 

Gnoblins: Website - Facebook - Twitter - Youtube - Steam Greenlit - IndieDB - Gamedev Log


#3 nikitablack   Members   

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