Author Topic: Pixel Shader Question  (Read 3764 times)

0 Members and 1 Guest are viewing this topic.

Offline spathi

  • C= 64
  • **
  • Posts: 78
  • Karma: 5
    • View Profile
Pixel Shader Question
« on: August 26, 2013 »
Gents,

How difficult would it be to write a shader that does simple per-pixel coloring operations based on previous colors of that pixel?

Is that one of the things that borders on impossible for shaders to do?  Can pixels keep track of their states?

Offline Voltage

  • Professor
  • Pentium
  • *****
  • Posts: 857
  • Karma: 53
    • View Profile
Re: Pixel Shader Question
« Reply #1 on: August 26, 2013 »
The pixel shader knows nothing of previous state as you mention.... but you can save that state into a texture, and read from the texture in the next frame.

For example:

http://glsl.heroku.com/e#424.12
Challenge Trophies Won:

Offline spathi

  • C= 64
  • **
  • Posts: 78
  • Karma: 5
    • View Profile
Re: Pixel Shader Question
« Reply #2 on: August 26, 2013 »
Thank you, kind sir.

Do you have any further information on doing shader operations on video?

Offline ryt

  • ZX 81
  • *
  • Posts: 10
  • Karma: 1
    • View Profile
Re: Pixel Shader Question
« Reply #3 on: January 07, 2014 »
You could probably achieve some results with alpha blending.

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: Pixel Shader Question
« Reply #4 on: January 07, 2014 »
Thank you, kind sir.

Do you have any further information on doing shader operations on video?

Shadertoy supports video processing, so it's certainly possible. There are quite a few examples on there of a Brittney Spears video with various post processing effects. It's not something I've ever tried personally, but I can certainly see that it would be pretty fun to play with :)
raizor

Challenge Trophies Won: