Re: [osg-users] [3rdparty] New OpenSceneGraph and Newton Dynamics 3.13 physics engine integration.

2013-11-14 Thread Chris Hanson
Cool! How does it compare with osgBullet's integration? You guys should
consider cooperating to see if there is anything you can share. It would be
nice if an osg app could use either engine without too much pain.


On Thu, Nov 14, 2013 at 8:29 PM, michael kapelko  wrote:

> Nice!
> I wish you could make a video to depict that.
>
>
> 2013/11/15 Julio Jerez 
>
>> Hello
>>
>> I'm happy to announce a new Open Scene Graph tool.
>>
>> The name is osgNewton and can be acquired here:
>>
>> http://code.google.com/p/osgnewton/
>>
>>
>>
>> This is a wrapper that integrates Newton Dynamics version 3.13 physics
>> engine with OSG.
>>
>> The integration is 100% non intrusive, and it is implementing with a
>> series of lightweight classes
>>
>> with the same look feel of OSG interface.
>>
>> If you know C++ and OSG, then you can use this physics solution.
>>
>>
>>
>> Among other features osgNewton offer:
>>
>>
>>
>> -Synchronous or concurrent with graphics physic updates.
>>
>> -Multithreaded physics simulation.
>>
>> -Very accurate and stable physical behaviors.
>>
>> -All standard collision primitives plus some special ones,
>>
>> -Automatic convex decomposition of complex osg nodes
>>
>> -All standard joints all with limit and motors, also including special
>> ones like Relational  joint and Robotic actuators.
>>
>>
>>
>> For more information and questions for can go to:
>>
>> http://newtondynamics.com/forum/viewtopic.php?f=2&t=7662&p=53859#p53859
>>
>>
>>
>> The wrapper comes with 5 basic demos exposing test cases of how to put
>> things together.
>>
>>
>>
>> In the near future I will be adding more demos exposing more
>> functionality like: soft bodies, cloth, destruction and vehicles.
>>
>> Thank you
>>
>>
>>
>> Julio Jerez
>>
>> ___
>> 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
>
>


-- 
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
Digital Imaging • GIS • GPS • osgEarth • Terrain • Telemetry • Cryptography
• Digital Audio • LIDAR • Kinect • 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


Re: [osg-users] [3rdparty] New OpenSceneGraph and Newton Dynamics 3.13 physics engine integration.

2013-11-14 Thread michael kapelko
Nice!
I wish you could make a video to depict that.


2013/11/15 Julio Jerez 

> Hello
>
> I'm happy to announce a new Open Scene Graph tool.
>
> The name is osgNewton and can be acquired here:
>
> http://code.google.com/p/osgnewton/
>
>
>
> This is a wrapper that integrates Newton Dynamics version 3.13 physics
> engine with OSG.
>
> The integration is 100% non intrusive, and it is implementing with a
> series of lightweight classes
>
> with the same look feel of OSG interface.
>
> If you know C++ and OSG, then you can use this physics solution.
>
>
>
> Among other features osgNewton offer:
>
>
>
> -Synchronous or concurrent with graphics physic updates.
>
> -Multithreaded physics simulation.
>
> -Very accurate and stable physical behaviors.
>
> -All standard collision primitives plus some special ones,
>
> -Automatic convex decomposition of complex osg nodes
>
> -All standard joints all with limit and motors, also including special
> ones like Relational  joint and Robotic actuators.
>
>
>
> For more information and questions for can go to:
>
> http://newtondynamics.com/forum/viewtopic.php?f=2&t=7662&p=53859#p53859
>
>
>
> The wrapper comes with 5 basic demos exposing test cases of how to put
> things together.
>
>
>
> In the near future I will be adding more demos exposing more functionality
> like: soft bodies, cloth, destruction and vehicles.
>
> Thank you
>
>
>
> Julio Jerez
>
> ___
> 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


[osg-users] Preloading PagedLod's in ScreenCapture

2013-11-14 Thread Tisham Dhar
Hi,

I am attempting to preload pagedlods (as per osgPoster) by sub-classing the 
ScreenCaptureHandler and adding the addCull/removeCull callbacks. Has this been 
done already ? The callBacks don't seem to be triggered during screenCapture. 
The subclassed (and very indiscriminately copy-pasted screencapturehandler is 
attached).

Cheers,
whatnick.

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




Attachments: 
http://forum.openscenegraph.org//files/aeroscreenhandler_876.cpp
http://forum.openscenegraph.org//files/aeroscreenhandler_125.h


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


Re: [osg-users] [osgOcean] Regulate the Ocean Reflection intensity.

2013-11-14 Thread Tisham Dhar
Hi,

I have successfully implemented a changing reflection intensity by adding
1) Multiplier to env_map
2) Creating a uniform corresponding to the multiplier in the shader
3) Setting this uniform via stateset and creating a corresponding variable in 
FFTOceanSurface.

SVN diff to release tag attached.

Cheers, 

whatnick.

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




Attachments: 
http://forum.openscenegraph.org//files/refelection_var_diff_551.txt


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


Re: [osg-users] Reusing depth buffer for render targets

2013-11-14 Thread Farshid Lashkari
Support for 32-bit depth buffers is driver dependent. I believe some will
fallback on 24-bit if 32-bit is not supported.


On Thu, Nov 14, 2013 at 3:49 PM, Bram Vaessen wrote:

> Thanks, that makes perfect sense. I didn't know it was normalized, so I
> just have to make sure the camera's have the same clipping planes, didn't
> need to increase it to 10 (my scene is much smaller than that :)
> The depth buffer is based on 32 bits floats right (just for my
> information)?
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=57223#57223
>
>
>
>
>
> ___
> 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] Reusing depth buffer for render targets

2013-11-14 Thread Bram Vaessen
Thanks, that makes perfect sense. I didn't know it was normalized, so I just 
have to make sure the camera's have the same clipping planes, didn't need to 
increase it to 10 (my scene is much smaller than that :)
The depth buffer is based on 32 bits floats right (just for my information)?

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





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


Re: [osg-users] Reusing depth buffer for render targets

2013-11-14 Thread Farshid Lashkari
Hi Bram,

Sorry, I misunderstood your question.

The values in the depth buffer are normalized based on the near/far clip
planes. If you are automatically computing the near/far planes, then they
can end up being different for each camera, which causes the depth test for
the water scene to be computed incorrectly. Disabling computing of near/far
and forcing the same clip plane values should ensure proper depth testing
between the two cameras. Does that make sense?

Cheers,
Farshid


On Thu, Nov 14, 2013 at 2:50 PM, Bram Vaessen wrote:

> Farshid, I should have been more clear about it, but that was actually my
> intention. The terrain and water are in the same world so i wanted to use
> the depth information from the terrain render to draw only visible portions
> of the water to the other buffer.
>
> Sebastian, I always get this error: "Warning: detected OpenGL error
> 'invalid framebuffer operation' at After Renderer::compile" but I got this
> from the very beginning of when I started on the project, when I didn't
> have any framebuffers or anything else for that matter, it was just always
> there from the first time I used OSG. I tried looking it up but nobody on
> the forum could help me with it, and it doesn't seem to do any harm...
>
> for the buffers and resulations, let me just paste the code here, this is
> how I set them up:
>
>
> Code:
> //set up fragment color raster
> osg::TextureRectangle* colorsRect;
> colorsRect = new osg::TextureRectangle;
> colorsRect->setTextureSize(screenWidth, screenHeight);
> colorsRect->setInternalFormat(GL_RGBA32F_ARB);
> colorsRect->setSourceFormat(GL_RGBA);
> colorsRect->setSourceType(GL_FLOAT);
>
> colorsRect->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST);
>
> colorsRect->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST);
>
> //set up fragement normal raster
> osg::TextureRectangle* normalsRect;
> normalsRect = new osg::TextureRectangle;
> normalsRect->setTextureSize(screenWidth, screenHeight);
> normalsRect->setInternalFormat(GL_RGBA32F_ARB);
> normalsRect->setSourceFormat(GL_RGBA);
> normalsRect->setSourceType(GL_FLOAT);
>
> normalsRect->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST);
>
> normalsRect->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST);
>
> //set up fragment coordinate raster
> osg::TextureRectangle* positionsRect;
> positionsRect = new osg::TextureRectangle;
> positionsRect->setTextureSize(screenWidth, screenHeight);
> positionsRect->setInternalFormat(GL_RGBA32F_ARB);
> positionsRect->setSourceFormat(GL_RGBA);
> positionsRect->setSourceType(GL_FLOAT);
>
> positionsRect->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST);
>
> positionsRect->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST);
>
> //set up fragment color raster 2 for water
> osg::TextureRectangle* waterRect;
> waterRect = new osg::TextureRectangle;
> waterRect->setTextureSize(screenWidth, screenHeight);
> waterRect->setInternalFormat(GL_RGBA32F_ARB);
> waterRect->setSourceFormat(GL_RGBA);
> waterRect->setSourceType(GL_FLOAT);
>
> waterRect->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST);
>
> waterRect->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST);
>
> //set up a depth buffer to be reused in two cameras
> osg::Texture2D* depthBuffer;
> depthBuffer = new osg::Texture2D;
> depthBuffer->setTextureSize(screenWidth, screenHeight);
> depthBuffer->setInternalFormat(GL_DEPTH_COMPONENT32);
> depthBuffer->setSourceFormat(GL_DEPTH_COMPONENT);
> depthBuffer->setSourceType(GL_FLOAT);
>
>
>
>
> > add the depth texture as input
> > sampler to the consecutive passes if they use it for writing.
>
>
> do you mean as a texture? I tried
>
> waterCamera->getOrCreateStateSet()->setTextureAttributeAndModes(0,
> depthBuffer, osg::StateAttribute::ON);
>
> but that didn't help.
>
> I was looking at it again and it looked like it was clipping when I moved
> the camera around, so I tried this (also for the other camera):
>
>
> worldCamera->setComputeNearFarMode(osg::CullSettings::ComputeNearFarMode::DO_NOT_COMPUTE_NEAR_FAR);
> worldCamera->setProjectionMatrixAsPerspective(30.0, 16.f/9.f, 0.1,
> 10);
>
> that seems to solve it! I suppose the clipping was causing it, but not
> sure how exactly. Would be helpful if I understood what was happening
> exactly, any idea?
>
> Thanks :)
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=57221#57221
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-use

Re: [osg-users] Reusing depth buffer for render targets

2013-11-14 Thread Bram Vaessen
Farshid, I should have been more clear about it, but that was actually my 
intention. The terrain and water are in the same world so i wanted to use the 
depth information from the terrain render to draw only visible portions of the 
water to the other buffer.

Sebastian, I always get this error: "Warning: detected OpenGL error 'invalid 
framebuffer operation' at After Renderer::compile" but I got this from the very 
beginning of when I started on the project, when I didn't have any framebuffers 
or anything else for that matter, it was just always there from the first time 
I used OSG. I tried looking it up but nobody on the forum could help me with 
it, and it doesn't seem to do any harm...

for the buffers and resulations, let me just paste the code here, this is how I 
set them up:


Code:
//set up fragment color raster
osg::TextureRectangle* colorsRect;
colorsRect = new osg::TextureRectangle;
colorsRect->setTextureSize(screenWidth, screenHeight);
colorsRect->setInternalFormat(GL_RGBA32F_ARB);
colorsRect->setSourceFormat(GL_RGBA);
colorsRect->setSourceType(GL_FLOAT);

colorsRect->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST);
colorsRect->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST);

//set up fragement normal raster
osg::TextureRectangle* normalsRect;
normalsRect = new osg::TextureRectangle;
normalsRect->setTextureSize(screenWidth, screenHeight);
normalsRect->setInternalFormat(GL_RGBA32F_ARB);
normalsRect->setSourceFormat(GL_RGBA);
normalsRect->setSourceType(GL_FLOAT);
normalsRect->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST);
normalsRect->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST);

//set up fragment coordinate raster
osg::TextureRectangle* positionsRect;
positionsRect = new osg::TextureRectangle;
positionsRect->setTextureSize(screenWidth, screenHeight);
positionsRect->setInternalFormat(GL_RGBA32F_ARB);
positionsRect->setSourceFormat(GL_RGBA);
positionsRect->setSourceType(GL_FLOAT);

positionsRect->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST);

positionsRect->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST);

//set up fragment color raster 2 for water
osg::TextureRectangle* waterRect;
waterRect = new osg::TextureRectangle;
waterRect->setTextureSize(screenWidth, screenHeight);
waterRect->setInternalFormat(GL_RGBA32F_ARB);
waterRect->setSourceFormat(GL_RGBA);
waterRect->setSourceType(GL_FLOAT);

waterRect->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST);
waterRect->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST);

//set up a depth buffer to be reused in two cameras
osg::Texture2D* depthBuffer;
depthBuffer = new osg::Texture2D;
depthBuffer->setTextureSize(screenWidth, screenHeight);
depthBuffer->setInternalFormat(GL_DEPTH_COMPONENT32);
depthBuffer->setSourceFormat(GL_DEPTH_COMPONENT);
depthBuffer->setSourceType(GL_FLOAT);




> add the depth texture as input 
> sampler to the consecutive passes if they use it for writing.


do you mean as a texture? I tried 

waterCamera->getOrCreateStateSet()->setTextureAttributeAndModes(0, depthBuffer, 
osg::StateAttribute::ON);

but that didn't help.

I was looking at it again and it looked like it was clipping when I moved the 
camera around, so I tried this (also for the other camera):


worldCamera->setComputeNearFarMode(osg::CullSettings::ComputeNearFarMode::DO_NOT_COMPUTE_NEAR_FAR);
worldCamera->setProjectionMatrixAsPerspective(30.0, 16.f/9.f, 0.1, 
10); 

that seems to solve it! I suppose the clipping was causing it, but not sure how 
exactly. Would be helpful if I understood what was happening exactly, any idea?

Thanks :)

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





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


Re: [osg-users] Reusing depth buffer for render targets

2013-11-14 Thread Sebastian Messerschmidt

Hi Bram,

From my experience you should always add the depth texture as input 
sampler to the consecutive passes if they use it for writing.

That sounds weird but solved those issues for me.
Also keep in mind that all buffers should have the same resolution (i.e. 
as you are using sampleRect). Do you get any errors from the framebuffer 
setup?

Hi,

I'm trying to reuse a depth buffer for rendering two different passes. The 
first one does terrain, the second one some water surface (to another output 
buffer, but that's not the issue here)

Based on posts from the forum I though I had it figured out but it doesn't work 
well. Depending on how I move the camera in my application, it either looks 
like the depth buffer was not used at all (I see water everywhere), or it works 
as expected, or sometimes something in between, some parts seem to be 
non-rendered as they should but not everywhere. I wonder if I did anything 
wrong, here is the code I used, any comments would be useful, thanks!



Code:
//set up a depth buffer to be reused in two cameras
osg::Texture2D* depthBuffer;
depthBuffer = new osg::Texture2D;
 depthBuffer->setTextureSize(screenWidth, screenHeight);
 depthBuffer->setInternalFormat(GL_DEPTH_COMPONENT32);
depthBuffer->setSourceFormat(GL_DEPTH_COMPONENT);
depthBuffer->setSourceType(GL_FLOAT);





//set up the world (scene) camera
osg::ref_ptr worldCamera = new osg::Camera();
worldCamera->setViewport(new 
osg::Viewport(0,0,screenWidth,screenHeight));
worldCamera->setProjectionMatrixAsPerspective(30.0, 16.f/9.f, 0.5, 
1);
worldCamera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//camera->setClearColor(fog->getFogColor());
worldCamera->setClearColor(osg::Vec4(0,0,0,0));
worldCamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
worldCamera->setRenderOrder(osg::Camera::PRE_RENDER,0);

worldCamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
worldCamera->addChild(worldNode); //add the world to the world camera

worldCamera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER0), 
colorsRect);

worldCamera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER1), 
normalsRect);

worldCamera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER2), 
positionsRect);
worldCamera->attach(osg::Camera::DEPTH_BUFFER, depthBuffer);



//set up the water surface camera
osg::ref_ptr waterCamera = new osg::Camera();
waterCamera->setViewport(new 
osg::Viewport(0,0,screenWidth,screenHeight));
waterCamera->setProjectionMatrixAsPerspective(30.0, 16.f/9.f, 0.5, 
1);
waterCamera->setClearMask(GL_COLOR_BUFFER_BIT);
waterCamera->setClearColor(osg::Vec4(0,0,0,0));
waterCamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
waterCamera->setRenderOrder(osg::Camera::PRE_RENDER,1);

waterCamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
waterCamera->addChild(waterNode);

waterCamera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER0), 
waterRect);
waterCamera->attach(osg::Camera::DEPTH_BUFFER, depthBuffer);

...


rootNode->addChild(worldCamera);
rootNode->addChild(waterCamera);





Thank you!

Cheers,
Bram

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





___
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] Reusing depth buffer for render targets

2013-11-14 Thread Farshid Lashkari
Hi Bram,

The water camera is not clearing the depth buffer, which means it will be
performing depth tests against the depth values from the world camera. Try
setting the clear mask for the water camera to the following:

waterCamera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

Cheers,
Farshid



On Thu, Nov 14, 2013 at 2:09 PM, Bram Vaessen wrote:

> Hi,
>
> I'm trying to reuse a depth buffer for rendering two different passes. The
> first one does terrain, the second one some water surface (to another
> output buffer, but that's not the issue here)
>
> Based on posts from the forum I though I had it figured out but it doesn't
> work well. Depending on how I move the camera in my application, it either
> looks like the depth buffer was not used at all (I see water everywhere),
> or it works as expected, or sometimes something in between, some parts seem
> to be non-rendered as they should but not everywhere. I wonder if I did
> anything wrong, here is the code I used, any comments would be useful,
> thanks!
>
>
>
> Code:
> //set up a depth buffer to be reused in two cameras
> osg::Texture2D* depthBuffer;
> depthBuffer = new osg::Texture2D;
> depthBuffer->setTextureSize(screenWidth, screenHeight);
> depthBuffer->setInternalFormat(GL_DEPTH_COMPONENT32);
> depthBuffer->setSourceFormat(GL_DEPTH_COMPONENT);
> depthBuffer->setSourceType(GL_FLOAT);
>
>
> 
>
>
> //set up the world (scene) camera
> osg::ref_ptr worldCamera = new osg::Camera();
> worldCamera->setViewport(new
> osg::Viewport(0,0,screenWidth,screenHeight));
> worldCamera->setProjectionMatrixAsPerspective(30.0, 16.f/9.f, 0.5,
> 1);
> worldCamera->setClearMask(GL_COLOR_BUFFER_BIT |
> GL_DEPTH_BUFFER_BIT);
> //camera->setClearColor(fog->getFogColor());
> worldCamera->setClearColor(osg::Vec4(0,0,0,0));
> worldCamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
> worldCamera->setRenderOrder(osg::Camera::PRE_RENDER,0);
>
> worldCamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
> worldCamera->addChild(worldNode); //add the world to the world
> camera
>
> worldCamera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER0),
> colorsRect);
>
> worldCamera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER1),
> normalsRect);
>
> worldCamera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER2),
> positionsRect);
> worldCamera->attach(osg::Camera::DEPTH_BUFFER, depthBuffer);
>
>
>
> //set up the water surface camera
> osg::ref_ptr waterCamera = new osg::Camera();
> waterCamera->setViewport(new
> osg::Viewport(0,0,screenWidth,screenHeight));
> waterCamera->setProjectionMatrixAsPerspective(30.0, 16.f/9.f, 0.5,
> 1);
> waterCamera->setClearMask(GL_COLOR_BUFFER_BIT);
> waterCamera->setClearColor(osg::Vec4(0,0,0,0));
> waterCamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
> waterCamera->setRenderOrder(osg::Camera::PRE_RENDER,1);
>
> waterCamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
> waterCamera->addChild(waterNode);
>
> waterCamera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER0),
> waterRect);
> waterCamera->attach(osg::Camera::DEPTH_BUFFER, depthBuffer);
>
> ...
>
>
> rootNode->addChild(worldCamera);
> rootNode->addChild(waterCamera);
>
>
>
>
>
> Thank you!
>
> Cheers,
> Bram
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=57218#57218
>
>
>
>
>
> ___
> 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


[osg-users] Reusing depth buffer for render targets

2013-11-14 Thread Bram Vaessen
Hi,

I'm trying to reuse a depth buffer for rendering two different passes. The 
first one does terrain, the second one some water surface (to another output 
buffer, but that's not the issue here)

Based on posts from the forum I though I had it figured out but it doesn't work 
well. Depending on how I move the camera in my application, it either looks 
like the depth buffer was not used at all (I see water everywhere), or it works 
as expected, or sometimes something in between, some parts seem to be 
non-rendered as they should but not everywhere. I wonder if I did anything 
wrong, here is the code I used, any comments would be useful, thanks!



Code:
//set up a depth buffer to be reused in two cameras
osg::Texture2D* depthBuffer;
depthBuffer = new osg::Texture2D;
depthBuffer->setTextureSize(screenWidth, screenHeight);
depthBuffer->setInternalFormat(GL_DEPTH_COMPONENT32);
depthBuffer->setSourceFormat(GL_DEPTH_COMPONENT);
depthBuffer->setSourceType(GL_FLOAT);





//set up the world (scene) camera
osg::ref_ptr worldCamera = new osg::Camera();
worldCamera->setViewport(new 
osg::Viewport(0,0,screenWidth,screenHeight));
worldCamera->setProjectionMatrixAsPerspective(30.0, 16.f/9.f, 0.5, 
1); 
worldCamera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//camera->setClearColor(fog->getFogColor());
worldCamera->setClearColor(osg::Vec4(0,0,0,0));
worldCamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
worldCamera->setRenderOrder(osg::Camera::PRE_RENDER,0);

worldCamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
worldCamera->addChild(worldNode); //add the world to the world camera

worldCamera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER0), 
colorsRect);

worldCamera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER1), 
normalsRect);

worldCamera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER2), 
positionsRect);
worldCamera->attach(osg::Camera::DEPTH_BUFFER, depthBuffer);



//set up the water surface camera
osg::ref_ptr waterCamera = new osg::Camera();
waterCamera->setViewport(new 
osg::Viewport(0,0,screenWidth,screenHeight));
waterCamera->setProjectionMatrixAsPerspective(30.0, 16.f/9.f, 0.5, 
1); 
waterCamera->setClearMask(GL_COLOR_BUFFER_BIT);
waterCamera->setClearColor(osg::Vec4(0,0,0,0));
waterCamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
waterCamera->setRenderOrder(osg::Camera::PRE_RENDER,1);

waterCamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
waterCamera->addChild(waterNode); 

waterCamera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER0), 
waterRect);
waterCamera->attach(osg::Camera::DEPTH_BUFFER, depthBuffer);

...


rootNode->addChild(worldCamera);
rootNode->addChild(waterCamera);





Thank you!

Cheers,
Bram

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





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


[osg-users] [3rdparty] New OpenSceneGraph and Newton Dynamics 3.13 physics engine integration.

2013-11-14 Thread Julio Jerez
Hello

I'm happy to announce a new Open Scene Graph tool.

The name is osgNewton and can be acquired here:

http://code.google.com/p/osgnewton/



This is a wrapper that integrates Newton Dynamics version 3.13 physics
engine with OSG.

The integration is 100% non intrusive, and it is implementing with a series
of lightweight classes

with the same look feel of OSG interface.

If you know C++ and OSG, then you can use this physics solution.



Among other features osgNewton offer:



-Synchronous or concurrent with graphics physic updates.

-Multithreaded physics simulation.

-Very accurate and stable physical behaviors.

-All standard collision primitives plus some special ones,

-Automatic convex decomposition of complex osg nodes

-All standard joints all with limit and motors, also including special ones
like Relational  joint and Robotic actuators.



For more information and questions for can go to:

http://newtondynamics.com/forum/viewtopic.php?f=2&t=7662&p=53859#p53859



The wrapper comes with 5 basic demos exposing test cases of how to put
things together.



In the near future I will be adding more demos exposing more functionality
like: soft bodies, cloth, destruction and vehicles.

Thank you



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


Re: [osg-users] Collision detection using osgBullets

2013-11-14 Thread Paul Martz
My guess is that you've somehow created the collision shapes as static
instead of dynamic. Bullet uses the static classification for objects that
never move. If you have two objects that never move, Bullet will assume
they never collide.

Although I've done quite a bit of work in the past with Bullet and
osgBullet, I would not consider myself a Bullet expert. This is really just
a guess. Since the warning comes from Bullet, the Bullet forum might be a
better place. osgBullet also has its own discussion group.


On Thu, Nov 14, 2013 at 7:56 AM, Mots G  wrote:

> Hi all,
> I'm trying to use osgBullets in my application for collision detection.
> The library comes with a sample example for detection between two
> box-geodes.
> I've modified it to use a cessna and a cow model and obtained a
> 'btCollisionObject' by calling:
>
> *osgbCollision::btCompoundShapeFromOSGGeodes(cess_model,COMPOUND_SHAPE_PROXYTYPE
> )*
>
> However, the collision detection does not happen and I'm unable to figure
> out what's going wrong.
> I also get a warning "warning btCollisionDispatcher::needsCollision:
> static-static collision".
>
> Sorry for the noob question but I'm trying to get this feature in my app
> and using the bullet/osgBullet library for the first time. Also I'm not
> sure if this question belongs here or to another forum.
> Inconvenience regretted.
>
> Best regards,
> Mots
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


-- 
Paul Martz
Skew Matrix Software LLC
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Model attached to Camera

2013-11-14 Thread Trajce Nikolov NICK
Hi Robert,

thanks for the hint. I don't have CameraManipulator. Anyway I made it work
with HUD like approach.

Thanks again

Nick


On Thu, Nov 14, 2013 at 2:55 PM, Robert Milharcic <
robert.milhar...@ib-caddy.si> wrote:

> On 14.11.2013 11:32, Trajce Nikolov NICK wrote:
>
>> It doesn't look right. What is wrong with this code? Also, there is some
>> delay (when I don't apply the orientation just for debug), the model when
>> attached is sort of delayed following the camera. Any hints?
>>
>
> Hi Nick,
>
> I'm just guessing here, but if model is delayed, it probably means that
> camera's view matrix wasn't updated yet. If I remember correctly, Viewer
> will update its camera by calling cameraManipulator->updateCamera()
> somewhere in the update traversal too... so, maybe node callback is called
> before updateCamera()? Maybe you could cast camera->getView() to
> osg::Viewer::View and then call getViewerBase(), cast it to proper Viewer
> and call viewer->getCameraManipulator()->updateCamera() ...
>
> Robert Milharcic
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



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


[osg-users] Collision detection using osgBullets

2013-11-14 Thread Mots G
Hi all,
I'm trying to use osgBullets in my application for collision detection. The
library comes with a sample example for detection between two box-geodes.
I've modified it to use a cessna and a cow model and obtained a
'btCollisionObject' by calling:

*osgbCollision::btCompoundShapeFromOSGGeodes(cess_model,COMPOUND_SHAPE_PROXYTYPE
)*

However, the collision detection does not happen and I'm unable to figure
out what's going wrong.
I also get a warning "warning btCollisionDispatcher::needsCollision:
static-static collision".

Sorry for the noob question but I'm trying to get this feature in my app
and using the bullet/osgBullet library for the first time. Also I'm not
sure if this question belongs here or to another forum.
Inconvenience regretted.

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


Re: [osg-users] Model attached to Camera

2013-11-14 Thread Robert Milharcic

On 14.11.2013 11:32, Trajce Nikolov NICK wrote:

It doesn't look right. What is wrong with this code? Also, there is some
delay (when I don't apply the orientation just for debug), the model when
attached is sort of delayed following the camera. Any hints?


Hi Nick,

I'm just guessing here, but if model is delayed, it probably means that 
camera's view matrix wasn't updated yet. If I remember correctly, Viewer 
will update its camera by calling cameraManipulator->updateCamera() 
somewhere in the update traversal too... so, maybe node callback is 
called before updateCamera()? Maybe you could cast camera->getView() to 
osg::Viewer::View and then call getViewerBase(), cast it to proper 
Viewer and call viewer->getCameraManipulator()->updateCamera() ...


Robert Milharcic

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


Re: [osg-users] Model attached to Camera

2013-11-14 Thread Trajce Nikolov NICK
I gave up on this approach. Used another Camera that mimic HUD but with
Prespective projection. Works now. Have to learn to stress less when
looking for answers :-)

Cheers,

Nick


On Thu, Nov 14, 2013 at 1:32 PM, Trajce Nikolov NICK <
trajce.nikolov.n...@gmail.com> wrote:

> Hi Community,
>
> I would like to do this mentioned in the subject and I am facing issues.
> Sounds pretty simple but need help.
>
> The model is attached to osg::MatrixTransform and I have
> osg::UpdateCallback attached to it that sets the Matrix based on the
> camera. So here is the snippet from the callback:
>
> osg::MatrixTransform* mxt = dynamic_cast(node);
>
> osg::Vec3 pos = camera->getInverseViewMatrix().getTrans();
> osg::Quat rot = camera->getInverseViewMatrix().getRotate();
>
> mxt->setMatrix(osg::Matrix::rotate(rot)*osg::Matrix::translate(pos)).
>
> It doesn't look right. What is wrong with this code? Also, there is some
> delay (when I don't apply the orientation just for debug), the model when
> attached is sort of delayed following the camera. Any hints?
>
> Thanks a bunch
>
> Nick
>
> --
> trajce nikolov nick
>



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


[osg-users] Model attached to Camera

2013-11-14 Thread Trajce Nikolov NICK
Hi Community,

I would like to do this mentioned in the subject and I am facing issues.
Sounds pretty simple but need help.

The model is attached to osg::MatrixTransform and I have
osg::UpdateCallback attached to it that sets the Matrix based on the
camera. So here is the snippet from the callback:

osg::MatrixTransform* mxt = dynamic_cast(node);

osg::Vec3 pos = camera->getInverseViewMatrix().getTrans();
osg::Quat rot = camera->getInverseViewMatrix().getRotate();

mxt->setMatrix(osg::Matrix::rotate(rot)*osg::Matrix::translate(pos)).

It doesn't look right. What is wrong with this code? Also, there is some
delay (when I don't apply the orientation just for debug), the model when
attached is sort of delayed following the camera. Any hints?

Thanks a bunch

Nick

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


Re: [osg-users] flickering with live video feed

2013-11-14 Thread Robert Osfield
Hi Mike,

On 13 November 2013 20:30, Michael Schanne wrote:

> Hi Robert,
>
> What it looks like is different geometry in the scene will turn black for
> a split second, then change back to their normal color.  This will happen
> to random geometry at random intervals, but the interval is short (less
> than a second).  It is not limited to the video texture.  In fact it will
> occur even if the video is not visible (i.e. it is outside the view
> frustum) and it also affects geometry that the video texture is not applied
> to, whether or not they are within the boundary of the video projection.
>
> I also have a StatsHandler attached to my viewer; when turned on, the
> statistics will disappear for a split second and then reappear.
>

It is starting to sound a bit like a driver bug.

Does the texture get applied to the whole scene?

One thing you could try is to only apply the problem texture to a specific
geometry and make sure the texture unit it's applied is disabled for the
rest of the scene.

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