Hi Jean-Sebastian,

I would propose to use post processing outline technique. I have no references 
how to do this, but here an idea how I think it could be implemented:

1) render selected object into a stencil texture (hence you got 1 where object 
is seen and 0 otherwise)

2) use a shader to compute absolute gradient of this texture 
grad.x = abs(texel(x+1,y) - texel(x,y)); 
grad.y = abs(texel(x,y+1) - texel(x,y));

3) now blur this gradient texture

4) multiply the blurred gradient texture with inverse stencil mask you have 
created before
 - so you get blurred values outside of the object and inside of the objet 
nothing is blurred


5) render the so computed gradient texture over you scene view texture


I think, this is a simpliest and efficientest way to create an outline around 
an object. Instead of blurring one can use something like a growing filter, so 
in a specified window of i.e. 5 pixel set to 1 if one of the mask pixels is 
already 1. Afterwards blur it, to get nice edges of your outline. Of course one 
has to deal with alpha values correctly to get the outline blurred perfectly

This all things can be easyly implemented with osgPPU. But I think you know 
that already ;)

Best regards,
art




--- Jean-Sébastien Guay <[EMAIL PROTECTED]> schrieb am Di, 25.11.2008:

> Von: Jean-Sébastien Guay <[EMAIL PROTECTED]>
> Betreff: [osg-users] Outline technique that doesn't triple (or worse) my 
> frame time?
> An: "OpenSceneGraph Users" <osg-users@lists.openscenegraph.org>
> Datum: Dienstag, 25. November 2008, 22:47
> Hi all,
> 
> As I said before, I'm working on a modeling-type
> application. To give feedback of which object is selected,
> I'd like to outline it in white (or any color).
> 
> I've currently got two implementations of an outline
> effect (using osgFX::Effect), one of which uses the stencil
> buffer, the other which doesn't but does basically the
> same things (render back faces as lines, with a line width
> of 3, with a depth function of LEQUAL, etc.). Pretty
> classic.
> 
> In both cases, my cull, draw and GPU times jump
> inordinately high when the effect is active. For a pretty
> simple object, I get the following:
> 
> Without effect:
> Cull 0.4
> Draw 0.5
> GPU  0.12
> 
> With effect:
> Cull 1.43
> Draw 2.3
> GPU  2.7
> 
> That seems apalling to me... I would think the time would
> *at most* double, and I would be hesitant to use the effect
> if it did. So more than triple is just too much.
> 
> Is there some explanation for this? More importantly, is
> there some other technique I could use to get an outline
> around my object, which would have less of an impact? What
> do others do to get similar effects?
> 
> Thanks in advance,
> 
> J-S
> -- ______________________________________________________
> Jean-Sebastien Guay    [EMAIL PROTECTED]
>                                http://www.cm-labs.com/
>                         http://whitestar02.webhop.org/
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


      
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to