POV-Ray : Newsgroups : povray.off-topic : Pixel shader question : Pixel shader question Server Time
4 Sep 2024 09:19:10 EDT (-0400)
  Pixel shader question  
From: Darren New
Date: 2 Mar 2010 00:01:55
Message: <4b8c9bc3$1@news.povray.org>
Check me on this one...

I have a motion detector written in terms of a handful of pixel shaders. 
(Make it greyscale, compare this frame against two previous frames for 
differences, threshold, erode, etc.)

Now all I'm really interested in is how much motion there is.

Is there any way in a pixel shader to do something like count the number of 
white pixels, or find the bounding box around the white pixels? There's no 
way to have the calculations of one pixel or vertex dependent on the 
calculations of a different pixel in the same pass? Or any way to return an 
actual numeric value other than making a color?

I was thinking something like doing a lg_2(frame width) to propagate white 
pixels (motion) towards each edge in steps of power of two, so the leftmost 
edge would have white wherever there was any white pixel in the row and the 
topmost edge would have white where there was white anywhere in the column, 
but that was about as good as I could come up with.

I don't think a pass of a pixel shader can "see" the output of the previous 
pixel shader, right? Just possibly overwrite parts based on vertices, 
culling, alpha, and all that good stuff?

-- 
Darren New, San Diego CA, USA (PST)
   The question in today's corporate environment is not
   so much "what color is your parachute?" as it is
   "what color is your nose?"


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.