On 07/14/2011 10:08 AM, Bolstad, Mark wrote:
I like the idea of combining the passes into one, but if I had a blue
object and had to mask it into the red channel, wouldn't it just be black?
Yes, it would be black on the red and green passes, but it would show up
on the blue pass. When you combined the three passes of the image to an
RGB texture, you'd have your blue object. The flow would look something
like this:
- set the camera to draw to an RGB texture
- set camera's color mask to red only
- draw the first object
- set camera's color mask to green only
- draw the second object
- set camera's color mask to blue only
- draw the third object
- fetch the texture from the camera and use it however you need it
as J-S said, you save the combine pass and you don't even need any
special shader magic.
I had talked to a professor who had suggested a one-line fragment
shader to do RGB-> Luminance and use Color Masking to write into the
appropriate channel. Would rendering straight into a Luminance texture
with Color Masking work?
Maybe I'm not understanding you correctly, but I don't think this would
work. You'd end up with a luminance image (effectively, a grayscale
image) at the end and not a color image.
In reality, this is actually more complicated in that it's not three
objects, but three separate frames of animation. So the main loop is:
while(1)
{
advance sim
frame(); // Render to red
advance sim
frame(); // Render to green
advance sim
frame(); // Render to blue
Render RTT texture to display.
}
Maybe if you explained what you're trying to do at a higher level, we'd
be able to better help. What is the problem you're trying to solve?
--"J"
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org