I'm not sure I entirely understand what you're trying to accomplish, but perhaps you want to look into using a stencil buffer and/or pixel shader to control what gets rendered?

Guy wrote:

Hello,

I'm trying to merge two sub-graphs to the same image. It doesn't work so well, so I'll try to explain what in general I'm trying to achieve, then my not working so well solutions, and then the questions J

So, in general I want to replace an object (A) in the scene with another object (B) on some condition. The object (B) is some pixels which are lit up. The important thing is to keep the 3D scene distance from the camera for both objects, so if the object is obscured by another, then both (A) and (B) will be obscured, and if some other object (C) is obscured by (A), it will still be obscured by (B). Object (B) might be partially transparent.

Not working so well solution 1:

Have switch for (A)/(B).

The position of (A) is multiplied by view-projection matrix, the result is pos'. (B) is a set of points which their vertices are pos' with (x,y) replaced by the pixels I want to lit, and the new positions are multiplied by the inverse-projection invers-view matrices.

This solution had problems with setting the right pixels.

Not working so well solution 2:

Object (B) is a set of pixel under ABSOLUTE_REF orthographic projection with (x,y) of the pixels I want to lit and z is the negative distance between (A) and the camera.

This solution has the correct pattern of the lit pixels, but the Z order doesn't seems to be correct.

The implementation of solution 2 is to add camera with ABSOLUTE_RF and orthographic projection. View is identity. I set the clear mask to 0 since I don't want the Z-Buffer to be cleared. (opposed to huds and that kind of implementations).

I used the osgviewer to put the cow at 0,0,-300 under absolute_rf, and a point at 0,0,0 under separate camera with orthographic projection, and the point was hidden by the cow (which is a mistake).

I thought that I might need to set the zNear/zFar of both camera's to be the same, but in this simple example it shouldn't matter since the point Z is zero…

So first, do I have to set the zNear/zFar of both camera's to be the same?

Any ideas whats going wrong?

Other solutions for the problem?

Btw, I tried to replace the points by quads under orthographic projection. The results were the same.

Thanks,

 Guy.

------------------------------------------------------------------------

*מאת**:* osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] *בשם** *Robert Osfield
*נשלח**:* Monday, March 16, 2009 5:39 PM
*אל**:* osg-users@lists.openscenegraph.org
*נושא**:* Re: [osg-users] RecordCameraPathHandler where is the saved_animation.path file?

On Mon, Mar 16, 2009 at 3:28 PM, Felix Ilbring <osgfo...@tevs.eu> wrote:

Hi Robert

I have done it. I put it to

new osgViewer::RecordCameraPathHandler("C:\\ETC.path");

but it was never there.


The class has always worked for me, so can't suggest any gotcha's, you'll have to open up a debug and see what the ReecordCameraPathHandler is doing on your build/system.

Robert.

------------------------------------------------------------------------

_______________________________________________
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