Re: [osg-users] Rendering a Depthmap

2019-06-12 Thread Trajce Nikolov NICK
Hi Lucas,

I have this working (Lidar scans simulation). If you post snippets I might
be able to help you. You can private msg me too

Cheers
Nick

On Wed, Jun 12, 2019 at 2:25 PM Glenn Waldron  wrote:

> Lucas,
> Just guessing, but it sounds like you are experiencing a problem knows as
> "shadow acne." There's a good explanation of it here along with some
> possible mitigation ideas. Very common problem when projecting a depth map
> back onto the main camera.
>
>
> http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-16-shadow-mapping/
>
>
> Glenn Waldron
>
>
> On Wed, Jun 12, 2019 at 6:47 AM Lucas Amparo 
> wrote:
>
>> Hi, everyone
>>
>> I'm trying to render a depthmap using shaders. Very simple, just using
>> the distance from an arbitrary point P to the camera's eye. That map will
>> be deprojected into a pointcloud.
>>
>> The problem is an unexpected (by me lol) behavior from the deprojection.
>> Using a tutorial (can't post links yet), I've done the work but the result
>> seems weird.
>>
>> For example, if I had a perfect wall on the scene, the depthmap is
>> projected similar to a "rinnegan" (do you remember naruto? Is the best way
>> to represent the problem )
>>
>> Someone already did something similar to that? What's the best way to
>> make a depthmap on OSG? Tutorials, examples, books are very welcomed.
>>
>> Thank you!
>>
>> Cheers,
>> Lucas
>>
>> --
>> Read this topic online here:
>> http://forum.openscenegraph.org/viewtopic.php?p=76186#76186
>>
>>
>>
>>
>>
>> ___
>> 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
>


-- 
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] Rendering a Depthmap

2019-06-12 Thread Glenn Waldron
Lucas,
Just guessing, but it sounds like you are experiencing a problem knows as
"shadow acne." There's a good explanation of it here along with some
possible mitigation ideas. Very common problem when projecting a depth map
back onto the main camera.

http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-16-shadow-mapping/


Glenn Waldron


On Wed, Jun 12, 2019 at 6:47 AM Lucas Amparo 
wrote:

> Hi, everyone
>
> I'm trying to render a depthmap using shaders. Very simple, just using the
> distance from an arbitrary point P to the camera's eye. That map will be
> deprojected into a pointcloud.
>
> The problem is an unexpected (by me lol) behavior from the deprojection.
> Using a tutorial (can't post links yet), I've done the work but the result
> seems weird.
>
> For example, if I had a perfect wall on the scene, the depthmap is
> projected similar to a "rinnegan" (do you remember naruto? Is the best way
> to represent the problem )
>
> Someone already did something similar to that? What's the best way to make
> a depthmap on OSG? Tutorials, examples, books are very welcomed.
>
> Thank you!
>
> Cheers,
> Lucas
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=76186#76186
>
>
>
>
>
> ___
> 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] Rendering a Depthmap

2019-06-12 Thread Lucas Amparo
Hi, everyone

I'm trying to render a depthmap using shaders. Very simple, just using the 
distance from an arbitrary point P to the camera's eye. That map will be 
deprojected into a pointcloud.

The problem is an unexpected (by me lol) behavior from the deprojection. Using 
a tutorial (can't post links yet), I've done the work but the result seems 
weird.

For example, if I had a perfect wall on the scene, the depthmap is projected 
similar to a "rinnegan" (do you remember naruto? Is the best way to represent 
the problem )

Someone already did something similar to that? What's the best way to make a 
depthmap on OSG? Tutorials, examples, books are very welcomed.

Thank you!

Cheers,
Lucas

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





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


[osg-users] Add multiple OverlayNode.

2019-06-12 Thread Atlas Simen
Hi,

How do I add multiple OverlayNode to a scene? I read the post "Viewer with 2 
overlay nodes", using setOverlayTextureUnit to distinguish each OverlayNode, 
but this is limited by the number of multiple texture units supported. On my 
desktop, the number of multiple texture units supported by the graphics card is 
4, and the maximum available texture unit is 3, which means I can only add 3 
OverlayNode to the scene at most.


Code:

osg::ref_ptr baseModel = createBase(osg::Vec3(center.x(), 
center.y(), baseHeight),radius);
osg::ref_ptr movingModel = createMovingModel(center,radius*0.8f);

osg::ref_ptr baseModel2 = createBase(osg::Vec3(center.x() + radius * 
2, center.y() + radius * 0, baseHeight), radius);
osg::ref_ptr movingModel2 = createMovingModel(osg::Vec3(center.x() + 
radius * 2, center.y() + radius * 0, center.z()), radius*0.8f);

if (overlay)
{
osgSim::OverlayNode* overlayNode = new osgSim::OverlayNode(technique);
overlayNode->setContinuousUpdate(true);
overlayNode->setOverlaySubgraph(movingModel);
overlayNode->setOverlayBaseHeight(baseHeight-0.01);
overlayNode->setOverlayTextureUnit(1);//default
overlayNode->addChild(baseModel);
root->addChild(overlayNode);

osgSim::OverlayNode* overlayNode2 = new osgSim::OverlayNode(technique);
overlayNode2->setContinuousUpdate(true);
overlayNode2->setOverlaySubgraph(movingModel2);
overlayNode2->setOverlayBaseHeight(baseHeight - 0.01);
overlayNode->setOverlayTextureUnit(2);
overlayNode2->addChild(baseModel2);
root->addChild(overlayNode2);
}
else
{
root->addChild(baseModel);
root->addChild(baseModel2);
}

root->addChild(movingModel);
root->addChild(movingModel2);


 

Thank you!

Cheers,
Simen

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



/* OpenSceneGraph example, osganimate.
*
*  Permission is hereby granted, free of charge, to any person obtaining a copy
*  of this software and associated documentation files (the "Software"), to deal
*  in the Software without restriction, including without limitation the rights
*  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
*  copies of the Software, and to permit persons to whom the Software is
*  furnished to do so, subject to the following conditions:
*
*  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
*  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
*  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
*  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
*  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
*  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
*  THE SOFTWARE.
*/

#include 
#include 
#include 
#include 
#include 

#include 

#include 
#include 
#include 

#include 
#include 
#include 

#include 

#include 
#include 

osg::AnimationPath* createAnimationPath(const osg::Vec3& center,float 
radius,double looptime)
{
// set up the animation path
osg::AnimationPath* animationPath = new osg::AnimationPath;
animationPath->setLoopMode(osg::AnimationPath::LOOP);

int numSamples = 40;
float yaw = 0.0f;
float yaw_delta = 2.0f*osg::PI/((float)numSamples-1.0f);
float roll = osg::inDegrees(30.0f);

double time=0.0f;
double time_delta = looptime/(double)numSamples;
for(int i=0;iinsert(time,osg::AnimationPath::ControlPoint(position,rotation));

yaw += yaw_delta;
time += time_delta;

}
return animationPath;
}

osg::Node* createBase(const osg::Vec3& center,float radius)
{



int numTilesX = 10;
int numTilesY = 10;

float width = 2*radius;
float height = 2*radius;

osg::Vec3 v000(center - osg::Vec3(width*0.5f,height*0.5f,0.0f));
osg::Vec3 dx(osg::Vec3(width/((float)numTilesX),0.0,0.0f));
osg::Vec3 dy(osg::Vec3(0.0f,height/((float)numTilesY),0.0f));

// fill in vertices for grid, note numTilesX+1 * numTilesY+1...
osg::Vec3Array* coords = new osg::Vec3Array;
int iy;
for(iy=0;iy<=numTilesY;++iy)
{
for(int ix=0;ix<=numTilesX;++ix)
{
coords->push_back(v000+dx*(float)ix+dy*(float)iy);
}
}

//Just two colours - black and white.
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); // white
colors->push_back(osg::Vec4(0.0f,0.0f,0.0f,1.0f)); // black

osg::ref_ptr whitePrimitives = new 
osg::DrawElementsUShort(GL_QUADS);
osg::ref_ptr blackPrimitives = new 
osg::DrawElementsUShort(GL_QUADS);

int numIndicesPerRow=numTilesX+1;
for(iy=0;iypush_back(ix+(iy+1)*numIndicesPerRow);
primitives->push_back(ix+iy*numIndicesPerRow);
primitives->push_back((ix+1)+iy*numIndicesPerRow);
primitives->push_back((ix+1)+(iy+1)*numIndicesPerRow);
}
}

// set up a single normal
osg::Vec3Array* normals = new osg::Vec3Array;
   

Re: [osg-users] Compiling osgVRPN

2019-06-12 Thread Michael W Bogucki
Hi,

Hi Guys,
I'm curious if anyone has had luck in getting osgvrpn to compile as of lately?

In terms of versions I'm using the following:

Latest pull from the vrpn git site.
OpenSceneGraph-3.6.0
osgVrpn (Hollingsworth branch of osgVRPN)


I've compiled and installed both vrpn and openscenegraph on an ubuntu (18.04) 
system.
However I get into trouble when compling osgvrpn.


Building the osgvrpn libraries is fine, however when I get to the examples, in 
particular osgVRPNviewer, I see a lot of:


Code:

CMakeFiles/osgVRPNviewer.dir/osgVRPNviewer.cpp.o: In function `main':
osgVRPNviewer.cpp:(.text+0x104e): undefined reference to 
`osgViewer::Viewer::Viewer()'
osgVRPNviewer.cpp:(.text+0x1072): undefined reference to 
`osgViewer::Viewer::getUsage(osg::ApplicationUsage&) const'
osgVRPNviewer.cpp:(.text+0x1285): undefined reference to 
`osgGA::StateSetManipulator::StateSetManipulator(osg::StateSet*)'
osgVRPNviewer.cpp:(.text+0x129d): undefined reference to 
`osgViewer::View::addEventHandler(osgGA::EventHandler*)'
osgVRPNviewer.cpp:(.text+0x12c7): undefined reference to 
`osgViewer::HelpHandler::HelpHandler(osg::ApplicationUsage*)'
osgVRPNviewer.cpp:(.text+0x12df): undefined reference to 
`osgViewer::View::addEventHandler(osgGA::EventHandler*)'
osgVRPNviewer.cpp:(.text+0x12f4): undefined reference to 
`osgViewer::ThreadingHandler::ThreadingHandler()'
osgVRPNviewer.cpp:(.text+0x130c): undefined reference to 
`osgViewer::View::addEventHandler(osgGA::EventHandler*)'
osgVRPNviewer.cpp:(.text+0x1321): undefined reference to 
`osgViewer::WindowSizeHandler::WindowSizeHandler()'
osgVRPNviewer.cpp:(.text+0x1339): undefined reference to 
`osgViewer::View::addEventHandler(osgGA::EventHandler*)'
osgVRPNviewer.cpp:(.text+0x134e): undefined reference to 
`osgViewer::StatsHandler::StatsHandler()'

../../bin/libosgVRPN.so: undefined reference to `q_from_axis_angle'
../../bin/libosgVRPN.so: undefined reference to 
`osgGA::CameraManipulator::computeHomePosition(osg::Camera const*, bool)'
../../bin/libosgVRPN.so: undefined reference to 
`osgGA::CameraManipulator::handle(osgGA::GUIEventAdapter const&, 
osgGA::GUIActionAdapter&)'




I'm wondering if things have changed enough that this won't compile with the 
current versions.
Is this a lost cause??

Any help would be appreciated.
Thank you.
--Mike


Thank you!

Cheers,
Michael

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




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


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