Re: [osg-users] [build] OSX X11 Build System Failures

2016-06-23 Thread Ravi Mathur
Oops the fix I posted is wrong. osgmultitouch and osgoscdevice should continue 
to work on non-Apple platforms.

Any ideas on a good fix?

Ravi

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67769#67769





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


Re: [osg-users] Near/Far problem using models with bones.

2016-06-23 Thread Julien Valentin
After debugging 
I was completely wrong adding a Group as nothing to do with your problem
It's a scaling problem...

1st test) 
osgconv fbx test1.osg (problem persist in osg file)
2nd test) 
osgviewer->setscenedata(fbx)
fbx->setUpdateCallback(WriteNode2FileAfterfewframeCallback(*fbx,"test2.osg")); 
///(I use a runtime editor to do that (it will be interesting to see that by 
code)
test2 works well?!

I checked by hand both testX.osg and it appears that VertexArray in test2.osg 
is scaled 100x those in test1.osg

But I still don't have a clue on where VertexArray is scale correctly...





robertosfield wrote:
> On 23 June 2016 at 19:50, Dario Minieri <> wrote:
> 
> > Hi,
> > 
> > May be Robert can clarify this behaviour... :D
> > 
> 
> I didn't wirte osgAnimation and haven't used more than to just compile
> the examples and merge fixes.  So I'm afraid I can't comment on the
> specifics of osgAnimation.
> 
> The only thing I can add is thtat is general this type of problem come
> down to the BoundingSphere of Node or BoundingBox of Drawable being
> computed incorrectly/not accounting for movement properly.
> 
> Robert.
> ___
> osg-users mailing list
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
>  --
> Post generated by Mail2Forum


--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67768#67768





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


[osg-users] [build] OSX X11 Build System Failures

2016-06-23 Thread Ravi Mathur
Hi all,

A few of the newer OSG components explicitly reference 
osgViewer::GraphicsWindowCocoa in their code. This causes link errors when 
compiling OSG on MacOS with OSG_WINDOWING_SYSTEM set to X11.

The affected components are: avfoundation (osgdb), osgmultitouch (examples), 
osgoscdevice (examples). Currently the only check done in their CMake scripts 
is IF(APPLE), which implicitly assumes that everyone on Mac is building Cocoa.

One simple fix is to add a check at the beginning of the affected components' 
CMakeLists.txt files. e.g.:

Code:

IF(NOT (OSG_WINDOWING_SYSTEM STREQUAL "Cocoa"))
  RETURN()
ENDIF()



This will only build that component if the windowing system is Cocoa.

Thoughts appreciated,
Ravi

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67767#67767





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


Re: [osg-users] Using InfinitePlane

2016-06-23 Thread Robert Osfield
Hi Valeian,

What do you mean by an InfinitePLane?  One to interest against, to
intersect the the scene with, or one to visualize?

Robert.

On 23 June 2016 at 16:49, Valerian Merkling  wrote:
> Hi,
>
> I would like to use an InfinitePlane to be able to use 
> "view->computeIntersection" everywhere, but I cannot find how put it inside 
> my scene graph...
>
> In which kind of node shall I put this InfinitePlane ? Geode ?
>
> Can someone help me ?
>
> Thank you!
>
> Cheers,
> Valerian
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=67759#67759
>
>
>
>
>
> ___
> 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


Re: [osg-users] Near/Far problem using models with bones.

2016-06-23 Thread Robert Osfield
On 23 June 2016 at 19:50, Dario Minieri  wrote:
> Hi,
>
> May be Robert can clarify this behaviour... :D

I didn't wirte osgAnimation and haven't used more than to just compile
the examples and merge fixes.  So I'm afraid I can't comment on the
specifics of osgAnimation.

The only thing I can add is thtat is general this type of problem come
down to the BoundingSphere of Node or BoundingBox of Drawable being
computed incorrectly/not accounting for movement properly.

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


Re: [osg-users] Near/Far problem using models with bones.

2016-06-23 Thread Dario Minieri
Hi,

May be Robert can clarify this behaviour... :D

Thank you!

Cheers,
Dario

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67764#67764





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


Re: [osg-users] Best way to cull object hidden by a mountain

2016-06-23 Thread Chris Hanson
I might be able to help you with this. Is your source something you can
share, possibly off-list?

On Wed, Jun 22, 2016 at 9:55 AM, Valerian Merkling 
wrote:

> Hi,
>
> I'm working with OpenSceneGraph 3.4.0 on a kind of GIS app.
>
> I'm rendering the ground using textured HeightField square. My scene graph
> is cut in two part, a group node with all the textured HeightFields, and
> another containing all my 3D objects (sorted in a quadtree).
>
> I've got a lot of thoses textured heightfield squares, they come in
> different resolution, and will be soon put into a nice QuadTree with LOD.
>
> I would like to use Occlusion Culling to avoid to render object hidden
> behind those Heightfield.
>
> As far as I know there is both OccluderNode and OcclusionQueryNode which
> can be used for culling.
>
> I tried to use OccluderNode but I can't convert HeightField to
> ConvexPlanarOccluder.
>
> Then I tried OcclusionQueryNode (root -> occlusionQueryNode -> QuadTree ->
> objects) but it seems to be too powerful : everything is culled, even the
> heightField part which is not inside the occlusionQueryNode ... :(
>
> I came to realize that I barely understand how to use OcclusionQueryNode
> and OccluderNode, so I would like to have your advice : Is it a good idea
> to use one of thoses ? And how can I use them properly ?
>
> Thank you!
>
> Cheers,
> valerian
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=67739#67739
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com
http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 •
GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Legal/IP • Code Forensics • Digital Imaging • GIS • GPS •
osgEarth • Terrain • Telemetry • Cryptography • LIDAR • Embedded • Mobile •
iPhone/iPad/iOS • Android
@alphapixel  facebook.com/alphapixel (775)
623-PIXL [7495]
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Using InfinitePlane

2016-06-23 Thread Valerian Merkling
Hi,

I would like to use an InfinitePlane to be able to use 
"view->computeIntersection" everywhere, but I cannot find how put it inside my 
scene graph...

In which kind of node shall I put this InfinitePlane ? Geode ? 

Can someone help me ?

Thank you!

Cheers,
Valerian

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67759#67759





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


[osg-users] Best way to cull object hidden by a mountain

2016-06-23 Thread Valerian Merkling
Hi,

I'm working with OpenSceneGraph 3.4.0 on a kind of GIS app.

I'm rendering the ground using textured HeightField square. My scene graph is 
cut in two part, a group node with all the textured HeightFields, and another 
containing all my 3D objects (sorted in a quadtree).

I've got a lot of thoses textured heightfield squares, they come in different 
resolution, and will be soon put into a nice QuadTree with LOD. 

I would like to use Occlusion Culling to avoid to render object hidden behind 
those Heightfield.

As far as I know there is both OccluderNode and OcclusionQueryNode which can be 
used for culling.

I tried to use OccluderNode but I can't convert HeightField to 
ConvexPlanarOccluder.

Then I tried OcclusionQueryNode (root -> occlusionQueryNode -> QuadTree -> 
objects) but it seems to be too powerful : everything is culled, even the 
heightField part which is not inside the occlusionQueryNode ... :(

I came to realize that I barely understand how to use OcclusionQueryNode and 
OccluderNode, so I would like to have your advice : Is it a good idea to use 
one of thoses ? And how can I use them properly ?

Thank you!

Cheers,
valerian

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67739#67739





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


Re: [osg-users] OpenSceneGraph Travis + Coverity scan up and running

2016-06-23 Thread Jason Beverage
Hey Jordi,

I saw that and I'm going to fix the script so it doesn't run the normal
script, but the main issue is this:
https://github.com/travis-ci/travis-ci/issues/6142

Apparently the coverity addon is broken on travis and it can't download the
coverity tools b/c of an SSL issue. Hopefully they will have that fixed
soon.

Thanks!

Jason

On Thu, Jun 23, 2016 at 12:40 PM Jordi Torres 
wrote:

> Hi Jason,
>
> It seems your coverity scan build is not being launched. Instead of this
> the "script" tag command is the one running.
> Take a look at
> https://github.com/openscenegraph/OpenSceneGraph/blob/master/.travis.yml#L52,
> the "normal" build should not be launched if you are in the
> coverity_branch.
> Also your project should be easier to configure as you are not running
> MacOSX builds, so you are not using a matrix for travis. So in a first look
> I cannot spot anything weird, but make sure the indentation is correct, as
> it seems to be important.
>
> I'm happy to help if I can so feel free to contact me.
>
> Cheers.
>
>
> 2016-06-23 16:54 GMT+02:00 Jason Beverage :
>
>> If it works, it's perfect :)
>>
>> I set something up for osgEarth and it appears to be working, at least
>> for the travis builds.  I haven't seen coverity working yet though.  The
>> travis build on my coverity_scan branch runs to completion and says that
>> it's authorized with coverity and everything, but no coverity activity.
>> How long has it been taking you to see coverity activity on the dashboard
>> once a travis build completes?
>>
>> My travis file for osgearth and coverity is here
>> https://github.com/gwaldron/osgearth/blob/coverity_scan/.travis.yml if
>> any experts want to peek at it ;)
>>
>> Jason
>>
>> On Thu, Jun 23, 2016 at 10:33 AM Robert Osfield 
>> wrote:
>>
>>> Hi Jason,
>>>
>>> On 21 June 2016 at 21:51, Jason Beverage 
>>> wrote:
>>> > Really cool Robert.  I'd love to get TravisCI setup for osgEarth as
>>> well, we
>>> > might pick your brain on it here soon.
>>>
>>> I'm not the one with the skills on settings things up, Jordi and Ralf
>>> were the main driving forces behind making it happen ;-)
>>>
>>> For osgEarth you can look at what we've done with Travis by looking at
>>> the .travis.yml that the OSG now has.  It's not perfect but seems to
>>> be working well now.
>>>
>>> Cheers,
>>> 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
>>
>>
>
>
> --
> Jordi Torres
>
>
> ___
> 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


Re: [osg-users] OpenSceneGraph Travis + Coverity scan up and running

2016-06-23 Thread Jordi Torres
Hi Jason,

It seems your coverity scan build is not being launched. Instead of this
the "script" tag command is the one running.
Take a look at
https://github.com/openscenegraph/OpenSceneGraph/blob/master/.travis.yml#L52,
the "normal" build should not be launched if you are in the
coverity_branch.
Also your project should be easier to configure as you are not running
MacOSX builds, so you are not using a matrix for travis. So in a first look
I cannot spot anything weird, but make sure the indentation is correct, as
it seems to be important.

I'm happy to help if I can so feel free to contact me.

Cheers.


2016-06-23 16:54 GMT+02:00 Jason Beverage :

> If it works, it's perfect :)
>
> I set something up for osgEarth and it appears to be working, at least for
> the travis builds.  I haven't seen coverity working yet though.  The travis
> build on my coverity_scan branch runs to completion and says that it's
> authorized with coverity and everything, but no coverity activity.  How
> long has it been taking you to see coverity activity on the dashboard once
> a travis build completes?
>
> My travis file for osgearth and coverity is here
> https://github.com/gwaldron/osgearth/blob/coverity_scan/.travis.yml if
> any experts want to peek at it ;)
>
> Jason
>
> On Thu, Jun 23, 2016 at 10:33 AM Robert Osfield 
> wrote:
>
>> Hi Jason,
>>
>> On 21 June 2016 at 21:51, Jason Beverage  wrote:
>> > Really cool Robert.  I'd love to get TravisCI setup for osgEarth as
>> well, we
>> > might pick your brain on it here soon.
>>
>> I'm not the one with the skills on settings things up, Jordi and Ralf
>> were the main driving forces behind making it happen ;-)
>>
>> For osgEarth you can look at what we've done with Travis by looking at
>> the .travis.yml that the OSG now has.  It's not perfect but seems to
>> be working well now.
>>
>> Cheers,
>> 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
>
>


-- 
Jordi Torres
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] OpenSceneGraph Travis + Coverity scan up and running

2016-06-23 Thread Robert Osfield
Hi All,

I've spent quite a few hours of the last week or so working getting
the Coverity defect count down.  The latest Scan results are now up:

   https://scan.coverity.com/projects/openscenegraph-openscenegraph

The average defect rates was 1.2 at the start, but now is down to
0.91.  Still way above the open source average which is below 0.59.

I've cleared up the almost all of the High impact defects, the
remaining ones as they all pertain to the GLU mipmp+tesselation code
that's been integrated into the core osg library for quite a few
years.  The GLU code is C code through and through and far from easy
to follow so I'm very wary about hacking in a "fix" that breaks
something.  Other are welcome to test their programming skills on
these reported defects :-)

I have also begun cleaning up the header and core libraries,  The
headers, osgDB, osgText, osgVolume, osgFX are now have zero reported
defects.

In terms of core libraries biggest source of outstanding defects is
now the osgAnimation NodeKit (this has a defect rate of 6.78 per
thousand lines of code), I'm not the author not a user of this Nodekit
so would appreciate osgAnimation users joining in a fixes these
defects.

Finally the biggest cause of defect reports by a long long way... our
osgPlugins.  There average defect count is 1.88, but with 131 thousand
lines of code that ends up being 246!  I didn't write the vast
majority of the osgPlugins, this is an area where the community have
contributed the most, so it's also an area where I'm the less
experienced with the code, so making judgements about it is less easy.
I've already fixed *many* defects in the osgPlugins, but I just don't
scale to tackling hundreds of defects on unfamiliar code.

So this is where it would be very very useful to have the community
help out.  If a dozen of us put in a couple of hours a week then I'm
sure we'd have the majority dealt with within a week or two.

My own plan is to concentrate of the core OSG NodeKits. osgUtil, osgGA
and osgViewer will be my next targets.  I can't dedicate fulltime this
as I have client work I need to get on with.  It's something I'd like
to get done though, get the core OSG cleaned up for 3.6.

Thanks in advance for you help,
Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] OpenSceneGraph Travis + Coverity scan up and running

2016-06-23 Thread Jason Beverage
If it works, it's perfect :)

I set something up for osgEarth and it appears to be working, at least for
the travis builds.  I haven't seen coverity working yet though.  The travis
build on my coverity_scan branch runs to completion and says that it's
authorized with coverity and everything, but no coverity activity.  How
long has it been taking you to see coverity activity on the dashboard once
a travis build completes?

My travis file for osgearth and coverity is here
https://github.com/gwaldron/osgearth/blob/coverity_scan/.travis.yml if any
experts want to peek at it ;)

Jason

On Thu, Jun 23, 2016 at 10:33 AM Robert Osfield 
wrote:

> Hi Jason,
>
> On 21 June 2016 at 21:51, Jason Beverage  wrote:
> > Really cool Robert.  I'd love to get TravisCI setup for osgEarth as
> well, we
> > might pick your brain on it here soon.
>
> I'm not the one with the skills on settings things up, Jordi and Ralf
> were the main driving forces behind making it happen ;-)
>
> For osgEarth you can look at what we've done with Travis by looking at
> the .travis.yml that the OSG now has.  It's not perfect but seems to
> be working well now.
>
> Cheers,
> 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


Re: [osg-users] OpenSceneGraph Travis + Coverity scan up and running

2016-06-23 Thread Robert Osfield
Hi Jason,

On 21 June 2016 at 21:51, Jason Beverage  wrote:
> Really cool Robert.  I'd love to get TravisCI setup for osgEarth as well, we
> might pick your brain on it here soon.

I'm not the one with the skills on settings things up, Jordi and Ralf
were the main driving forces behind making it happen ;-)

For osgEarth you can look at what we've done with Travis by looking at
the .travis.yml that the OSG now has.  It's not perfect but seems to
be working well now.

Cheers,
Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] osgUtil::PlaneIntersector and Invalid Pointer and Tesselation Error

2016-06-23 Thread Théo NASSOUR
Hi,

I am using plane intersection to get the intersection of all meshes in my scene 
with a plane.  :

Code:

osg::ref_ptr intersector = new 
osgUtil::PlaneIntersector(mIntersectionPlane);

intersector->setRecordHeightsAsAttributes(true);
intersector->setPrecisionHint(osgUtil::PlaneIntersector::PrecisionHint::USE_DOUBLE_CALCULATIONS);

osgUtil::IntersectionVisitor mIntersectionVisitor; // Defined as a member 
usually

mIntersectionVisitor.reset();
mIntersectionVisitor.setTraversalMask(utils::MASK_SCENE_DATA);
mIntersectionVisitor.setIntersector(intersector.get());

view->getSceneData()->accept(mIntersectionVisitor);

osgUtil::PlaneIntersector::Intersections& intersections = 
intersector->getIntersections();




and in another function : i am computing the corresponding geode to the 
intersections:


Code:

inline osg::ref_ptr getSlice(const 
osgUtil::PlaneIntersector::Intersections & intersections)
{
osg::ref_ptr geode = new osg::Geode;
osg::ref_ptr geometry = new osg::Geometry;
osgUtil::Tessellator tessellator;

// set the normal in the same way color.
osg::ref_ptr normals = new osg::Vec3Array;
// Compute Vertices
osg::ref_ptr vertices = new osg::Vec3Array;

for (const auto& intersection : intersections)
{
  for (const auto& vertex : intersection.polyline)
  {
  vertices->push_back(vertex);
  normals->push_back(osg::Vec3(0.0f, 0.0f, 1.0f));
  }
  vertices->push_back(*intersection.polyline.begin());
  normals->push_back(osg::Vec3(0.0f, 0.0f, 1.0f));
  vertices->push_back(*intersections.begin()->polyline.begin());
  normals->push_back(osg::Vec3(0.0f, 0.0f, 1.0f));
}

geometry->setVertexArray(vertices);
geometry->setNormalArray(normals, osg::Array::BIND_OVERALL);
geometry->addPrimitiveSet(new osg::DrawArrays(GL_POLYGON, 0, vertices->size()));

tessellator.setWindingType(osgUtil::Tessellator::WindingType::TESS_WINDING_NONZERO);
tessellator.setTessellationType(osgUtil::Tessellator::TESS_TYPE_GEOMETRY);
tessellator.retessellatePolygons(*geometry);

geode->addDrawable(geometry.get());
geode->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::ON);

return geode.get();
}




Now : 
My first Problem is : Somtimes thee last element in the NodePath of 
Intersections in the intersection is an invalid pointer, I don't Know why.

My Secend Problem is : Somtimes when i have meshes with Holes, the Holes are 
not Computed, all the mesh is filled.

Thank you!

Cheers,
Théo

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67752#67752





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


Re: [osg-users] Near/Far problem using models with bones.

2016-06-23 Thread Dario Minieri
Hi,

I'll try that but this is a problem for me, because my engine expect a 
matrixtransform as root...I can ingest that but I'll substitute a problem with 
another hehehe :D 

Thanks again!

Thank you!

Cheers,
Dario

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67750#67750





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


Re: [osg-users] Near/Far problem using models with bones.

2016-06-23 Thread Julien Valentin
I added a root group and all work great..strange
I don't know where come the problem 
Seams osgviewers don't like MatrixTransform as root node..


Paradox wrote:
> Hi,
> 
> Thanks for your interest. This is the FBX.
> 
> Thank you!
> 
> Cheers,
> Dario


--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67749#67749





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


[osg-users] osgFX::Outline and Stencil

2016-06-23 Thread Théo NASSOUR
Hi,

I have Two views in my scene, both of them are in a Composite Viewer. I have 
added the outline to the truck, and then i have added the truck to my scene. 
Why only under the viewport of the cube i have the outline.

Here is a part of my code, and i have attached an image of the result

///OSG Scene : View
osg::ref_ptr mView;
osg::ref_ptr mCubeView;
///OSG Scene : Viewer
osg::ref_ptr mViewer;

...

osg::ref_ptr ds = osg::DisplaySettings::instance();
ds->setMinimumNumStencilBits(8);
mView->getCamera()->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | 
GL_STENCIL_BUFFER_BIT);
mView->getCamera()->setClearStencil(0);
mView->getCamera()->setViewport(new osg::Viewport(0, 0, mTraits->width, 
mTraits->height));
mViewer->addView(mView.get());
mCubeView->getCamera()->setClearMask(GL_DEPTH_BUFFER_BIT | 
GL_STENCIL_BUFFER_BIT);
mCubeView->getCamera()->setRenderOrder(osg::Camera::POST_RENDER);
mCubeView->getCamera()->setClearStencil(0);
mCubeView->getCamera()->setViewport(new osg::Viewport((mTraits->width - 175), 
(mTraits->height - 175), 150, 150,));
mViewer->addView(mCubeView.get());
...
mView->setSceneData(mSceneData.get());
...

{
osg::ref_ptr outlineModel = 
osgDB::readNodeFile("D:\\Data\\New_Test\\OpenSceneGraph-3.4.0\\OpenSceneGraph\\build\\x64\\bin\\dumptruck.osgt");
// create outline effect
osg::ref_ptr outline = new osgFX::Outline;
mSceneData->addChild(outline.get());
outline->setWidth(8);
outline->setColor(osg::Vec4(1, 1, 0, 1));
outline->addChild(outlineModel.get());
}

Thank you!

Cheers,
Théo

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67735#67735




Attachments: 
http://forum.openscenegraph.org//files/truck_628.png


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


Re: [osg-users] Most efficient way to get the gl_ModelViewMatrix of PREVIOUS frame?

2016-06-23 Thread Philipp Meyer
Hi,

so here is a little update on my current progress. I have a working solution, 
but im not 100% happy with it as it is pretty messy and offers bad performance.

The basic idea is to assign a uniform variable to each and every transform node 
of the scene graph, storing its total modelMatrix so it can be accessed by the 
shader.

1) After building the scene graph, traverse through all nodes. Once a transform 
node is found, create a uniform and attach it to it. Also add an entry into a 
global map variable, linking the created uniform with a list of transform nodes 
(all parents of the current node).
2) Then, with every frame, iterate through the uniform map and calculate the 
current model matrices based on the matrix transform list.

This works, but there are several drawbacks:

1) If the scene graph is modified in any way after buidling the map, it will 
yield wrong results. So with every change of the scene graph, the map needs to 
be rebuilt.
2) If multiple parents share the same transform node and it is not an identity 
matrix transform (with no effect), the approach wont work at all because there 
is no unique stateset for that transform.
3) Somewhat bad performance, lots of CPU load and bottlenecking.

If anyone has a better idea about how to obtain the model matrix of the 
PREVIOUS frame in the vertex shader, please let me know.


Code:
void MDRT::MotionDeskRT::updatePreviousFrameModelMatrices(
const osg::Matrix ) {
if (modelMatrixUniformMap.empty()) {
buildModelMatrixUniformMap(sceneRoot,
std::vector());
}

osg::Matrix modelMatrix;

for (const auto & pair : modelMatrixUniformMap) {
osg::Uniform *mmUniform = pair.first;
const auto  = pair.second;
const size_t mtListLen = mtList.size();

modelMatrix = mtList[0]->getMatrix();
for (size_t i = 1; i < mtListLen; ++i) {
modelMatrix = mtList[i]->getMatrix() * modelMatrix;
}
//modelViewMatrix = modelViewMatrix * viewMatrix;

mmUniform->set(modelMatrix);
}
}

void MDRT::MotionDeskRT::buildModelMatrixUniformMap(osg::Node* root,
const std::vector ) {

//all of the below only works if no matrix transforms with a matrix != 
identity are shared.
//otherwise, all use the same state set, which will make it impossible
//to have a unique uniform storing the individual overall transform of 
a MT node.
osg::Group *group = dynamic_cast(root);
if (!group) {
return; //is leaf and not MT
}

const unsigned int childCount = group->getNumChildren();
osg::MatrixTransform *mt = dynamic_cast(group);

if (mt && mt->getMatrix() != osg::Matrix::identity()) {
//is matrix transform, update modelview matrix
auto modifiedMatrixTransforms = matrixTransforms;
if (mt->getReferenceFrame()
!= osg::Transform::ReferenceFrame::RELATIVE_RF) 
{
//this mt doesnt use relative reference frame, and 
therefore ignores all parent MTs when calculating the final model matrix.
modifiedMatrixTransforms.clear();
}
modifiedMatrixTransforms.push_back(mt);

osg::Uniform *mmUniform = 
mt->getOrCreateStateSet()->getOrCreateUniform(
"oldModelMatrix", 
osg::Uniform::Type::FLOAT_MAT4, 1);

modelMatrixUniformMap[mmUniform] = modifiedMatrixTransforms;

for (unsigned int cid = 0; cid < childCount; ++cid) {
buildModelMatrixUniformMap(group->getChild(cid),
modifiedMatrixTransforms);
}

return;
}

for (unsigned int cid = 0; cid < childCount; ++cid) {
buildModelMatrixUniformMap(group->getChild(cid), 
matrixTransforms);
}

}




Thank you!

Cheers,
Philipp

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67747#67747





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