POV-Ray : Newsgroups : povray.off-topic : Pixel shader question : Re: Pixel shader question Server Time
4 Sep 2024 09:20:06 EDT (-0400)
  Re: Pixel shader question  
From: Darren New
Date: 2 Mar 2010 12:01:55
Message: <4b8d4483$1@news.povray.org>
scott wrote:
> get this information with CreateQuery() and related functions. 

Ah. Excellent. I think I saw something along those lines in the XNA stuff 
too. Thanks for the hint.

> At the end of the pass use your API functions to read back the number of 
> pixels rendered.

Hmmm. OK. I think I'm going to need to know something about where they are, 
too, but this might be a start.

>> 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?
> 
> No because they run in parallel, and in an undefined order I expect.

That's what I thought, yes.

>> Or any way to return an actual numeric value other than making a color?
> 
> Well you can create a surface texture that is full of floats or doubles 
> rather than RGBA bytes.  On later cards and APIs a pixel shader can also 
> output multiple values to multiple render targets (but still limited to 
> 4 or something I think, IDK the details).

OK. I would be willing to live with 255 values, or certainly 65K values is 
more than enough, so I probably don't have to figure out how to make a 
surface full of floats. :)

>> I don't think a pass of a pixel shader can "see" the output of the 
>> previous pixel shader, right?
> 
> The usual method is to set the rendertarget as texture A (with input 
> texture B) and run your pixel shader, then the rendertarget as texture B 
> and use texture A as an input texture.  That way you get to use the 
> previous output, and it isn't as slow as it sounds.

Right, but that isn't two "passes" in the same technique. (I've just seen 
very few techniques with multiple passes, is all, and I'm trying to figure 
out what they're so good for that you'd explicitly include the logic to 
support them all thru the IDE and languages.)

But that's a good hint, to have multiple render targets and instead of 
pulling the colors out and pushing them back in, just pick up the texture 
and feed that right back without even taking it off the card. That might 
save me some processing time.

Thanks! You've given me good stuff to look into.

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