Re: [osg-users] light lobes and shadow maps

2010-01-15 Thread Trajce Nikolov
Hi Joseelin,

that not really a fix. I ll post the code and you see. I can have up to 7
light lobes in the scene but I am working on unlimited light lobes.

Nick

http://www.linkedin.com/in/tnick


On Thu, Jan 14, 2010 at 11:42 PM, josselin.pe...@lcpc.fr wrote:

 Hi Nick,

 This is not really an answer to your question, but for my application I
 used an attenuation factor (proportional to the squared distance) to avoid
 light behind obstacles (obstacles are generally far from my lights in my
 application). Maybe you can use one too.

 By the way, could you tell me how many lights you have?

 Josselin.

 
 This message was sent using IMP, the Internet Messaging Program.


 ___
 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] Viewport inheritance and RTT

2010-01-15 Thread Robert Osfield
Hi Brad,

I've read this thread and a bit suprised that the RTT Camera's
Viewport wasn't being used.  Which version of the OSG are you working
with? I wonder if this is a bug in a older version of the OSG or
something still lurking in the OSG.

The way that the viewports are intended to be inherited is from above
such that if the RTT Camera doesn't have it's own viewport then it
should inherit this from it's the nearest camera in it's parental
chain.  If the RTT Camera does define it's own viewport then this
should be used and there shouldn't be a need to provide one via a
StateSet.  This is working from memory though... this is how it should
work, hopefully the code should be doing this as well ;-)

Cheers,
Robert.

On Fri, Jan 15, 2010 at 6:11 AM, Christiansen, Brad
brad.christian...@thalesgroup.com.au wrote:
 Hi,

 For the record, I have found a workaround for the issue.

 To fix the problem, I did the following the RTT Camera:

 ss = rttCamera-getOrCreateStateSet();
 osg::Viewport* vp = new osg::Viewport(0,0,textureSize,textureSize);
 ss-setAttributeAndModes(vp, osg::StateAttribute::OVERRIDE 
 osg::StateAttribute::ON);


 It was my understanding that this would have the same effect as just
 setting on the viewport on the camera. However, this works, but just
 setting the viewport doesn't.

 Cheers,

 Brad

 -Original Message-
 From: osg-users-boun...@lists.openscenegraph.org
 [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of
 Christiansen, Brad
 Sent: Friday, 15 January 2010 8:55 AM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] Viewport inheritance and RTT

 Hi,

 Thanks for your answer.

 In relation to your comment:

 I'm still not sure why you want to use a slave? I remember something
 you
 said about shadows, but don't understand why shadows should differ
 between slave/not slave. Pre-render should work fine with just an RTT
 camera placed somewhere in the graph and in this case you can set
 everything manually.

 I am using an RTT camera placed somewhere in the graph and I am setting
 everything manually. As far as I can tell I am using a very simple,
 basic case for RTT (it doesn't actually involve shadows). This is why I
 am so stuck on what can be going wrong.

 I will modify one of the examples to match what I am doing so I can
 examine the issue in a very simple setup and go from there. I am really
 stuck on what to do to try and fix this. Thanks again for your help.

 Cheers,

 Brad


 -Original Message-
 From: osg-users-boun...@lists.openscenegraph.org
 [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of J.P.
 Delport
 Sent: Thursday, 14 January 2010 4:11 PM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] Viewport inheritance and RTT

 Hi,

 Christiansen, Brad wrote:
 Hi,

 Just 'resubmitting' my issue with a more simple question to see if
 anyone has any ideas.

 What are the rules with viewport inheritance?
 - My understanding is:
 If a camera has a viewport set, this is used when rendering the
 cameras
 sub-graph. If it is not set, it uses the parent cameras viewport.

 - What I am seeing:
 My pre-render camera (rendering to a texture) has a viewport set but
 its
 sub-graph is being rendered using its parent cameras viewport. I have
 double checked that the viewport is set during the cull traversal. The
 pre-render cameras viewport is placed on the stack, and set on the
 RenderStage used to render the camera, yet it is still rendered using
 the parents viewport.

 - My question/s:
 What could cause this to occur? i.e. when is a local viewport ignored
 and 'overridden' by a parents viewport.

 What should I look at to debug this? I am not sure what to check after
 seeing the Renderstage apparently setup correctly.

 sorry, I can't answer all your questions.

 I don't think this goes as deep as renderstage. Have a look at View and
 Viewer and check the handling of slaves. Check where addSlave adds the
 View and then check where the list of views is used.


 I am completely stumped now and this is proving a bit of a
 show-stopper
 for me. Any suggestions on what to look at would be greatly
 appreciated.

 I'm still not sure why you want to use a slave? I remember something you

 said about shadows, but don't understand why shadows should differ
 between slave/not slave. Pre-render should work fine with just an RTT
 camera placed somewhere in the graph and in this case you can set
 everything manually.

 jp



 Cheers,

 Brad

 -Original Message-
 From: osg-users-boun...@lists.openscenegraph.org
 [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of
 Christiansen, Brad
 Sent: Tuesday, 12 January 2010 10:59 AM
 To: OpenSceneGraph Users
 Subject: [osg-users] Viewport inheritance and RTT

 Hi,

 I have a scene setup with a texture attached to a camera which is
 setup
 for pre-rendering.
 In my scene I set the viewport for the RTT camera to the dimensions of
 the texture. Despite having done this, the viewport for the RTT 

Re: [osg-users] light lobes and shadow maps

2010-01-15 Thread Trajce Nikolov
Hi Guys,

here is the code.

Nick

http://www.linkedin.com/in/tnick
Sent from Devlet, Ankara, Turkey

On Thu, Jan 14, 2010 at 11:42 PM, Wojciech Lewandowski 
lewandow...@ai.com.pl wrote:

  Hi Nick,

 Post the troublesome code and elaborate a bit more about the problem. If
 its really a minute or two I am sure someone will be able to help.

 Wojtek Lewandowski

  *From:* Trajce Nikolov nikolov.tra...@gmail.com
 *Sent:* Thursday, January 14, 2010 8:58 PM
 *To:* OpenSceneGraph Users osg-users@lists.openscenegraph.org
 *Subject:* [osg-users] light lobes and shadow maps

 Hi community,

 I have some shader that does some lighting in the scene. Now studying
 osgShadow and the techniques. I want to a shadow map technique to disable
 the lightening of the scene behind obstacles. I have some code done, but not
 working. I need some help, someone experienced with GLSL to spend a minute
 or to to have a look and if possible to spot the problem. Anyone?

 Thanks a lot

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Izmit, 41, Turkey

 --

 ___
 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


/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 
 *
 * This application is open source and may be redistributed and/or modified   
 * freely and without restriction, both in commericial and non commericial 
applications,
 * as long as this copyright notice is maintained.
 * 
 * This application is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/

#include osgDB/ReadFile
#include osgDB/WriteFile
#include osgUtil/Optimizer
#include osg/CoordinateSystemNode

#include osg/Switch
#include osg/LightSource
#include osgText/Text

#include osgViewer/Viewer
#include osgViewer/CompositeViewer
#include osgViewer/ViewerEventHandlers

#include osgGA/TrackballManipulator
#include osgGA/FlightManipulator
#include osgGA/DriveManipulator
#include osgGA/KeySwitchMatrixManipulator
#include osgGA/StateSetManipulator
#include osgGA/AnimationPathManipulator
#include osgGA/TerrainManipulator

#include osgSim/OverlayNode
#include osg/Geode
#include osgText/Text3D
#include osg/MatrixTransform
#include osg/ShapeDrawable
#include osg/TexGen
#include osg/TexGenNode

#include iostream
#include sstream

#include osg/Geometry
#include osg/Geode
#include osg/LightSource
#include osg/LightModel
#include osg/Program
#include osg/ImageStream
#include osg/TextureRectangle
#include osg/TexMat
#include osg/BlendFunc
#include osg/AlphaFunc
#include osg/Material

#include osgUtil/SmoothingVisitor
#include osg/ShapeDrawable

#include osg/PositionAttitudeTransform
#include osg/TextureRectangle

#if 1
osg::Matrixd createTransformMatrix(double x, double y, double z, double h, 
double p, double r)
{
osg::Matrixd mxR;
mxR.makeRotate(osg::DegreesToRadians(r),osg::Vec3(0,1,0));
osg::Matrixd mxP;
mxP.makeRotate(osg::DegreesToRadians(p),osg::Vec3(1,0,0));
osg::Matrixd mxH;
mxH.makeRotate(osg::DegreesToRadians(h),osg::Vec3(0,0,1));
osg::Matrixd mxT;
mxT.makeTranslate(osg::Vec3(x,y,z));

return (mxR*mxP*mxH*mxT);
}

osg::Node* makeFrustumFromCamera( osg::Camera* camera )
{
// Projection and ModelView matrices
osg::Matrixd proj;
osg::Matrixd mv;
if (camera)
{
proj = camera-getProjectionMatrix();
mv = camera-getViewMatrix();
}
else
{
// Create some kind of reasonable default Projection matrix.
proj.makePerspective( 30., 1., 1., 10. );
// leave mv as identity
}

// Get near and far from the Projection matrix.
const double near = proj(3,2) / (proj(2,2)-1.0);
const double far = proj(3,2) / (1.0+proj(2,2));

// Get the sides of the near plane.
const double nLeft = near * (proj(2,0)-1.0) / proj(0,0);
const double nRight = near * (1.0+proj(2,0)) / proj(0,0);
const double nTop = near * (1.0+proj(2,1)) / proj(1,1);
const double nBottom = near * (proj(2,1)-1.0) / proj(1,1);

// Get the sides of the far plane.
const double fLeft = far * (proj(2,0)-1.0) / proj(0,0);
const double fRight = far * (1.0+proj(2,0)) / proj(0,0);
const double fTop = far * (1.0+proj(2,1)) / proj(1,1);
const double fBottom = far * (proj(2,1)-1.0) / proj(1,1);

// Our vertex array needs only 9 vertices: The origin, and the
// eight corners of the near and far planes.
osg::Vec3Array* v = new osg::Vec3Array;
v-resize( 9 );
(*v)[0].set( 0., 0., 0. );
(*v)[1].set( nLeft, nBottom, -near );
(*v)[2].set( nRight, 

Re: [osg-users] light lobes and shadow maps

2010-01-15 Thread Trajce Nikolov
ABout the code. I use shader to simulate lght lobes thru phong lighting in
the shader. Then I use shadow maps to detect the area behind the obstacles
that need not to be lighten. Most is mixture of shadow maps technique with
lighting scheme. Code snippets borrowed from all around

Nick

http://www.linkedin.com/in/tnick
Sent from Devlet, Ankara, Turkey

On Fri, Jan 15, 2010 at 10:54 AM, Trajce Nikolov
nikolov.tra...@gmail.comwrote:

 Hi Guys,

 here is the code.

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

 On Thu, Jan 14, 2010 at 11:42 PM, Wojciech Lewandowski 
 lewandow...@ai.com.pl wrote:

  Hi Nick,

 Post the troublesome code and elaborate a bit more about the problem. If
 its really a minute or two I am sure someone will be able to help.

 Wojtek Lewandowski

  *From:* Trajce Nikolov nikolov.tra...@gmail.com
 *Sent:* Thursday, January 14, 2010 8:58 PM
 *To:* OpenSceneGraph Users osg-users@lists.openscenegraph.org
 *Subject:* [osg-users] light lobes and shadow maps

 Hi community,

 I have some shader that does some lighting in the scene. Now studying
 osgShadow and the techniques. I want to a shadow map technique to disable
 the lightening of the scene behind obstacles. I have some code done, but not
 working. I need some help, someone experienced with GLSL to spend a minute
 or to to have a look and if possible to spot the problem. Anyone?

 Thanks a lot

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Izmit, 41, Turkey

 --

 ___
 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 mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] osgWidget::input work

2010-01-15 Thread Trajce Nikolov
Hi,

I started with implementing my extension to osgWidget::Input to make more
well known edit box alike. Further might come up with text editor. However,
I started the osgwidgetinput example and for some reason it is not getting
my input from the keyboard. Have you experienced this? I am on Windows7
Nick

http://www.linkedin.com/in/tnick
Sent from Devlet, Ankara, Turkey
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] how to compile osg2.96 under WINCE

2010-01-15 Thread yang zhiyuan
Hi:
   I see that osg2.96 can support OpenGL ES now,I would like to try compile
osg2.96 for WINCE6.0,but I do not konw how to compile under wince6.0.
   Should all 3party dependecy be recompiled with deployment device:wince
device 5.0 under visual studio 2005.

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


Re: [osg-users] how to compile osg2.96 under WINCE

2010-01-15 Thread Robert Osfield
Hi Zhi Yuan,

On Fri, Jan 15, 2010 at 9:44 AM, yang zhiyuan yangzy...@gmail.com wrote:
    I see that osg2.96 can support OpenGL ES now,I would like to try compile
 osg2.96 for WINCE6.0,but I do not konw how to compile under wince6.0.
    Should all 3party dependecy be recompiled with deployment device:wince
 device 5.0 under visual studio 2005.

You are the first user to come forward to discuss WinCE support so
you'll breaking new ground for the project ;-)

I don't personally have any experience with WinCE, and actually very
little under Windows so can't help with the specifics of how to tackle
the port.  I can provide guidance on the OSG/OpenGL ES side, and also
will be happy to reivew changes and merge changes into svn/trunk to
make the port run smoothly.  To be able to get WinCE support
integrated into snv/trunk would be great.

For the initial port, on the 3rd party dependency front I would
suggest considering them as optional extras - as the core parts of the
OSG don't require them.  For emdedded apps you are likely to have more
constrained and tailored datasets than you'd have on the desktop so
you can probably get away surprisingly well without the dependencies.
Later on if you need the dependencies then you could possible look at
the CMake ports project as there is chance that this might help with
porting, or just tackle each of the dependencies that you actually
require.

A quick search on the web for Cmake + WinCE does reveal that Cmake
should be able to support you OK.  When configuring the OSG build
you'll want to set the various options related to OpenGLES to make
sure you get the right GL features compiled in.  Details can be found
on the page:

   http://www.openscenegraph.org/projects/osg/wiki/Community/OpenGL-ES

Have you tried an initial port yet?

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


[osg-users] Feedback sought on future of osgIntrospection

2010-01-15 Thread Robert Osfield
Hi All,

I would like feedback from members of the community on whether the use
osgIntrospection, and if so how.  I get the sense that this particular
component of the OSG is not widely used, and largely ignored by
projects that are providing integration of the OSG with other
programming languages.  I would like feedback on why this is.

I am currently reviewing Wang Rui's excellent efforts on a new
extensible native ascii and binary format, that looks well placed to
replace the existing .osg and .ive formats as the standard file
formats for the OSG.  This means we'd be able to deprecate the old
.osg and .ive formats and just keep this for backwards compatibility
for those who need it.  Wang Rui's work provides hand built wrappers
for class properties, the wrappers are actually more straight forward
to develop and maintain than either the .osg or .ive wrappers, and of
relevance to this thread, potentially opens the door for a generic
scheme for access classing properties that use these wrappers.  Could
the new scheme deprecate much of the features of osgIntrospection as
well as the old .osg and .ive formats?

osgIntrospection does of course provide more than just ability to set
and get properties, it enables you to call methods as well, is this
critical?  Could this be added to Wang Rui's new plugin?  What parts
of osgIntrospection do you use now?  What parts are critical?

Given the potential of these various developments and the what appears
to me a relative lack of activity around osgIntrospection I'm
wondering whether we should slim the core OSG distribution down by
moving osgIntrospection and the associated wrappers out into a
separate distribution that wraps up genwrapper, osgIntrospection and
the wrappers into a single package that can maintained independently,
but in sync with OSG distributions.

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


Re: [osg-users] Is PolytopeIntersector a good choice for multiple selection?

2010-01-15 Thread Peter Hrenka

Hi Neil,

Neil Clayton schrieb:

Hi,

I've a scene with only a handful of Geodes (under 200). 
If I wanted to detect which objects were selected within a 2D rectangle on screen (think clicking, holding, dragging out a rectangle over the view) - would a PolytopeIntersector be a good choice?



Code:

osgUtil::PolytopeIntersector *picker = new osgUtil::PolytopeIntersector(cf,
fmin(downX, lastX), 
fmin(downY, lastY),

fmax(downX, lastX),
fmax(downY, lastY));
osgUtil::IntersectionVisitor iv(picker);
view-getCamera()-accept(iv);
if(picker-containsIntersections()) {
   // do stuff
}




I ask because I've tried (using the above) - where downX/Y are filled in on 
mouse down - and as soon as the selection encompasses a number of geodes it 
really slows down, considerably (I'm doing this every time the mouse position 
changes, e.g: ::DRAG).  I suspect I'm doing something wrong / using the 
polytope incorrectly perhaps?


The main problem with PoltopeIntersector is that it generates large 
amounts of result data if it is used with large picking volumes.


The typical usage (as shown in osgkeyboardmouse example) is
picking small volumes where only a handful of picks occur.

But you are not the first one that tries to use it with larger volumes...


Any pointers?


One possible optimization I can think of is changing the result
data structure in such a way that it only stores the intersecting
node-path and the first intersecting primitive. This data should
be enough for your usage pattern. The detailed result data could
be generated in an extra step (at a cost).


I'm considering using a nodemask to only examine the few things I need to test 
for (ends up being about 12 quads). But wondering if I'm doing things 
incorrectly from the outset...


Using an invisible (via nodemask) picking geometry is certainly an
option.



Cheers,
Neil


Cheers,

Peter

--
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Roland Niemeier, 
Dr. Arno Steitz, Dr. Ingrid Zech

Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Michel Lepert
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196 



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


Re: [osg-users] light lobes and shadow maps

2010-01-15 Thread Wojciech Lewandowski
Trajce,

Attached is a fixed source code. There is a lots of shadow shimmering on my 
GF8800. You will have to add some depth bias while rendering shadow map. 
Selection proper PolygonOffset values is usually a matter of trial and error so 
leave this for you.

Wojtek

- Original Message - 
  From: Trajce Nikolov 
  To: OpenSceneGraph Users 
  Sent: Friday, January 15, 2010 9:58 AM
  Subject: Re: [osg-users] light lobes and shadow maps


  ABout the code. I use shader to simulate lght lobes thru phong lighting in 
the shader. Then I use shadow maps to detect the area behind the obstacles that 
need not to be lighten. Most is mixture of shadow maps technique with lighting 
scheme. Code snippets borrowed from all around

  Nick

  http://www.linkedin.com/in/tnick
  Sent from Devlet, Ankara, Turkey 


  On Fri, Jan 15, 2010 at 10:54 AM, Trajce Nikolov nikolov.tra...@gmail.com 
wrote:

Hi Guys,


here is the code.

Nick

http://www.linkedin.com/in/tnick

Sent from Devlet, Ankara, Turkey 



On Thu, Jan 14, 2010 at 11:42 PM, Wojciech Lewandowski 
lewandow...@ai.com.pl wrote:

  Hi Nick,

  Post the troublesome code and elaborate a bit more about the problem. If 
its really a minute or two I am sure someone will be able to help.

  Wojtek Lewandowski


  From: Trajce Nikolov 
  Sent: Thursday, January 14, 2010 8:58 PM
  To: OpenSceneGraph Users 
  Subject: [osg-users] light lobes and shadow maps


  Hi community,

  I have some shader that does some lighting in the scene. Now studying 
osgShadow and the techniques. I want to a shadow map technique to disable the 
lightening of the scene behind obstacles. I have some code done, but not 
working. I need some help, someone experienced with GLSL to spend a minute or 
to to have a look and if possible to spot the problem. Anyone?

  Thanks a lot

  Nick

  http://www.linkedin.com/in/tnick
  Sent from Izmit, 41, Turkey 


--


  ___
  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 mailing list
  osg-users@lists.openscenegraph.org
  http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 
 *
 * This application is open source and may be redistributed and/or modified   
 * freely and without restriction, both in commericial and non commericial 
applications,
 * as long as this copyright notice is maintained.
 * 
 * This application is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/

#include osgDB/ReadFile
#include osgDB/WriteFile
#include osgUtil/Optimizer
#include osg/CoordinateSystemNode

#include osg/Switch
#include osg/LightSource
#include osgText/Text

#include osgViewer/Viewer
#include osgViewer/CompositeViewer
#include osgViewer/ViewerEventHandlers

#include osgGA/TrackballManipulator
#include osgGA/FlightManipulator
#include osgGA/DriveManipulator
#include osgGA/KeySwitchMatrixManipulator
#include osgGA/StateSetManipulator
#include osgGA/AnimationPathManipulator
#include osgGA/TerrainManipulator

#include osgSim/OverlayNode
#include osg/Geode
#include osgText/Text3D
#include osg/MatrixTransform
#include osg/ShapeDrawable
#include osg/TexGen
#include osg/TexGenNode

#include iostream
#include sstream

#include osg/Geometry
#include osg/Geode
#include osg/LightSource
#include osg/LightModel
#include osg/Program
#include osg/ImageStream
#include osg/TextureRectangle
#include osg/TexMat
#include osg/BlendFunc
#include osg/AlphaFunc
#include osg/Material

#include osgUtil/SmoothingVisitor
#include osg/ShapeDrawable

#include osg/PositionAttitudeTransform
#include osg/TextureRectangle

#if 1
osg::Matrixd createTransformMatrix(double x, double y, double z, double h, 
double p, double r)
{
osg::Matrixd mxR;
mxR.makeRotate(osg::DegreesToRadians(r),osg::Vec3(0,1,0));
osg::Matrixd mxP;
mxP.makeRotate(osg::DegreesToRadians(p),osg::Vec3(1,0,0));
osg::Matrixd mxH;
mxH.makeRotate(osg::DegreesToRadians(h),osg::Vec3(0,0,1));
osg::Matrixd mxT;
mxT.makeTranslate(osg::Vec3(x,y,z));

return (mxR*mxP*mxH*mxT);
}

osg::Node* makeFrustumFromCamera( osg::Camera* camera )
{
// Projection and ModelView matrices
osg::Matrixd proj;
osg::Matrixd mv;

Re: [osg-users] light lobes and shadow maps

2010-01-15 Thread Trajce Nikolov
Hey Wojtek  Thanks a lot. !! I will tune it to fix the shimmering


Nick

http://www.linkedin.com/in/tnick


On Fri, Jan 15, 2010 at 3:08 PM, Wojciech Lewandowski lewandow...@ai.com.pl
 wrote:

  Trajce,

 Attached is a fixed source code. There is a lots of shadow shimmering on my
 GF8800. You will have to add some depth bias while rendering shadow map.
 Selection proper PolygonOffset values is usually a matter of trial and error
 so leave this for you.

 Wojtek

 - Original Message -

 *From:* Trajce Nikolov nikolov.tra...@gmail.com
 *To:* OpenSceneGraph Users osg-users@lists.openscenegraph.org
 *Sent:* Friday, January 15, 2010 9:58 AM
 *Subject:* Re: [osg-users] light lobes and shadow maps

 ABout the code. I use shader to simulate lght lobes thru phong lighting in
 the shader. Then I use shadow maps to detect the area behind the obstacles
 that need not to be lighten. Most is mixture of shadow maps technique with
 lighting scheme. Code snippets borrowed from all around

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

 On Fri, Jan 15, 2010 at 10:54 AM, Trajce Nikolov nikolov.tra...@gmail.com
  wrote:

 Hi Guys,

 here is the code.

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

 On Thu, Jan 14, 2010 at 11:42 PM, Wojciech Lewandowski 
 lewandow...@ai.com.pl wrote:

  Hi Nick,

 Post the troublesome code and elaborate a bit more about the problem. If
 its really a minute or two I am sure someone will be able to help.

 Wojtek Lewandowski

  *From:* Trajce Nikolov nikolov.tra...@gmail.com
 *Sent:* Thursday, January 14, 2010 8:58 PM
 *To:* OpenSceneGraph Users osg-users@lists.openscenegraph.org
 *Subject:* [osg-users] light lobes and shadow maps

 Hi community,

 I have some shader that does some lighting in the scene. Now studying
 osgShadow and the techniques. I want to a shadow map technique to disable
 the lightening of the scene behind obstacles. I have some code done, but not
 working. I need some help, someone experienced with GLSL to spend a minute
 or to to have a look and if possible to spot the problem. Anyone?

 Thanks a lot

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Izmit, 41, Turkey

 --

 ___
 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 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 mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] light lobes and shadow maps

2010-01-15 Thread Trajce Nikolov
one more question. What are the possible values for shadow2DProj(
shadow_texture, projShadow ).r ? I am trying to put the light attenuation
back . and to avoid the shimmering
Nick

http://www.linkedin.com/in/tnick
Sent from Devlet, Ankara, Turkey

On Fri, Jan 15, 2010 at 3:35 PM, Trajce Nikolov nikolov.tra...@gmail.comwrote:

 Hey Wojtek  Thanks a lot. !! I will tune it to fix the shimmering


 Nick

 http://www.linkedin.com/in/tnick


 On Fri, Jan 15, 2010 at 3:08 PM, Wojciech Lewandowski 
 lewandow...@ai.com.pl wrote:

  Trajce,

 Attached is a fixed source code. There is a lots of shadow shimmering on
 my GF8800. You will have to add some depth bias while rendering shadow map.
 Selection proper PolygonOffset values is usually a matter of trial and error
 so leave this for you.

 Wojtek

 - Original Message -

 *From:* Trajce Nikolov nikolov.tra...@gmail.com
 *To:* OpenSceneGraph Users osg-users@lists.openscenegraph.org
 *Sent:* Friday, January 15, 2010 9:58 AM
 *Subject:* Re: [osg-users] light lobes and shadow maps

 ABout the code. I use shader to simulate lght lobes thru phong lighting in
 the shader. Then I use shadow maps to detect the area behind the obstacles
 that need not to be lighten. Most is mixture of shadow maps technique with
 lighting scheme. Code snippets borrowed from all around

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

 On Fri, Jan 15, 2010 at 10:54 AM, Trajce Nikolov 
 nikolov.tra...@gmail.com wrote:

 Hi Guys,

 here is the code.

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

 On Thu, Jan 14, 2010 at 11:42 PM, Wojciech Lewandowski 
 lewandow...@ai.com.pl wrote:

  Hi Nick,

 Post the troublesome code and elaborate a bit more about the problem. If
 its really a minute or two I am sure someone will be able to help.

 Wojtek Lewandowski

  *From:* Trajce Nikolov nikolov.tra...@gmail.com
 *Sent:* Thursday, January 14, 2010 8:58 PM
 *To:* OpenSceneGraph Users osg-users@lists.openscenegraph.org
 *Subject:* [osg-users] light lobes and shadow maps

 Hi community,

 I have some shader that does some lighting in the scene. Now studying
 osgShadow and the techniques. I want to a shadow map technique to disable
 the lightening of the scene behind obstacles. I have some code done, but 
 not
 working. I need some help, someone experienced with GLSL to spend a minute
 or to to have a look and if possible to spot the problem. Anyone?

 Thanks a lot

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Izmit, 41, Turkey

 --

 ___
 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 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 mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] light lobes and shadow maps

2010-01-15 Thread Trajce Nikolov
Also, my intension is not to render the shadow map at all, only to use it
for fragment test (in lighten and not lighten zone). From where this
shimmering is coming ?
Nick

http://www.linkedin.com/in/tnick
Sent from Devlet, Ankara, Turkey

On Fri, Jan 15, 2010 at 3:46 PM, Trajce Nikolov nikolov.tra...@gmail.comwrote:

 one more question. What are the possible values for shadow2DProj(
 shadow_texture, projShadow ).r ? I am trying to put the light attenuation
 back . and to avoid the shimmering

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

 On Fri, Jan 15, 2010 at 3:35 PM, Trajce Nikolov 
 nikolov.tra...@gmail.comwrote:

 Hey Wojtek  Thanks a lot. !! I will tune it to fix the shimmering


 Nick

 http://www.linkedin.com/in/tnick


 On Fri, Jan 15, 2010 at 3:08 PM, Wojciech Lewandowski 
 lewandow...@ai.com.pl wrote:

  Trajce,

 Attached is a fixed source code. There is a lots of shadow shimmering on
 my GF8800. You will have to add some depth bias while rendering shadow map.
 Selection proper PolygonOffset values is usually a matter of trial and error
 so leave this for you.

 Wojtek

 - Original Message -

 *From:* Trajce Nikolov nikolov.tra...@gmail.com
 *To:* OpenSceneGraph Users osg-users@lists.openscenegraph.org
 *Sent:* Friday, January 15, 2010 9:58 AM
 *Subject:* Re: [osg-users] light lobes and shadow maps

 ABout the code. I use shader to simulate lght lobes thru phong lighting
 in the shader. Then I use shadow maps to detect the area behind the
 obstacles that need not to be lighten. Most is mixture of shadow maps
 technique with lighting scheme. Code snippets borrowed from all around

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

 On Fri, Jan 15, 2010 at 10:54 AM, Trajce Nikolov 
 nikolov.tra...@gmail.com wrote:

 Hi Guys,

 here is the code.

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

 On Thu, Jan 14, 2010 at 11:42 PM, Wojciech Lewandowski 
 lewandow...@ai.com.pl wrote:

  Hi Nick,

 Post the troublesome code and elaborate a bit more about the problem.
 If its really a minute or two I am sure someone will be able to help.

 Wojtek Lewandowski

  *From:* Trajce Nikolov nikolov.tra...@gmail.com
 *Sent:* Thursday, January 14, 2010 8:58 PM
 *To:* OpenSceneGraph Users osg-users@lists.openscenegraph.org
 *Subject:* [osg-users] light lobes and shadow maps

 Hi community,

 I have some shader that does some lighting in the scene. Now studying
 osgShadow and the techniques. I want to a shadow map technique to disable
 the lightening of the scene behind obstacles. I have some code done, but 
 not
 working. I need some help, someone experienced with GLSL to spend a minute
 or to to have a look and if possible to spot the problem. Anyone?

 Thanks a lot

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Izmit, 41, Turkey

 --

 ___
 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 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 mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] light lobes and shadow maps

2010-01-15 Thread Wojciech Lewandowski
0.0 = shadow2DProj( shadow_texture, projShadow ).r  = 1.0 

Shimering is a result of self shadowing. Boosting  depths in shadow map with 
glPolygonOffset usuallly fixes this. There are many schools for PolygonOffset 
settings. I usually set glPolygonOffset( 1.1, 4.0 ) and draw objects with front 
face culling (see StandardShadowMap::ViewData::init(0 for details ).  But for 
this setup models need to work correctly with backface culling on. If you do 
not enforce backface culling PolygonOffset may need different initialization.

Wojtek
 
- Original Message - 
  From: Trajce Nikolov 
  To: OpenSceneGraph Users 
  Sent: Friday, January 15, 2010 2:46 PM
  Subject: Re: [osg-users] light lobes and shadow maps


  one more question. What are the possible values for shadow2DProj( 
shadow_texture, projShadow ).r ? I am trying to put the light attenuation back 
. and to avoid the shimmering
  Nick

  http://www.linkedin.com/in/tnick
  Sent from Devlet, Ankara, Turkey 


  On Fri, Jan 15, 2010 at 3:35 PM, Trajce Nikolov nikolov.tra...@gmail.com 
wrote:

Hey Wojtek  Thanks a lot. !! I will tune it to fix the shimmering



Nick

http://www.linkedin.com/in/tnick



On Fri, Jan 15, 2010 at 3:08 PM, Wojciech Lewandowski 
lewandow...@ai.com.pl wrote:

  Trajce,

  Attached is a fixed source code. There is a lots of shadow shimmering on 
my GF8800. You will have to add some depth bias while rendering shadow map. 
Selection proper PolygonOffset values is usually a matter of trial and error so 
leave this for you.

  Wojtek

  - Original Message - 
From: Trajce Nikolov 
To: OpenSceneGraph Users 
Sent: Friday, January 15, 2010 9:58 AM
Subject: Re: [osg-users] light lobes and shadow maps


ABout the code. I use shader to simulate lght lobes thru phong lighting 
in the shader. Then I use shadow maps to detect the area behind the obstacles 
that need not to be lighten. Most is mixture of shadow maps technique with 
lighting scheme. Code snippets borrowed from all around 

Nick

http://www.linkedin.com/in/tnick
Sent from Devlet, Ankara, Turkey 


On Fri, Jan 15, 2010 at 10:54 AM, Trajce Nikolov 
nikolov.tra...@gmail.com wrote:

  Hi Guys, 


  here is the code.

  Nick

  http://www.linkedin.com/in/tnick

  Sent from Devlet, Ankara, Turkey 



  On Thu, Jan 14, 2010 at 11:42 PM, Wojciech Lewandowski 
lewandow...@ai.com.pl wrote:

Hi Nick,

Post the troublesome code and elaborate a bit more about the 
problem. If its really a minute or two I am sure someone will be able to help.

Wojtek Lewandowski


From: Trajce Nikolov 
Sent: Thursday, January 14, 2010 8:58 PM
To: OpenSceneGraph Users 
Subject: [osg-users] light lobes and shadow maps


Hi community,

I have some shader that does some lighting in the scene. Now 
studying osgShadow and the techniques. I want to a shadow map technique to 
disable the lightening of the scene behind obstacles. I have some code done, 
but not working. I need some help, someone experienced with GLSL to spend a 
minute or to to have a look and if possible to spot the problem. Anyone?

Thanks a lot

Nick

http://www.linkedin.com/in/tnick
Sent from Izmit, 41, Turkey 





___
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 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 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] PagedLod dataBasePager memory managment

2010-01-15 Thread Vincent Bourdier

Hi,

Some more informations I do not understand.

Each time I get a crash I have the following log :

HANDLE_NON_HTTP: _pager-_requestList.size()= 11 to delete = 0
In DatabasePager thread readNodeFile(Z:\data\cache\s13/V53S9_H.ive)
HANDLE_NON_HTTP: _pager-_requestList.size()= 10 to delete = 0
In DatabasePager thread readNodeFile(Z:\data\cache\s23/V57S4_H.ive)
HANDLE_NON_HTTP: _pager-_requestList.size()= 9 to delete = 0
HANDLE_NON_HTTP: _pager-_requestList.size()= 8 to delete = 0
HANDLE_NON_HTTP: _pager-_requestList.size()= 7 to delete = 0
HANDLE_NON_HTTP: _pager-_requestList.size()= 6 to delete = 0
HANDLE_NON_HTTP: _pager-_requestList.size()= 5 to delete = 0
HANDLE_NON_HTTP: _pager-_requestList.size()= 4 to delete = 0
HANDLE_NON_HTTP: _pager-_requestList.size()= 3 to delete = 0
HANDLE_NON_HTTP: _pager-_requestList.size()= 2 to delete = 0
HANDLE_NON_HTTP: _pager-_requestList.size()= 1 to delete = 0

It finish every time with a request list size decreasing from a value to 
0, and crash on requestList.size()= 1. ...

I read the code but it it very complicated to understand for me.

Does it helps ? are these informations useful ?

Thanks.

Regards,
  Vincent.

Vincent Bourdier a écrit :

Hi Robert,

Robert Osfield a écrit :

Hi Vincent,

On Fri, Jan 8, 2010 at 2:30 PM, Vincent Bourdier
vincent.bourd...@gmail.com wrote:
 

Is there a way to manage memory usage with the load of models ?
In my case I have a lot of PagedLod to load, and my question is : is 
there a
way to know is memory is sufficient for the next PageLod higher 
level node ?
I just would like to stop the data loading when memory usage exceed 
some

point.



The DatabasePager in svn/trunk + 2.9.x has the ability to cap the
number of PagedLOD to a maximum, and automatically recycles PagedLOD
children that aren't in the current view when new PagedLOD are
required by the current view.  What this capping doesn't do is stop
the loading of new PagedLOD, so if a single view requires a PagedLOD
it will be loaded.  To set the cap level programmatically via:


viewer.getDatabasePager()-setTargetMaximumNumberOfPageLOD(targetNumOfPaged); 



Or using env var:

set OSG_MAX_PAGEDLOD=200

  


I don't understand how this is working.
If a pagedLod is required it will be loaded... but we can cap the 
number of lod...

This sounds contradictory for me.
The number of PagedLod you were speaking about is the PagedLod 
children or the number of PagedLod node in the scene ?



Another feature of svn/trunk + 2.9.x is that texture and buffer
object's pools that also provide a maximum cap on the number of
texture objects and vbo/pbo/ebo's that can be allocated at any one
time.  You can set it programmatically via:

   
osg::Texture::getTextureObjectManager(contextID)-setNumberActiveTextureObjects(targetNumBytes); 



Or using env var:

set OSG_TEXTURE_POOL_SIZE=64000

Like the PagedLOD target, the texture pool size is only a target, and
if a single frame requires more memory than this it will allocated
more memory to prevent any thrashing of memory  within a single frame.
 I did do tests with a strict limit on memory size but when a single
frame requires more than this the memory thrashing cut performance
down to a fraction of it's normal, for instance going from a solid
60Hz to 1 or 2Hz.

  


There are no textures in my scene... but this is good to know.


If you wanted the LOD control then you just implement this yourself
using osgDB::Registry::ReadFileCallback that loads the tiles and then
modifies PagedLOD that it loads that are higher than a certain
resolution.
  
Do you mean that using my own readFileCallback is not sufficient and 
I'll need to  modify PagedLod sources too ?



Thanks.

Regards,
  Vincent.


__ Information from ESET NOD32 Antivirus, version of virus 
signature database 4771 (20100114) __


The message was checked by ESET NOD32 Antivirus.

http://www.eset.com





__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4774 (20100115) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


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


Re: [osg-users] [osgOcean] osgOcean bugs(?) and questions

2010-01-15 Thread Paul Palumbo
Okay... Now that I'm understanding more of the code lately, maybe that wasn't 
the best of images to reference.

However, I'm seeing exactly the same black dots in the image when I use the 
standard oceanExample case with its sky dome and viewing above the ocean 
surface. When I turn on back face culling, I do not see the black dots. 

What does it mean to have back facing polygons when above the ocean surface? I 
can understand this when you are under the ocean surface but above.

Paul P.

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





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


Re: [osg-users] osgWidget::input work

2010-01-15 Thread Jean-Sébastien Guay

Hi Nick,

However, I started the osgwidgetinput example and for some reason it is 
not getting my input from the keyboard. 


This is the same problem I noticed in other osgWidget classes lately. 
Someone changed the signature of virtual methods in the EventInterface 
class (which Widget inherits and thus, all other Widgets too) adding a 
const, but didn't change the signature of methods that are supposed to 
overload those virtual methods in derived classes. So for example, 
EventInterface defines:


virtual bool keyDown (int, int, const WindowManager*) { return false; }
virtual bool keyUp   (int, int, const WindowManager*) { return false; }

but Input defines:

virtual bool keyUp   (int, int, WindowManager*);
virtual bool keyDown (int, int, WindowManager*);

So there is no compile error, but the base class methods are called 
instead of the derived class methods because their argument lists don't 
match.


Here's the change for Input. It would be nice to go across all osgWidget 
classes and fix this if you have the time. I already did it for Frame a 
week or so ago, and this fixes Input, but there are bound to be more.


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield 
 *
 * This library is open source and may be redistributed and/or modified under  
 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 
 * (at your option) any later version.  The full license is in LICENSE file
 * included with this distribution, and on the openscenegraph.org website.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 * OpenSceneGraph Public License for more details.
*/

// Code by: Jeremy Moles (cubicool) 2007-2008

#ifndef OSGWIDGET_INPUT
#define OSGWIDGET_INPUT

#include osgWidget/Label

namespace osgWidget {

// This is a string of values we use to try and determine the best Y
// descent value (yoffset); you're welcome to use what works best for
// your font.
const std::string DESCENT_STRING(qpl);

class OSGWIDGET_EXPORT Input: public Label
{
public:

Input(const std::string = , const std::string = , unsigned int = 
20);

virtual void parented   (Window*);
virtual void positioned ();

virtual bool focus   (const WindowManager*);
virtual bool unfocus (const WindowManager*);
virtual bool keyUp   (int, int, const WindowManager*);
virtual bool keyDown (int, int, const WindowManager*);

void setCursor(Widget*);
unsigned int calculateBestYOffset (const std::string = qgl);

void setXOffset(point_type xo) {
_xoff = xo;
}

void setYOffset(point_type yo) {
_yoff = yo;
}

void setXYOffset(point_type xo, point_type yo) {
_xoff = xo;
_yoff = yo;
}

osg::Drawable* getCursor() {
return _cursor.get();
}

const osg::Drawable* getCursor() const {
return _cursor.get();
}

point_type getXOffset() const {
return _xoff;
}

point_type getYOffset() const {
return _yoff;
}

XYCoord getXYOffset() const {
return XYCoord(_xoff, _yoff);
}

protected:
virtual void _calculateSize(const XYCoord);

void _calculateCursorOffsets();

point_type _xoff;
point_type _yoff;

unsigned int _index;
unsigned int _size;
unsigned int _cursorIndex;
unsigned int _maxSize;

std::vectorpoint_type _offsets;
osg::ref_ptrWidget_cursor;
};

}

#endif
// -*-c++-*- osgWidget - Code by: Jeremy Moles (cubicool) 2007-2008

#include osg/io_utils
#include osgWidget/WindowManager
#include osgWidget/Input

namespace osgWidget {

Input::Input(const std::string name, const std::string label, unsigned int 
size):
Label(name, label),
_xoff(0.0f), 
_yoff(0.0f),
_index   (0),
_size(0),
_cursorIndex (0),
_maxSize (size),
_cursor  (new Widget(cursor)) {
_text-setAlignment(osgText::Text::LEFT_BOTTOM_BASE_LINE);
_text-setKerningType(osgText::KERNING_NONE);

// Make the cursor un-copyable.
_cursor-setCanClone(false);
_cursor-setDataVariance(osg::Object::DYNAMIC);
_cursor-setColor(0.0f, 0.0f, 0.0f, 1.0f);

setEventMask(
// For showing/hiding the cursor.
EVENT_MASK_FOCUS |
// For keypresses, obviously.
EVENT_MASK_KEY |
// For click focusing.
EVENT_MOUSE_PUSH
);

_offsets.resize(size, 0.0f);


Re: [osg-users] PagedLod dataBasePager memory managment

2010-01-15 Thread Robert Osfield
Hi Vincent,

On Thu, Jan 14, 2010 at 5:50 PM, Vincent Bourdier
vincent.bourd...@gmail.com wrote:
 I don't understand how this is working.
 If a pagedLod is required it will be loaded... but we can cap the number of
 lod...
 This sounds contradictory for me.

The max number of PagedLOD is a target that it aims for, but if there
are more PagedLOD required for rendering the current frame then the
max will exceed this trarget, and only once the view changes to
require less PagedLOD will the total number come down again.

 If you wanted the LOD control then you just implement this yourself
 using osgDB::Registry::ReadFileCallback that loads the tiles and then
 modifies PagedLOD that it loads that are higher than a certain
 resolution.


 Do you mean that using my own readFileCallback is not sufficient and I'll
 need to  modify PagedLod sources too ?

There is no need to modify any OSG sources to adjust the LOD ranges.
The ReadFileCallback can do the actual loading of the subgraph and
then catch the and modify the LOD ranges.

Personally I'd go go using the Camera LODScale though, it's a much simpler tool.

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


Re: [osg-users] PagedLod dataBasePager memory managment

2010-01-15 Thread Robert Osfield
Hi Vincent,

No 3rd party will be able to glean what is going on your machine, with
your app, with your data.  You will at least have to provide a stack
trace.  Ideally try and recreate the crash on a standard OSG example
with standard data such as the
http://www.openscenegraph.osg/data/earth_bayarea/earth.ive database
then other will then be to try and recreate the problem first hand.

Robert.

On Fri, Jan 15, 2010 at 1:56 PM, Vincent Bourdier
vincent.bourd...@gmail.com wrote:
 Hi,

 Some more informations I do not understand.

 Each time I get a crash I have the following log :

 HANDLE_NON_HTTP: _pager-_requestList.size()= 11 to delete = 0
 In DatabasePager thread readNodeFile(Z:\data\cache\s13/V53S9_H.ive)
 HANDLE_NON_HTTP: _pager-_requestList.size()= 10 to delete = 0
 In DatabasePager thread readNodeFile(Z:\data\cache\s23/V57S4_H.ive)
 HANDLE_NON_HTTP: _pager-_requestList.size()= 9 to delete = 0
 HANDLE_NON_HTTP: _pager-_requestList.size()= 8 to delete = 0
 HANDLE_NON_HTTP: _pager-_requestList.size()= 7 to delete = 0
 HANDLE_NON_HTTP: _pager-_requestList.size()= 6 to delete = 0
 HANDLE_NON_HTTP: _pager-_requestList.size()= 5 to delete = 0
 HANDLE_NON_HTTP: _pager-_requestList.size()= 4 to delete = 0
 HANDLE_NON_HTTP: _pager-_requestList.size()= 3 to delete = 0
 HANDLE_NON_HTTP: _pager-_requestList.size()= 2 to delete = 0
 HANDLE_NON_HTTP: _pager-_requestList.size()= 1 to delete = 0

 It finish every time with a request list size decreasing from a value to 0,
 and crash on requestList.size()= 1. ...
 I read the code but it it very complicated to understand for me.

 Does it helps ? are these informations useful ?

 Thanks.

 Regards,
  Vincent.

 Vincent Bourdier a écrit :

 Hi Robert,

 Robert Osfield a écrit :

 Hi Vincent,

 On Fri, Jan 8, 2010 at 2:30 PM, Vincent Bourdier
 vincent.bourd...@gmail.com wrote:


 Is there a way to manage memory usage with the load of models ?
 In my case I have a lot of PagedLod to load, and my question is : is
 there a
 way to know is memory is sufficient for the next PageLod higher level
 node ?
 I just would like to stop the data loading when memory usage exceed some
 point.


 The DatabasePager in svn/trunk + 2.9.x has the ability to cap the
 number of PagedLOD to a maximum, and automatically recycles PagedLOD
 children that aren't in the current view when new PagedLOD are
 required by the current view.  What this capping doesn't do is stop
 the loading of new PagedLOD, so if a single view requires a PagedLOD
 it will be loaded.  To set the cap level programmatically via:


  viewer.getDatabasePager()-setTargetMaximumNumberOfPageLOD(targetNumOfPaged);

 Or using env var:

    set OSG_MAX_PAGEDLOD=200



 I don't understand how this is working.
 If a pagedLod is required it will be loaded... but we can cap the number
 of lod...
 This sounds contradictory for me.
 The number of PagedLod you were speaking about is the PagedLod children or
 the number of PagedLod node in the scene ?

 Another feature of svn/trunk + 2.9.x is that texture and buffer
 object's pools that also provide a maximum cap on the number of
 texture objects and vbo/pbo/ebo's that can be allocated at any one
 time.  You can set it programmatically via:


 osg::Texture::getTextureObjectManager(contextID)-setNumberActiveTextureObjects(targetNumBytes);

 Or using env var:

    set OSG_TEXTURE_POOL_SIZE=64000

 Like the PagedLOD target, the texture pool size is only a target, and
 if a single frame requires more memory than this it will allocated
 more memory to prevent any thrashing of memory  within a single frame.
  I did do tests with a strict limit on memory size but when a single
 frame requires more than this the memory thrashing cut performance
 down to a fraction of it's normal, for instance going from a solid
 60Hz to 1 or 2Hz.



 There are no textures in my scene... but this is good to know.

 If you wanted the LOD control then you just implement this yourself
 using osgDB::Registry::ReadFileCallback that loads the tiles and then
 modifies PagedLOD that it loads that are higher than a certain
 resolution.


 Do you mean that using my own readFileCallback is not sufficient and I'll
 need to  modify PagedLod sources too ?


 Thanks.

 Regards,
  Vincent.


 __ Information from ESET NOD32 Antivirus, version of virus
 signature database 4771 (20100114) __

 The message was checked by ESET NOD32 Antivirus.

 http://www.eset.com




 __ Information from ESET NOD32 Antivirus, version of virus signature
 database 4774 (20100115) __

 The message was checked by ESET NOD32 Antivirus.

 http://www.eset.com


 ___
 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] light lobes and shadow maps

2010-01-15 Thread Trajce Nikolov
ok .. make sense. Here is updated code, if some one wants to benefit from.
LightLobes with handling of obstacles :). Thanks to Wojiech, Robert and the
online community
Nick

http://www.linkedin.com/in/tnick
Sent from Devlet, Ankara, Turkey

On Fri, Jan 15, 2010 at 3:53 PM, Wojciech Lewandowski lewandow...@ai.com.pl
 wrote:

  0.0 = shadow2DProj( shadow_texture, projShadow ).r  = 1.0

 Shimering is a result of self shadowing. Boosting  depths in shadow map
 with glPolygonOffset usuallly fixes this. There are many schools for
 PolygonOffset settings. I usually set glPolygonOffset( 1.1, 4.0 ) and draw
 objects with front face culling (see StandardShadowMap::ViewData::init(0 for
 details ).  But for this setup models need to work correctly with backface
 culling on. If you do not enforce backface culling PolygonOffset may need
 different initialization.

 Wojtek

 - Original Message -

 *From:* Trajce Nikolov nikolov.tra...@gmail.com
 *To:* OpenSceneGraph Users osg-users@lists.openscenegraph.org
 *Sent:* Friday, January 15, 2010 2:46 PM
 *Subject:* Re: [osg-users] light lobes and shadow maps

 one more question. What are the possible values for shadow2DProj(
 shadow_texture, projShadow ).r ? I am trying to put the light attenuation
 back . and to avoid the shimmering
 Nick

 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

 On Fri, Jan 15, 2010 at 3:35 PM, Trajce Nikolov 
 nikolov.tra...@gmail.comwrote:

 Hey Wojtek  Thanks a lot. !! I will tune it to fix the shimmering


 Nick

 http://www.linkedin.com/in/tnick


   On Fri, Jan 15, 2010 at 3:08 PM, Wojciech Lewandowski 
 lewandow...@ai.com.pl wrote:

  Trajce,

 Attached is a fixed source code. There is a lots of shadow shimmering on
 my GF8800. You will have to add some depth bias while rendering shadow map.
 Selection proper PolygonOffset values is usually a matter of trial and error
 so leave this for you.

 Wojtek

 - Original Message -

 *From:* Trajce Nikolov nikolov.tra...@gmail.com
 *To:* OpenSceneGraph Users osg-users@lists.openscenegraph.org
 *Sent:* Friday, January 15, 2010 9:58 AM
 *Subject:* Re: [osg-users] light lobes and shadow maps

 ABout the code. I use shader to simulate lght lobes thru phong lighting
 in the shader. Then I use shadow maps to detect the area behind the
 obstacles that need not to be lighten. Most is mixture of shadow maps
 technique with lighting scheme. Code snippets borrowed from all around

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

 On Fri, Jan 15, 2010 at 10:54 AM, Trajce Nikolov 
 nikolov.tra...@gmail.com wrote:

 Hi Guys,

 here is the code.

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

 On Thu, Jan 14, 2010 at 11:42 PM, Wojciech Lewandowski 
 lewandow...@ai.com.pl wrote:

  Hi Nick,

 Post the troublesome code and elaborate a bit more about the problem.
 If its really a minute or two I am sure someone will be able to help.

 Wojtek Lewandowski

  *From:* Trajce Nikolov nikolov.tra...@gmail.com
 *Sent:* Thursday, January 14, 2010 8:58 PM
 *To:* OpenSceneGraph Users osg-users@lists.openscenegraph.org
 *Subject:* [osg-users] light lobes and shadow maps

 Hi community,

 I have some shader that does some lighting in the scene. Now studying
 osgShadow and the techniques. I want to a shadow map technique to disable
 the lightening of the scene behind obstacles. I have some code done, but 
 not
 working. I need some help, someone experienced with GLSL to spend a minute
 or to to have a look and if possible to spot the problem. Anyone?

 Thanks a lot

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Izmit, 41, Turkey

 --

 ___
 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 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 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


/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 
 *
 * This application is open 

Re: [osg-users] osgWidget::input work

2010-01-15 Thread Trajce Nikolov
Merhaba  Umut :),

its the google mail stuff, I guess based on the ip. I am originaly half
macedonian half czech, at present in Istanbul on a project. No idea how long
will stay here.

If you are in Istanbul we can meet to have a beer

Nick

http://www.linkedin.com/in/tnick
Sent from Devlet, Ankara, Turkey

On Fri, Jan 15, 2010 at 4:36 PM, Ümit Uzun umituzu...@gmail.com wrote:

 Hi Nikolov,

 What does  
 http://www.linkedin.com/in/tnickhttp://www.linkedin.com/in/tnickSent from 
 Devlet, Ankara, Turkey  mean. Is this undefined spam type?  Your
 location changing too fast. I am crious because I am from Turkey, too :D

 Regards.

 Ümit Uzun


 2010/1/15 Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com

  Hi Nick,


  However, I started the osgwidgetinput example and for some reason it is
 not getting my input from the keyboard.


 This is the same problem I noticed in other osgWidget classes lately.
 Someone changed the signature of virtual methods in the EventInterface class
 (which Widget inherits and thus, all other Widgets too) adding a const, but
 didn't change the signature of methods that are supposed to overload those
 virtual methods in derived classes. So for example, EventInterface defines:

 virtual bool keyDown (int, int, const WindowManager*) { return false; }
 virtual bool keyUp   (int, int, const WindowManager*) { return false; }

 but Input defines:

 virtual bool keyUp   (int, int, WindowManager*);
 virtual bool keyDown (int, int, WindowManager*);

 So there is no compile error, but the base class methods are called
 instead of the derived class methods because their argument lists don't
 match.

 Here's the change for Input. It would be nice to go across all osgWidget
 classes and fix this if you have the time. I already did it for Frame a week
 or so ago, and this fixes Input, but there are bound to be more.

 Hope this helps,

 J-S
 --
 __
 Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/

 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
  *
  * This library is open source and may be redistributed and/or modified
 under
  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
  * (at your option) any later version.  The full license is in LICENSE
 file
  * included with this distribution, and on the openscenegraph.orgwebsite.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * OpenSceneGraph Public License for more details.
 */

 // Code by: Jeremy Moles (cubicool) 2007-2008

 #ifndef OSGWIDGET_INPUT
 #define OSGWIDGET_INPUT

 #include osgWidget/Label

 namespace osgWidget {

 // This is a string of values we use to try and determine the best Y
 // descent value (yoffset); you're welcome to use what works best for
 // your font.
 const std::string DESCENT_STRING(qpl);

 class OSGWIDGET_EXPORT Input: public Label
 {
public:

Input(const std::string = , const std::string = , unsigned
 int = 20);

virtual void parented   (Window*);
virtual void positioned ();

virtual bool focus   (const WindowManager*);
virtual bool unfocus (const WindowManager*);
virtual bool keyUp   (int, int, const WindowManager*);
virtual bool keyDown (int, int, const WindowManager*);

void setCursor(Widget*);
unsigned int calculateBestYOffset (const std::string = qgl);

void setXOffset(point_type xo) {
_xoff = xo;
}

void setYOffset(point_type yo) {
_yoff = yo;
}

void setXYOffset(point_type xo, point_type yo) {
_xoff = xo;
_yoff = yo;
}

osg::Drawable* getCursor() {
return _cursor.get();
}

const osg::Drawable* getCursor() const {
return _cursor.get();
}

point_type getXOffset() const {
return _xoff;
}

point_type getYOffset() const {
return _yoff;
}

XYCoord getXYOffset() const {
return XYCoord(_xoff, _yoff);
}

protected:
virtual void _calculateSize(const XYCoord);

void _calculateCursorOffsets();

point_type _xoff;
point_type _yoff;

unsigned int _index;
unsigned int _size;
unsigned int _cursorIndex;
unsigned int _maxSize;

std::vectorpoint_type _offsets;
osg::ref_ptrWidget_cursor;
 };

 }

 #endif

 // -*-c++-*- osgWidget - Code by: Jeremy Moles (cubicool) 2007-2008

 #include osg/io_utils
 #include osgWidget/WindowManager
 #include osgWidget/Input

 namespace osgWidget {

 Input::Input(const std::string name, const std::string label, 

Re: [osg-users] PagedLod dataBasePager memory managment

2010-01-15 Thread Vincent Bourdier
 that are higher than a certain
resolution.



Do you mean that using my own readFileCallback is not sufficient and I'll
need to  modify PagedLod sources too ?


Thanks.

Regards,
 Vincent.


__ Information from ESET NOD32 Antivirus, version of virus
signature database 4771 (20100114) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


  

__ Information from ESET NOD32 Antivirus, version of virus signature
database 4774 (20100115) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


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





__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4774 (20100115) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


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


Re: [osg-users] osgWidget::input work

2010-01-15 Thread Ümit Uzun
Merhaba Nikolov :)

I would have been glad to meet you,  but I stay in Ankara :( I think you are
on graphical prject in Istanbul. Which company works based on 3D environment
and simulation on Istanbul?

Nice to meet you.
Saygilar :D

Ümit Uzun


2010/1/15 Trajce Nikolov nikolov.tra...@gmail.com

 Merhaba  Umut :),

 its the google mail stuff, I guess based on the ip. I am originaly half
 macedonian half czech, at present in Istanbul on a project. No idea how long
 will stay here.

 If you are in Istanbul we can meet to have a beer

 Nick


 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

 On Fri, Jan 15, 2010 at 4:36 PM, Ümit Uzun umituzu...@gmail.com wrote:

 Hi Nikolov,

 What does  
 http://www.linkedin.com/in/tnickhttp://www.linkedin.com/in/tnickSent from 
 Devlet, Ankara, Turkey  mean. Is this undefined spam type?  Your
 location changing too fast. I am crious because I am from Turkey, too :D

 Regards.

 Ümit Uzun


 2010/1/15 Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com

  Hi Nick,


  However, I started the osgwidgetinput example and for some reason it is
 not getting my input from the keyboard.


 This is the same problem I noticed in other osgWidget classes lately.
 Someone changed the signature of virtual methods in the EventInterface class
 (which Widget inherits and thus, all other Widgets too) adding a const, but
 didn't change the signature of methods that are supposed to overload those
 virtual methods in derived classes. So for example, EventInterface defines:

 virtual bool keyDown (int, int, const WindowManager*) { return false; }
 virtual bool keyUp   (int, int, const WindowManager*) { return false; }

 but Input defines:

 virtual bool keyUp   (int, int, WindowManager*);
 virtual bool keyDown (int, int, WindowManager*);

 So there is no compile error, but the base class methods are called
 instead of the derived class methods because their argument lists don't
 match.

 Here's the change for Input. It would be nice to go across all osgWidget
 classes and fix this if you have the time. I already did it for Frame a week
 or so ago, and this fixes Input, but there are bound to be more.

 Hope this helps,

 J-S
 --
 __
 Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/

 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
  *
  * This library is open source and may be redistributed and/or modified
 under
  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
  * (at your option) any later version.  The full license is in LICENSE
 file
  * included with this distribution, and on the openscenegraph.orgwebsite.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * OpenSceneGraph Public License for more details.
 */

 // Code by: Jeremy Moles (cubicool) 2007-2008

 #ifndef OSGWIDGET_INPUT
 #define OSGWIDGET_INPUT

 #include osgWidget/Label

 namespace osgWidget {

 // This is a string of values we use to try and determine the best Y
 // descent value (yoffset); you're welcome to use what works best for
 // your font.
 const std::string DESCENT_STRING(qpl);

 class OSGWIDGET_EXPORT Input: public Label
 {
public:

Input(const std::string = , const std::string = , unsigned
 int = 20);

virtual void parented   (Window*);
virtual void positioned ();

virtual bool focus   (const WindowManager*);
virtual bool unfocus (const WindowManager*);
virtual bool keyUp   (int, int, const WindowManager*);
virtual bool keyDown (int, int, const WindowManager*);

void setCursor(Widget*);
unsigned int calculateBestYOffset (const std::string = qgl);

void setXOffset(point_type xo) {
_xoff = xo;
}

void setYOffset(point_type yo) {
_yoff = yo;
}

void setXYOffset(point_type xo, point_type yo) {
_xoff = xo;
_yoff = yo;
}

osg::Drawable* getCursor() {
return _cursor.get();
}

const osg::Drawable* getCursor() const {
return _cursor.get();
}

point_type getXOffset() const {
return _xoff;
}

point_type getYOffset() const {
return _yoff;
}

XYCoord getXYOffset() const {
return XYCoord(_xoff, _yoff);
}

protected:
virtual void _calculateSize(const XYCoord);

void _calculateCursorOffsets();

point_type _xoff;
point_type _yoff;

unsigned int _index;
unsigned int _size;
unsigned int _cursorIndex;
unsigned int _maxSize;

std::vectorpoint_type 

Re: [osg-users] osgWidget::input work

2010-01-15 Thread Trajce Nikolov
hi Umut,

I might have a short trip to Ankara soon. I am not going to disclose the
company :)
Nick

http://www.linkedin.com/in/tnick
Sent from Devlet, Ankara, Turkey

On Fri, Jan 15, 2010 at 4:58 PM, Ümit Uzun umituzu...@gmail.com wrote:

 Merhaba Nikolov :)

 I would have been glad to meet you,  but I stay in Ankara :( I think you
 are on graphical prject in Istanbul. Which company works based on 3D
 environment and simulation on Istanbul?

 Nice to meet you.
 Saygilar :D

 Ümit Uzun


 2010/1/15 Trajce Nikolov nikolov.tra...@gmail.com

 Merhaba  Umut :),

 its the google mail stuff, I guess based on the ip. I am originaly half
 macedonian half czech, at present in Istanbul on a project. No idea how long
 will stay here.

 If you are in Istanbul we can meet to have a beer

 Nick


 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

 On Fri, Jan 15, 2010 at 4:36 PM, Ümit Uzun umituzu...@gmail.com wrote:

 Hi Nikolov,

 What does  
 http://www.linkedin.com/in/tnickhttp://www.linkedin.com/in/tnickSent 
 from Devlet, Ankara, Turkey  mean. Is this undefined spam type?  Your
 location changing too fast. I am crious because I am from Turkey, too :D

 Regards.

 Ümit Uzun


 2010/1/15 Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com

  Hi Nick,


  However, I started the osgwidgetinput example and for some reason it is
 not getting my input from the keyboard.


 This is the same problem I noticed in other osgWidget classes lately.
 Someone changed the signature of virtual methods in the EventInterface 
 class
 (which Widget inherits and thus, all other Widgets too) adding a const, but
 didn't change the signature of methods that are supposed to overload those
 virtual methods in derived classes. So for example, EventInterface defines:

 virtual bool keyDown (int, int, const WindowManager*) { return false; }
 virtual bool keyUp   (int, int, const WindowManager*) { return false; }

 but Input defines:

 virtual bool keyUp   (int, int, WindowManager*);
 virtual bool keyDown (int, int, WindowManager*);

 So there is no compile error, but the base class methods are called
 instead of the derived class methods because their argument lists don't
 match.

 Here's the change for Input. It would be nice to go across all osgWidget
 classes and fix this if you have the time. I already did it for Frame a 
 week
 or so ago, and this fixes Input, but there are bound to be more.

 Hope this helps,

 J-S
 --
 __
 Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/

 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
  *
  * This library is open source and may be redistributed and/or modified
 under
  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
  * (at your option) any later version.  The full license is in LICENSE
 file
  * included with this distribution, and on the openscenegraph.orgwebsite.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * OpenSceneGraph Public License for more details.
 */

 // Code by: Jeremy Moles (cubicool) 2007-2008

 #ifndef OSGWIDGET_INPUT
 #define OSGWIDGET_INPUT

 #include osgWidget/Label

 namespace osgWidget {

 // This is a string of values we use to try and determine the best Y
 // descent value (yoffset); you're welcome to use what works best for
 // your font.
 const std::string DESCENT_STRING(qpl);

 class OSGWIDGET_EXPORT Input: public Label
 {
public:

Input(const std::string = , const std::string = , unsigned
 int = 20);

virtual void parented   (Window*);
virtual void positioned ();

virtual bool focus   (const WindowManager*);
virtual bool unfocus (const WindowManager*);
virtual bool keyUp   (int, int, const WindowManager*);
virtual bool keyDown (int, int, const WindowManager*);

void setCursor(Widget*);
unsigned int calculateBestYOffset (const std::string = qgl);

void setXOffset(point_type xo) {
_xoff = xo;
}

void setYOffset(point_type yo) {
_yoff = yo;
}

void setXYOffset(point_type xo, point_type yo) {
_xoff = xo;
_yoff = yo;
}

osg::Drawable* getCursor() {
return _cursor.get();
}

const osg::Drawable* getCursor() const {
return _cursor.get();
}

point_type getXOffset() const {
return _xoff;
}

point_type getYOffset() const {
return _yoff;
}

XYCoord getXYOffset() const {
return XYCoord(_xoff, _yoff);
}

protected:
virtual void _calculateSize(const XYCoord);

 

Re: [osg-users] osgWidget::input work

2010-01-15 Thread Ümit Uzun
Merhaba Nikolov,

If you come Ankara, we may can meet :) Sorry for special question about
company!

See you...
Regards.

Ümit Uzun


2010/1/15 Trajce Nikolov nikolov.tra...@gmail.com

 hi Umut,

 I might have a short trip to Ankara soon. I am not going to disclose the
 company :)

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

 On Fri, Jan 15, 2010 at 4:58 PM, Ümit Uzun umituzu...@gmail.com wrote:

 Merhaba Nikolov :)

 I would have been glad to meet you,  but I stay in Ankara :( I think you
 are on graphical prject in Istanbul. Which company works based on 3D
 environment and simulation on Istanbul?

 Nice to meet you.
 Saygilar :D

 Ümit Uzun


 2010/1/15 Trajce Nikolov nikolov.tra...@gmail.com

 Merhaba  Umut :),

 its the google mail stuff, I guess based on the ip. I am originaly half
 macedonian half czech, at present in Istanbul on a project. No idea how long
 will stay here.

 If you are in Istanbul we can meet to have a beer

 Nick


 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

 On Fri, Jan 15, 2010 at 4:36 PM, Ümit Uzun umituzu...@gmail.com wrote:

 Hi Nikolov,

 What does  
 http://www.linkedin.com/in/tnickhttp://www.linkedin.com/in/tnickSent 
 from Devlet, Ankara, Turkey  mean. Is this undefined spam type?  Your
 location changing too fast. I am crious because I am from Turkey, too :D

 Regards.

 Ümit Uzun


 2010/1/15 Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com

  Hi Nick,


  However, I started the osgwidgetinput example and for some reason it
 is not getting my input from the keyboard.


 This is the same problem I noticed in other osgWidget classes lately.
 Someone changed the signature of virtual methods in the EventInterface 
 class
 (which Widget inherits and thus, all other Widgets too) adding a const, 
 but
 didn't change the signature of methods that are supposed to overload those
 virtual methods in derived classes. So for example, EventInterface 
 defines:

 virtual bool keyDown (int, int, const WindowManager*) { return false; }
 virtual bool keyUp   (int, int, const WindowManager*) { return false; }

 but Input defines:

 virtual bool keyUp   (int, int, WindowManager*);
 virtual bool keyDown (int, int, WindowManager*);

 So there is no compile error, but the base class methods are called
 instead of the derived class methods because their argument lists don't
 match.

 Here's the change for Input. It would be nice to go across all
 osgWidget classes and fix this if you have the time. I already did it for
 Frame a week or so ago, and this fixes Input, but there are bound to be
 more.

 Hope this helps,

 J-S
 --
 __
 Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/

 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
  *
  * This library is open source and may be redistributed and/or modified
 under
  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0
 or
  * (at your option) any later version.  The full license is in LICENSE
 file
  * included with this distribution, and on the openscenegraph.orgwebsite.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * OpenSceneGraph Public License for more details.
 */

 // Code by: Jeremy Moles (cubicool) 2007-2008

 #ifndef OSGWIDGET_INPUT
 #define OSGWIDGET_INPUT

 #include osgWidget/Label

 namespace osgWidget {

 // This is a string of values we use to try and determine the best Y
 // descent value (yoffset); you're welcome to use what works best for
 // your font.
 const std::string DESCENT_STRING(qpl);

 class OSGWIDGET_EXPORT Input: public Label
 {
public:

Input(const std::string = , const std::string = , unsigned
 int = 20);

virtual void parented   (Window*);
virtual void positioned ();

virtual bool focus   (const WindowManager*);
virtual bool unfocus (const WindowManager*);
virtual bool keyUp   (int, int, const WindowManager*);
virtual bool keyDown (int, int, const WindowManager*);

void setCursor(Widget*);
unsigned int calculateBestYOffset (const std::string = qgl);

void setXOffset(point_type xo) {
_xoff = xo;
}

void setYOffset(point_type yo) {
_yoff = yo;
}

void setXYOffset(point_type xo, point_type yo) {
_xoff = xo;
_yoff = yo;
}

osg::Drawable* getCursor() {
return _cursor.get();
}

const osg::Drawable* getCursor() const {
return _cursor.get();
}

point_type getXOffset() const {
return _xoff;
}

point_type getYOffset() const {
 

Re: [osg-users] osgWidget::input work

2010-01-15 Thread Ümit Uzun
Hi Nikolov,

What does  
http://www.linkedin.com/in/tnickhttp://www.linkedin.com/in/tnickSent
from Devlet, Ankara, Turkey  mean. Is this undefined spam type?  Your
location changing too fast. I am crious because I am from Turkey, too :D

Regards.

Ümit Uzun


2010/1/15 Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com

 Hi Nick,


  However, I started the osgwidgetinput example and for some reason it is
 not getting my input from the keyboard.


 This is the same problem I noticed in other osgWidget classes lately.
 Someone changed the signature of virtual methods in the EventInterface class
 (which Widget inherits and thus, all other Widgets too) adding a const, but
 didn't change the signature of methods that are supposed to overload those
 virtual methods in derived classes. So for example, EventInterface defines:

 virtual bool keyDown (int, int, const WindowManager*) { return false; }
 virtual bool keyUp   (int, int, const WindowManager*) { return false; }

 but Input defines:

 virtual bool keyUp   (int, int, WindowManager*);
 virtual bool keyDown (int, int, WindowManager*);

 So there is no compile error, but the base class methods are called instead
 of the derived class methods because their argument lists don't match.

 Here's the change for Input. It would be nice to go across all osgWidget
 classes and fix this if you have the time. I already did it for Frame a week
 or so ago, and this fixes Input, but there are bound to be more.

 Hope this helps,

 J-S
 --
 __
 Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/

 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
  *
  * This library is open source and may be redistributed and/or modified
 under
  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
  * (at your option) any later version.  The full license is in LICENSE file
  * included with this distribution, and on the openscenegraph.org website.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * OpenSceneGraph Public License for more details.
 */

 // Code by: Jeremy Moles (cubicool) 2007-2008

 #ifndef OSGWIDGET_INPUT
 #define OSGWIDGET_INPUT

 #include osgWidget/Label

 namespace osgWidget {

 // This is a string of values we use to try and determine the best Y
 // descent value (yoffset); you're welcome to use what works best for
 // your font.
 const std::string DESCENT_STRING(qpl);

 class OSGWIDGET_EXPORT Input: public Label
 {
public:

Input(const std::string = , const std::string = , unsigned int
 = 20);

virtual void parented   (Window*);
virtual void positioned ();

virtual bool focus   (const WindowManager*);
virtual bool unfocus (const WindowManager*);
virtual bool keyUp   (int, int, const WindowManager*);
virtual bool keyDown (int, int, const WindowManager*);

void setCursor(Widget*);
unsigned int calculateBestYOffset (const std::string = qgl);

void setXOffset(point_type xo) {
_xoff = xo;
}

void setYOffset(point_type yo) {
_yoff = yo;
}

void setXYOffset(point_type xo, point_type yo) {
_xoff = xo;
_yoff = yo;
}

osg::Drawable* getCursor() {
return _cursor.get();
}

const osg::Drawable* getCursor() const {
return _cursor.get();
}

point_type getXOffset() const {
return _xoff;
}

point_type getYOffset() const {
return _yoff;
}

XYCoord getXYOffset() const {
return XYCoord(_xoff, _yoff);
}

protected:
virtual void _calculateSize(const XYCoord);

void _calculateCursorOffsets();

point_type _xoff;
point_type _yoff;

unsigned int _index;
unsigned int _size;
unsigned int _cursorIndex;
unsigned int _maxSize;

std::vectorpoint_type _offsets;
osg::ref_ptrWidget_cursor;
 };

 }

 #endif

 // -*-c++-*- osgWidget - Code by: Jeremy Moles (cubicool) 2007-2008

 #include osg/io_utils
 #include osgWidget/WindowManager
 #include osgWidget/Input

 namespace osgWidget {

 Input::Input(const std::string name, const std::string label, unsigned
 int size):
 Label(name, label),
 _xoff(0.0f),
 _yoff(0.0f),
 _index   (0),
 _size(0),
 _cursorIndex (0),
 _maxSize (size),
 _cursor  (new Widget(cursor)) {
_text-setAlignment(osgText::Text::LEFT_BOTTOM_BASE_LINE);
_text-setKerningType(osgText::KERNING_NONE);

// Make the cursor un-copyable.
_cursor-setCanClone(false);

Re: [osg-users] Starting out

2010-01-15 Thread Paul Martz
osgBullet (osgbullet.googlecode.com) has facilities for running the 
physics simulation in a separate thread and updating transformations via 
a shared memory segment.


Paul Martz
Skew Matrix Software LLC
_http://www.skew-matrix.com_ http://www.skew-matrix.com/
+1 303 859 9466



Tony Vasile wrote:
We have an existing visual simulation that is based on Performer. We 
know have to add collision detection with landmasses and the sea bottom. 
I was thinking of using OpenSceneGraph to place the vehicles in the 
world and use Bullet to do the actual collision detections. At this 
stage I don't need any rendering but since my vehicle models are all in 
OpenFlight format and I have access to some DTED Level 1 data I thought 
this was the way to go.


What I am after is example programs which have the vehicles drawn at 
their latitude, longitude and altitude and shows the sort of collisions 
that I am after. To speed things up I am only interested certain 
vehicles. I intend to have my existing program talk to the collision 
detection program via shared memory so I either I need a separate thread 
which deals with reading and writing to this shared memory and updating 
the collision program with where the vehicles are in the world.


Any help would be most appreciated.

Tony Vasile
CSC Australia




___
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] [osgPlugins] OSG SVG plugin windows

2010-01-15 Thread Ant Kennedy
Hi,

Ive had a quick look on the forums and dont seem to be able to find much on 
building this plugin on windows other than the fact I need cairo and rsvg. If 
someone could point me in the right direction it would be much apreciated.

Cheers,
Ant

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





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


Re: [osg-users] Warning: GraphicsWindowWin32::grabFocus() - Failed grabbing the focus

2010-01-15 Thread Andrew Cunningham
One of my problems was that , by default, the ESC key is mapped to killing the 
viewer ( done=true). So basically, if you hit the ESC key with the window 
active, the viewer just stops handling events.

This should be turned off in MFC with setKeyEventSetsDone(0)

Andrew

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





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


Re: [osg-users] [build] How do I compile an OSG app, so that it can be run without the OSG installed?

2010-01-15 Thread Agos Silva

Chris 'Xenon' Hanson wrote:
 On 1/14/2010 6:03 PM, Agos Silva wrote:
 Static linking. It's an option in CMake now, if I recall. 


Hi Chris, and thank you for your help. 
Yes, it makes sense, and you pointed me on the right direction.

I'm using Visual Studio 2008, not CMake, and I have already searched for a 
static linking option VS, but all I've found so far, was static linking for 
microsoft libraries, not for a library of my own or 3rd party (as OSG).

But meanwhile, I searched the OSG Forum, as you suggested and I think I found 
the answer at this thread:
http://forum.openscenegraph.org/viewtopic.php?t=4203highlight=static+linking

I'm going to try that out.

Thank you!


Agos

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




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


Re: [osg-users] compiling osg with intel compiler, windows

2010-01-15 Thread Andrew Cunningham
Hi Rupert,
I had no problem compiling that file with the Intel compiler.

Note that I created the VS2008 projects using CMake, then converted to using 
the Intel compiler manually.

1-- Rebuild All started: Project: osgWidget, Configuration: Debug x64 
--
1Compiling with Intel(R) C++ 11.1.054 [Intel(R) 64]... (Intel C++ Environment)
1Input.cpp
1D:\OSG\OpenSceneGraph-2.8.2-x64\src\osgWidget\Input.cpp(41): remark #869: 
parameter size was never referenced
1  void Input::_calculateSize(const XYCoord size) {
1^
1
1D:\OSG\OpenSceneGraph-2.8.2-x64\src\osgWidget\Input.cpp(120): remark #869: 
parameter key was never referenced
1  bool Input::keyUp(int key, int mask, WindowManager*) {
1^
1
1D:\OSG\OpenSceneGraph-2.8.2-x64\src\osgWidget\Input.cpp(120): remark #869: 
parameter mask was never referenced
1  bool Input::keyUp(int key, int mask, WindowManager*) {
1 ^
1
1D:\OSG\OpenSceneGraph-2.8.2-x64\src\osgWidget\Input.cpp(124): remark #869: 
parameter mask was never referenced
1  bool Input::keyDown(int key, int mask, WindowManager*) {
1   ^
1
1Build log was saved at 
file://D:\OSG\OpenSceneGraph-2.8.2-x64\src\osgWidget\osgWidget.dir\Debug\BuildLog.htm
1osgWidget - 0 error(s), 0 warning(s)
== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==


Andrew

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





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


Re: [osg-users] compiling osg with intel compiler, windows

2010-01-15 Thread Andrew Cunningham
Except, I am a moron and compiled the wrong file...

Did you submit a bug report to Intel?

1-- Rebuild All started: Project: Plugins osgwidget, Configuration: 
Release x64 --
1Compiling with Intel(R) C++ 11.1.054 [Intel(R) 64]... (Intel C++ Environment)
1Input.cpp
1D:\VAOne2010\OSG\OpenSceneGraph-2.8.2-x64\src\osgPlugins\osgWidget\Input.cpp(10):
 remark #869: parameter fr was never referenced
1  bool osgWidget_Input_readData(osg::Object /*obj*/, osgDB::Input fr) 
1^
1
1C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\vector(560): 
internal error: assertion failed: pop_stop_token_stack: wrong number of pops 
(shared/edgcpfe/lexical.c, line 11491)
1
1  }
1  ^
1
1compilation aborted for 
D:\VAOne2010\OSG\OpenSceneGraph-2.8.2-x64\src\osgPlugins\osgWidget\Input.cpp 
(code 4)
1Build log was saved at 
file://D:\VAOne2010\OSG\OpenSceneGraph-2.8.2-x64\src\osgPlugins\osgWidget\osgdb_osgwidget.dir\Release\BuildLog.htm
1Plugins osgwidget - 1 error(s), 0 warning(s)
== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==

Andrew

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





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


Re: [osg-users] osgDB::writeNodeFile() omits texture objects

2010-01-15 Thread Jim Brooks
Hi Robert,

Yes, the program was first rendering, then dumping, the scene-graph.

Neither pager-setUnrefImageDataAfterApplyPolicy()
nor export OSG_OPTIMIZER=OFF helped.

My program has procedurally-generated textures that are large,
so OSG freeing them makes sense.

The solution I found is to:

1. The app has to write procedural textures to files (.png),
   so that they'll be referenced in the dumped .osg file.

   image-setFileName( textureName );
   osgDB::writeImageFile( *image, textureName );

2. Dump the scene-graph BEFORE rendering it.

   If rendered first, textures will be lost regardless (why?).

   This is why (the texture : file association is lost):

   Texture2D {
  name terrain_texture
 file terrain_texture.png
  ^^
  [line will be omitted if rendered prior]


 Are loading the scene, rendering and then writing out the scene graph?

  If so then it's likely that your scene graph as the Texture
 UnrefImageAfterApply enabled on them so that once the image data is
 downloaded to OpenGL the images get discarded so there's no handle to
 write them out to disk any more.

 By default this feature is off, but the osgUtil::Optimizer in it's
 default settings will enable it, so if you run the Optimzer this is
 probably the culprit.   The DatabasePager also set up to enable this
 feature to help keep memory usage down.

 Robert.

 On Thu, Jan 14, 2010 at 3:46 PM, Jim Brooks wrote:
  I'm trying to dump the scene-graph.
 
  osgDB::writeNodeFile() writes geometry/colors ok,
  but (OSG 2.9.6) omits texture objects.
 
  Eg, when running osgviewer on the dumped .osg file,
  textures don't appear.
 
  Is this behavior of writeNodeFile() intentional?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [build] How do I compile an OSG app, so that it can be run without the OSG installed?

2010-01-15 Thread Chris 'Xenon' Hanson
On 1/15/2010 9:45 AM, Agos Silva wrote:
 I'm using Visual Studio 2008, not CMake

  Yes, but the current OSG uses CMake as a makefile-builder that creates the 
VC++ 2008
solution files. What version of OSG are you compiling with?

 But meanwhile, I searched the OSG Forum, as you suggested and I think I
 found the answer at this thread:
 http://forum.openscenegraph.org/viewtopic.php?t=4203highlight=static+linking
 http://forum.openscenegraph.org/viewtopic.php?t=4203highlight=static+linking

  Well, sort of.

  I wrote some info about this a long time ago:
http://www.openscenegraph.org/projects/osg/wiki/Community/Tasks/Win32StaticLink

  But it's out of date in that it doesn't talk about the CMake capabilities to 
help you
set up static linking.

-- 
Chris 'Xenon' Hanson, omo sanza lettere  Xenon AlphaPixel.com
PixelSense Landsat processing now available! http://www.alphapixel.com/demos/
There is no Truth. There is only Perception. To Perceive is to Exist. - Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Animation Instancing / Skinned Instancing with osg?

2010-01-15 Thread M. Moser
Hey Guys, (hey Jan)

we are a team of students from the university of applied science Düsseldorf
(Germany), studying virtual reality.

In our current project we have the need to display hunderd of animated
models ... it's an ant-swarm simulation.
We are using osgCal (cal3D) to import the animated models, and up to this
its working fine.

But the more animated models we add, the more the framerate drops... this is
(probably) because the updateTime of more animations needs more time.
So the question is, if it's somehow possible in OSG / osgCal to instanciate
animations?

We know that geomety instancing is possible, but for some reason we are not
able to get it work with animated models..

.. so every help is appreciated!

@Jan
Sorry i'm contacting you directly, but reading other related threads about
osg's animation you seem to be quite familiar with this topic, and we need a
solution as soon as possible.
hope you don't mind..

Best Regards

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


Re: [osg-users] osgDB::writeNodeFile() omits texture objects

2010-01-15 Thread Robert Osfield
Hi Jim,

It could be that your databases have the UnrefImageAfterApply enabled
on them which is causing the loaded database to release imagery.  You
can run the Optimizer::TextureVisitor to change the value back, just
have a look at the option for it in the include/osgUtil/Optimizer
header.

Another snippet for you is that is you enable the new texture pool
then UnrefImageAfterApply is automatically disabled so no matter what
you set osg::Texture* never releases the imagery.

Robert.

On Fri, Jan 15, 2010 at 5:10 PM, Jim Brooks jimbl...@gmail.com wrote:
 Hi Robert,

 Yes, the program was first rendering, then dumping, the scene-graph.

 Neither pager-setUnrefImageDataAfterApplyPolicy()
 nor export OSG_OPTIMIZER=OFF helped.

 My program has procedurally-generated textures that are large,
 so OSG freeing them makes sense.

 The solution I found is to:

 1. The app has to write procedural textures to files (.png),
   so that they'll be referenced in the dumped .osg file.

   image-setFileName( textureName );
   osgDB::writeImageFile( *image, textureName );

 2. Dump the scene-graph BEFORE rendering it.

   If rendered first, textures will be lost regardless (why?).

   This is why (the texture : file association is lost):

   Texture2D {
      name terrain_texture
     file terrain_texture.png
      ^^
      [line will be omitted if rendered prior]


 Are loading the scene, rendering and then writing out the scene graph?

  If so then it's likely that your scene graph as the Texture
 UnrefImageAfterApply enabled on them so that once the image data is
 downloaded to OpenGL the images get discarded so there's no handle to
 write them out to disk any more.

 By default this feature is off, but the osgUtil::Optimizer in it's
 default settings will enable it, so if you run the Optimzer this is
 probably the culprit.   The DatabasePager also set up to enable this
 feature to help keep memory usage down.

 Robert.

 On Thu, Jan 14, 2010 at 3:46 PM, Jim Brooks wrote:
  I'm trying to dump the scene-graph.
 
  osgDB::writeNodeFile() writes geometry/colors ok,
  but (OSG 2.9.6) omits texture objects.
 
  Eg, when running osgviewer on the dumped .osg file,
  textures don't appear.
 
  Is this behavior of writeNodeFile() intentional?
 ___
 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] Animation Instancing/ Skinned Instancing with osg?

2010-01-15 Thread Jan Ciger
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello M.Moser (Markus? Martin?)

On 2010-01-15 17:02, M. Moser wrote:
 Hey Guys, (hey Jan)
 
 we are a team of students from the university of applied science Düsseldorf
 (Germany), studying virtual reality.
 
 In our current project we have the need to display hunderd of animated
 models ... it's an ant-swarm simulation.
 We are using osgCal (cal3D) to import the animated models, and up to this
 its working fine.
 
 But the more animated models we add, the more the framerate drops... this is
 (probably) because the updateTime of more animations needs more time.
 So the question is, if it's somehow possible in OSG / osgCal to instanciate
 animations?
 
 We know that geomety instancing is possible, but for some reason we are not
 able to get it work with animated models..

Aha, I see. Well, the reason is obvious - geometry instancing and
animation instancing are two very different things, with geometry
being instanced by the GPU and animation state is completely on the CPU.

Assuming that by animation instancing you mean several copies of the
model (ant) sharing the same animation state over the screen to save the
animation computations (mainly the skinning calculations), I have two
news for you:

- - the bad one - osgCal is not designed for this case and will not do
what you want no matter how you massage it.

- - the good one - the solution is not difficult, but you will need to dig
a bit deeper.

Years ago I have done something similar - I had about 2000 animated
models (the Cal3D skeletons) marching on the screen using OSG. This was
without Cal3D though.

First, you will either need to modify osgCal2 (I am not familiar with
osgCal, which was actually forked and relicensed from the original code)
or to make your own OpenGL rendering code for the Cal3D models. It is
not difficult - take the demo application that comes with Cal3D as an
example, or look how osgCal2 does it when not using shaders for skinning.

Basically Cal3D loads the model, calculates the bone positions from the
active animations, blends them and then calculates the corresponding
deformations of the skin. You get the skin as a mesh (vertices organized
into triangles + normals + texture coords) that is ready to be fed into
an OpenGL vertex array or (easier) osg::Geometry instance. This will
display one model.

Now, if you want to instance the animation, just create several
osg::AttitudePositionTransform-s to put the cloned ants in different
places and attach this single osg::Geometry as a child (i.e. all the
transforms with share the *same* geometry sub-node). The difference from
using osgCal node is that osgCal attaches a separate copy of the Cal3D
model behind each copy of the geometry - which is not what you want.

Second consideration - I strongly advise you to define 2-3 levels of
detail for your meshes and use osg::LOD or osg::Switch nodes to manage
the levels of detail. Without that you will likely not be able to scale
the number of ants beyond few thousands unless you use very simple
(ugly) models. Ideally, use the impostors as the last LOD level - when
the camera is far away, the object gets changed to a non-animated (or
only once in a while updated) 2D quad with a texture. OSG has an
impostor node and it works quite well - you can get easily 100 000
impostors on the screen like that. See the osg examples for this.

Third consideration - you can use also geometry instancing to further
save triangles, which wasn't available when I did this originally - look
at the OSG examples at how to do it. With the geometry instancing
extensions, the GPU will do the mesh copying for you, saving fill rate.

Fourth consideration - with Cal3D, you will spend most of the time in
the skinning part (deformation of the skin mesh to conform with the
position of the internal, invisible, bones). Realize that skinning means
at least one extra matrix multiplication per vertex of your mesh to
deform it from the basic (binding) posture. With a large mesh, it
quickly adds up.

If you have a model like the ant that does not really need skinning
(ants have exoskeleton!), you can avoid that calculation by calling the
parts of the Cal3D update function by hand and skipping the skin and
cloth animation parts. Essentially, you will use Cal to only interpolate
the keyframe animations and to blend them.

My guesstimate is that with current hardware and a reasonably complex
scene you should be easily able to have 10-20k ants on the screen at the
same time. I have been able to put 10k on a screen using GeForce4 with
some heavy corner cutting (single animation, heavy impostor use, no
shaders, no instancing) years ago, so today that should be a breeze.

Do not worry about Cal3D being a bottleneck here - it won't, most of the
time you will be spending in rendering those clones and not updating few
quaternions in the skeleton calculations.

 @Jan
 Sorry i'm contacting you directly, but reading other related threads about
 

Re: [osg-users] Feedback sought on future of osgIntrospection

2010-01-15 Thread Robert Osfield
Ooo the torrent of posts on this topic is rather daunting... ;-)

For those interested in osgIntrospection/genwrapper I've just moved
genwrapper across to using CMake.  I've only built under Linux so far,
but hopefully it should work fine under other platforms.  The
CMakeLists.txt file is very simple so there is good change that it
should port quite easily.

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


Re: [osg-users] Faster build with precompiled headers (PCH)?

2010-01-15 Thread Jan Ciger
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 2010-01-14 01:01, Sukender wrote:
 Hi Paul,
 
 I'm sorry, I did a search IN MY MAIL BOX and didn't find anything...
 but you're right, I should have searched the whole archives first!

I do not recall seeing it neither.

 
 Well, to add a few details: - AFAIK, if you put only STL (and system
 headers?) in the PCH, you can avoid having to recompile the whole
 project each time you change osg/Node. The speedup is of course less,
 but it compensates a bit the slowness of MSVC. - The .h is
 automatically added to all .cpp files without having to change them
 (command line arg given in CMakeLists.txt). No special maintenance is
 to be made here. - However, you still got the thing I described in
 the previous mail: MSVC submitters must be warned to build without
 PCH before submitting.

BTW, you are aware that GCC has precompiled headers support too for some
time? It would be nice to have that supported as well.

Regards,

Jan
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFLUKVin11XseNj94gRAiZzAJwMcDgwndMrD69F5MNB8FzK7eyphgCfRief
PSG1vqKN8Bnsw+eYaDKrMV0=
=1Gwb
-END PGP SIGNATURE-
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [build] How do I compile an OSG app, so that it can be run without the OSG installed?

2010-01-15 Thread Agos Silva

 Yes, but the current OSG uses CMake as a makefile-builder that creates the 
 VC++ 2008 solution files. What version of OSG are you compiling with?


Well, I thought I had to do it particularly for my own app, in my own VS 
project, that's why I said that.

But after checking that other thread, I realized that I had to set that flag 
(OSG_LIBRARY_STATIC) to true in CMake, and recompile the whole *library* again, 
not just my app. :-(

I'm working with both versions of OSG right now (2.9.6 and 2.8.2), one at a 
time, because I need the writer of the .3ds plug-in, which is being developed 
in the 2.9.6 version.

Well, I went into CMake, but that flag didn't exist so I created it and set its 
value to true. I hope that works..., because I am precisely now recompiling the 
whole 2.8.2 library (as Static I hope!). But it will take quite a while (I 
estimate about an hour for each of the main sets: debug and release). So I 
can't say it works for now, and perhaps for the next days, cause I'll have to 
move on to other more urgent things.

I already read the readme file and the CMake web page, here, but I found no 
info regarding or other build flags...

Right I now I've just open your page, and it sounds promising, so I will check 
it now better now, and I'll let you know if I don't manage to get it done.

Thanks again for your support! :)


Agos

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




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


Re: [osg-users] light lobes and shadow maps

2010-01-15 Thread Trajce Nikolov
Hi Wojtek,

now I spent more time exploring this, the polyoffset seam to work, but there
is still a bit of shimmering. Its interesting, I put the light source in
move, when it moves backwards, the obstacles are lighten ok, but forward,
when the light comes close to the obstacles, the lighting is incorrect with
shimmering . Any clue how to resolve this artifact ?

Nick

http://www.linkedin.com/in/tnick


On Fri, Jan 15, 2010 at 4:48 PM, Trajce Nikolov nikolov.tra...@gmail.comwrote:

 ok .. make sense. Here is updated code, if some one wants to benefit from.
 LightLobes with handling of obstacles :). Thanks to Wojiech, Robert and the
 online community

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

 On Fri, Jan 15, 2010 at 3:53 PM, Wojciech Lewandowski 
 lewandow...@ai.com.pl wrote:

  0.0 = shadow2DProj( shadow_texture, projShadow ).r  = 1.0

 Shimering is a result of self shadowing. Boosting  depths in shadow map
 with glPolygonOffset usuallly fixes this. There are many schools for
 PolygonOffset settings. I usually set glPolygonOffset( 1.1, 4.0 ) and draw
 objects with front face culling (see StandardShadowMap::ViewData::init(0 for
 details ).  But for this setup models need to work correctly with backface
 culling on. If you do not enforce backface culling PolygonOffset may need
 different initialization.

 Wojtek

 - Original Message -

 *From:* Trajce Nikolov nikolov.tra...@gmail.com
 *To:* OpenSceneGraph Users osg-users@lists.openscenegraph.org
 *Sent:* Friday, January 15, 2010 2:46 PM
 *Subject:* Re: [osg-users] light lobes and shadow maps

 one more question. What are the possible values for shadow2DProj(
 shadow_texture, projShadow ).r ? I am trying to put the light attenuation
 back . and to avoid the shimmering
 Nick

 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

 On Fri, Jan 15, 2010 at 3:35 PM, Trajce Nikolov nikolov.tra...@gmail.com
  wrote:

 Hey Wojtek  Thanks a lot. !! I will tune it to fix the shimmering


 Nick

 http://www.linkedin.com/in/tnick


   On Fri, Jan 15, 2010 at 3:08 PM, Wojciech Lewandowski 
 lewandow...@ai.com.pl wrote:

  Trajce,

 Attached is a fixed source code. There is a lots of shadow shimmering on
 my GF8800. You will have to add some depth bias while rendering shadow map.
 Selection proper PolygonOffset values is usually a matter of trial and 
 error
 so leave this for you.

 Wojtek

 - Original Message -

 *From:* Trajce Nikolov nikolov.tra...@gmail.com
 *To:* OpenSceneGraph Users osg-users@lists.openscenegraph.org
 *Sent:* Friday, January 15, 2010 9:58 AM
 *Subject:* Re: [osg-users] light lobes and shadow maps

 ABout the code. I use shader to simulate lght lobes thru phong lighting
 in the shader. Then I use shadow maps to detect the area behind the
 obstacles that need not to be lighten. Most is mixture of shadow maps
 technique with lighting scheme. Code snippets borrowed from all around

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

 On Fri, Jan 15, 2010 at 10:54 AM, Trajce Nikolov 
 nikolov.tra...@gmail.com wrote:

 Hi Guys,

 here is the code.

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

 On Thu, Jan 14, 2010 at 11:42 PM, Wojciech Lewandowski 
 lewandow...@ai.com.pl wrote:

  Hi Nick,

 Post the troublesome code and elaborate a bit more about the problem.
 If its really a minute or two I am sure someone will be able to help.

 Wojtek Lewandowski

  *From:* Trajce Nikolov nikolov.tra...@gmail.com
 *Sent:* Thursday, January 14, 2010 8:58 PM
 *To:* OpenSceneGraph Users osg-users@lists.openscenegraph.org
 *Subject:* [osg-users] light lobes and shadow maps

 Hi community,

 I have some shader that does some lighting in the scene. Now studying
 osgShadow and the techniques. I want to a shadow map technique to disable
 the lightening of the scene behind obstacles. I have some code done, but 
 not
 working. I need some help, someone experienced with GLSL to spend a 
 minute
 or to to have a look and if possible to spot the problem. Anyone?

 Thanks a lot

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Izmit, 41, Turkey

 --

 ___
 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 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] [osgPlugins] OSG SVG plugin windows

2010-01-15 Thread Jason Daly

Ant Kennedy wrote:

Hi,

Ive had a quick look on the forums and dont seem to be able to find much on 
building this plugin on windows other than the fact I need cairo and rsvg. If 
someone could point me in the right direction it would be much apreciated.
  


The cairo and rsvg requirements are true;  you will need them to compile 
the svg plugin.   I think rsvg requires fontconfig as well, so you'll 
also need that.  What problem are you having specifically?


--J

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


Re: [osg-users] [build] How do I compile an OSG app, so that it can be run without the OSG installed?

2010-01-15 Thread Chris 'Xenon' Hanson
On 1/15/2010 10:42 AM, Agos Silva wrote:
 But after checking that other thread, I realized that I had to set that
 flag (OSG_LIBRARY_STATIC) to true in CMake, and recompile the whole
 *library* again, not just my app. Sad

  You are correct. The whole OSG library system needs to be built to support 
static linking.

-- 
Chris 'Xenon' Hanson, omo sanza lettere  Xenon AlphaPixel.com
PixelSense Landsat processing now available! http://www.alphapixel.com/demos/
There is no Truth. There is only Perception. To Perceive is to Exist. - Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] inactivate the camera manipulator

2010-01-15 Thread Nemo Ulysse
hello

I set up the TrackballManipulator to move the camera with the mouse but I would 
like to active and inactive the manipulator.
It is probably very simple but I can’t find who to inactivate the 
TrackballManipulator.

Thank you

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





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


Re: [osg-users] inactivate the camera manipulator

2010-01-15 Thread Trajce Nikolov
one way is thru an EventHandler that will enable/disable the camera
manipulator by keyboard for example, simply
viewer-setCameraManipulator(0)/setCameraManipulator(new
TrackballManipulator)


Nick

http://www.linkedin.com/in/tnick
Sent from Devlet, Ankara, Turkey

On Fri, Jan 15, 2010 at 9:00 PM, Nemo Ulysse ulysse.vau...@gmail.comwrote:

 hello

 I set up the TrackballManipulator to move the camera with the mouse but I
 would like to active and inactive the manipulator.
 It is probably very simple but I can’t find who to inactivate the
 TrackballManipulator.

 Thank you

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





 ___
 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] Feedback sought on future of osgIntrospection

2010-01-15 Thread Jean-Sébastien Guay

Hi Robert,


Ooo the torrent of posts on this topic is rather daunting... ;-)


I personally don't have anything to say, I haven't used osgIntrospection 
at all... But I've been following the development of the new extensible 
plugin, and if you can do the same thing with less code and a more 
manageable infrastructure, why not? :-)


J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   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


Re: [osg-users] light lobes and shadow maps

2010-01-15 Thread Wojciech Lewandowski
Hi,

Light close to obstacles ? If you have COMPUTE_NEAR_FAR it may clamp near plane 
to very small value which may impact depth resolution. Other issue maybe 
related to GLSL float precision. The trick with multiplying view space coord by 
inverse view matrix to get world coord is performed on float values inside 
GLSL.  Precision wise it would be better to multiply light camera MVP matrix by 
main camera INVERSE VIEW on the CPU. Osg Matrices use  doubles. Put the result 
of the multiplication on GLSL matrix Uniform and use it to multiply gl_Vertex 
in the shader. Such approach multiplies matrices with high precision and 
resulting matrix will be better suited to be cast on single prec. GLSL matrix. 
The drawback of this solution is: you need to update the uniform every frame, 
because main camera view changes with each move. 

Wojtek



From: Trajce Nikolov 
Sent: Friday, January 15, 2010 7:37 PM
To: OpenSceneGraph Users 
Subject: Re: [osg-users] light lobes and shadow maps


Hi Wojtek, 


now I spent more time exploring this, the polyoffset seam to work, but there is 
still a bit of shimmering. Its interesting, I put the light source in move, 
when it moves backwards, the obstacles are lighten ok, but forward, when the 
light comes close to the obstacles, the lighting is incorrect with shimmering . 
Any clue how to resolve this artifact ?

Nick

http://www.linkedin.com/in/tnick



On Fri, Jan 15, 2010 at 4:48 PM, Trajce Nikolov nikolov.tra...@gmail.com 
wrote:

  ok .. make sense. Here is updated code, if some one wants to benefit from. 
LightLobes with handling of obstacles :). Thanks to Wojiech, Robert and the 
online community 

  Nick

  http://www.linkedin.com/in/tnick
  Sent from Devlet, Ankara, Turkey 


  On Fri, Jan 15, 2010 at 3:53 PM, Wojciech Lewandowski lewandow...@ai.com.pl 
wrote:

0.0 = shadow2DProj( shadow_texture, projShadow ).r  = 1.0 

Shimering is a result of self shadowing. Boosting  depths in shadow map 
with glPolygonOffset usuallly fixes this. There are many schools for 
PolygonOffset settings. I usually set glPolygonOffset( 1.1, 4.0 ) and draw 
objects with front face culling (see StandardShadowMap::ViewData::init(0 for 
details ).  But for this setup models need to work correctly with backface 
culling on. If you do not enforce backface culling PolygonOffset may need 
different initialization.

Wojtek

- Original Message - 
  From: Trajce Nikolov 
  To: OpenSceneGraph Users 
  Sent: Friday, January 15, 2010 2:46 PM
  Subject: Re: [osg-users] light lobes and shadow maps


  one more question. What are the possible values for shadow2DProj( 
shadow_texture, projShadow ).r ? I am trying to put the light attenuation back 
. and to avoid the shimmering
  Nick

  http://www.linkedin.com/in/tnick
  Sent from Devlet, Ankara, Turkey 


  On Fri, Jan 15, 2010 at 3:35 PM, Trajce Nikolov 
nikolov.tra...@gmail.com wrote:

Hey Wojtek  Thanks a lot. !! I will tune it to fix the shimmering 



Nick

http://www.linkedin.com/in/tnick



On Fri, Jan 15, 2010 at 3:08 PM, Wojciech Lewandowski 
lewandow...@ai.com.pl wrote:

  Trajce,

  Attached is a fixed source code. There is a lots of shadow shimmering 
on my GF8800. You will have to add some depth bias while rendering shadow map. 
Selection proper PolygonOffset values is usually a matter of trial and error so 
leave this for you.

  Wojtek

  - Original Message - 
From: Trajce Nikolov 
To: OpenSceneGraph Users 
Sent: Friday, January 15, 2010 9:58 AM
Subject: Re: [osg-users] light lobes and shadow maps


ABout the code. I use shader to simulate lght lobes thru phong 
lighting in the shader. Then I use shadow maps to detect the area behind the 
obstacles that need not to be lighten. Most is mixture of shadow maps technique 
with lighting scheme. Code snippets borrowed from all around 

Nick

http://www.linkedin.com/in/tnick
Sent from Devlet, Ankara, Turkey 


On Fri, Jan 15, 2010 at 10:54 AM, Trajce Nikolov 
nikolov.tra...@gmail.com wrote:

  Hi Guys, 


  here is the code.

  Nick

  http://www.linkedin.com/in/tnick

  Sent from Devlet, Ankara, Turkey 



  On Thu, Jan 14, 2010 at 11:42 PM, Wojciech Lewandowski 
lewandow...@ai.com.pl wrote:

Hi Nick,

Post the troublesome code and elaborate a bit more about the 
problem. If its really a minute or two I am sure someone will be able to help.

Wojtek Lewandowski


From: Trajce Nikolov 
Sent: Thursday, January 14, 2010 8:58 PM
To: OpenSceneGraph Users 
Subject: [osg-users] light lobes and shadow maps


Hi community,

I have some shader that 

[osg-users] Unable to manipulate the node after using AnimationPath

2010-01-15 Thread Nguyen Tien Dat
Dear all,
I have a scene structure like this:
rootNode - matrixTranformNode - objectNode

I modify the position and orientation of the object by setting the
matrix of the matrixTranformNode and it works well. But the problem
appears when I try to use animation path. I create an animation path
like this:

 osg::AnimationPath* animationPath = new osg::AnimationPath;
 animationPath-setLoopMode(osg::AnimationPath::NO_LOOPING);
 //initialize startPoint, endPoint, rotation
animationPath-insert(0.0,osg::AnimationPath::ControlPoint(startPoint
, rotation));
animationPath-insert(0.0,osg::AnimationPath::ControlPoint(endPoint
, rotation));
matrixTranformNode-setUpdateCallback(new
osg::AnimationPathCallback(animationPath));

The animation looks as expected. But after the animation I try to
update the matrix of matrixTranformNode, it doesn't work properly. The
object is still in the place of the last frame of animation, and it
won't change its position and orientation no matter how I try to
change the matrix. When I try to call getMatrix method of
matrixTransformNode, the matrix is changed as I set it. But the object
isn't displayed correctly.
Could any of you tell me what happens with the matrixTransformNode
after the animation? How can I manipulate the object again after the
animation?
Note that I did try to replace the matrixTransformNode by a new one
(so the scene structure is rootNode - newMatrixTransformNode -
objectNode), and then I could manipulate the object again. But this
doesn't work smoothly when you want to have continuous motion between
the animation created by AnimationPath and the animation created by
your manipulation.
Thanks,
Dat
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Adding DatabasePager to VRJuggler for PagedLODSupport

2010-01-15 Thread Levi Swartzentruber
I have been working on tracking down why my application seg faults.  The
code seems to be trying to delete a GL buffer that does not exist.  The
problematic code is, to the best of my knowledge, the same as that found in
osgViewer::Renderer::flushAndCompile().  I have that code in postFrame() as
Jason suggested.  Here is the code chunk:

void Application::postFrame()
{
double availableTime = 1.0/10.0;
if(_frameStamp) {
_databasePager-compileGLObjects(*(_sceneViewer-getState()),
availableTime);
_sceneViewer-flushDeletedGLObjects(availableTime);
_databasePager-signalEndFrame();
}
}

Here is a debug backtrace at the seg fault:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x41a0d940 (LWP 12980)]
0x0036599c87e9 in glDeleteBuffers () from /usr/lib64/libGL.so.1
(gdb) backtrace
#0  0x0036599c87e9 in glDeleteBuffers () from /usr/lib64/libGL.so.1
#1  0x2ab316220729 in osg::BufferObject::Extensions:
:glDeleteBuffers ()
   from /home/users/vkk2/bin/linux/64Bit/OSG2.9.5/lib64/libosg.so.60
#2  0x2ab3162230a2 in osg::BufferObject::flushDeletedBufferObjects ()
   from /home/users/vkk2/bin/linux/64Bit/OSG2.9.5/lib64/libosg.so.60
#3  0x2ab3162d36f9 in osg::flushDeletedGLObjects () from
/home/users/vkk2/bin/linux/64Bit/OSG2.9.5/lib64/libosg.so.60
#4  0x2ab317030446 in osgUtil::SceneView::flushDeletedGLObjects ()
   from /home/users/vkk2/bin/linux/64Bit/OSG2.9.5/lib64/libosgUtil.so.60
#5  0x004066c8 in Application::postFrame ()
#6  0x2ab31474fdc0 in vrj::Kernel::controlLoop () from
/home/users/bnew/vrjuggler-2.3.16/lib64/x86_64/libvrj-2_3_16.so
#7  0x2ab3151cbbb7 in boost::function0void, std::allocatorvoid
::operator() ()
   from /home/users/bnew/vrjuggler-2.3.16/lib64/x86_64/libvpr-2_1_14.so
#8  0x2ab31521a555 in vpr::ThreadPosix::startThread ()
   from /home/users/bnew/vrjuggler-2.3.16/lib64/x86_64/libvpr-2_1_14.so
#9  0x2ab3151cbbb7 in boost::function0void, std::allocatorvoid
::operator() ()
   from /home/users/bnew/vrjuggler-2.3.16/lib64/x86_64/libvpr-2_1_14.so
#10 0x2ab3151caf46 in vprThreadFunctorFunction () from
/home/users/bnew/vrjuggler-2.3.16/lib64/x86_64/libvpr-2_1_14.so
#11 0x003653806617 in start_thread () from /lib64/libpthread.so.0
#12 0x003652cd3c2d in clone () from /lib64/libc.so.6

Any thoughts on how to solve the problem would be greatly appreciated,
Levi
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] inactivate the camera manipulator

2010-01-15 Thread Nemo Ulysse
When I do that it deletes all possibility to manipulate the camera.
 I want to be able to manipulate the camera in code and remove the control for 
the user.

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





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


Re: [osg-users] inactivate the camera manipulator

2010-01-15 Thread Trajce Nikolov
you can control the camera by setting the view matrix without manipulator
Nick

http://www.linkedin.com/in/tnick
Sent from Ünalan, İstanbul, Turkey

On Fri, Jan 15, 2010 at 10:49 PM, Nemo Ulysse ulysse.vau...@gmail.comwrote:

 When I do that it deletes all possibility to manipulate the camera.
  I want to be able to manipulate the camera in code and remove the control
 for the user.

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





 ___
 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] light lobes and shadow maps

2010-01-15 Thread Wojciech Lewandowski
Nick,

I may look into the code but don't expect much this time.  You need to attach 
the code first, though ;-). Few academy guys wrote couple dissertations on 
rasterization and aliasing errors in shadow mapping. Unless you try to do some 
exotic stuff like variance or logarithmic map you will have to use polygon 
offset. I guess you will end up to cranking up PolygonOfset even more if 
current values fail at some distance.  I don't really have other tricks in my 
sleeve.  

Wojtek



From: Trajce Nikolov 
Sent: Friday, January 15, 2010 9:08 PM
To: OpenSceneGraph Users 
Subject: Re: [osg-users] light lobes and shadow maps


That is exactly what I did. Please have a look at the updated code. The uniform 
is updated thru a callback and it multiplies the matrices, still there is a 
visual artifact.I dont have compute_near_far. The projection matrix is fixed 
with very small far plane (100 units, with the znear of 0.01). 

Nick

http://www.linkedin.com/in/tnick



On Fri, Jan 15, 2010 at 9:47 PM, Wojciech Lewandowski lewandow...@ai.com.pl 
wrote:

  Hi,

  Light close to obstacles ? If you have COMPUTE_NEAR_FAR it may clamp near 
plane to very small value which may impact depth resolution. Other issue maybe 
related to GLSL float precision. The trick with multiplying view space coord by 
inverse view matrix to get world coord is performed on float values inside 
GLSL.  Precision wise it would be better to multiply light camera MVP matrix by 
main camera INVERSE VIEW on the CPU. Osg Matrices use  doubles. Put the result 
of the multiplication on GLSL matrix Uniform and use it to multiply gl_Vertex 
in the shader. Such approach multiplies matrices with high precision and 
resulting matrix will be better suited to be cast on single prec. GLSL matrix. 
The drawback of this solution is: you need to update the uniform every frame, 
because main camera view changes with each move. 

  Wojtek



  From: Trajce Nikolov 
  Sent: Friday, January 15, 2010 7:37 PM
  To: OpenSceneGraph Users 
  Subject: Re: [osg-users] light lobes and shadow maps


  Hi Wojtek, 


  now I spent more time exploring this, the polyoffset seam to work, but there 
is still a bit of shimmering. Its interesting, I put the light source in move, 
when it moves backwards, the obstacles are lighten ok, but forward, when the 
light comes close to the obstacles, the lighting is incorrect with shimmering . 
Any clue how to resolve this artifact ?

  Nick

  http://www.linkedin.com/in/tnick



  On Fri, Jan 15, 2010 at 4:48 PM, Trajce Nikolov nikolov.tra...@gmail.com 
wrote:

ok .. make sense. Here is updated code, if some one wants to benefit from. 
LightLobes with handling of obstacles :). Thanks to Wojiech, Robert and the 
online community 

Nick

http://www.linkedin.com/in/tnick
Sent from Devlet, Ankara, Turkey 


On Fri, Jan 15, 2010 at 3:53 PM, Wojciech Lewandowski 
lewandow...@ai.com.pl wrote:

  0.0 = shadow2DProj( shadow_texture, projShadow ).r  = 1.0 

  Shimering is a result of self shadowing. Boosting  depths in shadow map 
with glPolygonOffset usuallly fixes this. There are many schools for 
PolygonOffset settings. I usually set glPolygonOffset( 1.1, 4.0 ) and draw 
objects with front face culling (see StandardShadowMap::ViewData::init(0 for 
details ).  But for this setup models need to work correctly with backface 
culling on. If you do not enforce backface culling PolygonOffset may need 
different initialization.

  Wojtek

  - Original Message - 
From: Trajce Nikolov 
To: OpenSceneGraph Users 
Sent: Friday, January 15, 2010 2:46 PM
Subject: Re: [osg-users] light lobes and shadow maps


one more question. What are the possible values for shadow2DProj( 
shadow_texture, projShadow ).r ? I am trying to put the light attenuation back 
. and to avoid the shimmering
Nick

http://www.linkedin.com/in/tnick
Sent from Devlet, Ankara, Turkey 


On Fri, Jan 15, 2010 at 3:35 PM, Trajce Nikolov 
nikolov.tra...@gmail.com wrote:

  Hey Wojtek  Thanks a lot. !! I will tune it to fix the shimmering 



  Nick

  http://www.linkedin.com/in/tnick



  On Fri, Jan 15, 2010 at 3:08 PM, Wojciech Lewandowski 
lewandow...@ai.com.pl wrote:

Trajce,

Attached is a fixed source code. There is a lots of shadow 
shimmering on my GF8800. You will have to add some depth bias while rendering 
shadow map. Selection proper PolygonOffset values is usually a matter of trial 
and error so leave this for you.

Wojtek

- Original Message - 
  From: Trajce Nikolov 
  To: OpenSceneGraph Users 
  Sent: Friday, January 15, 2010 9:58 AM
  Subject: Re: [osg-users] light lobes and shadow maps


  ABout the code. I use shader to simulate lght lobes thru phong 
lighting in the shader. Then I use shadow maps to detect 

Re: [osg-users] light lobes and shadow maps

2010-01-15 Thread Trajce Nikolov
ok :-) ... thanks anyway .. the code is attached in this discussion, in the
mail after you sent the fix .. Thanks again

Nick

http://www.linkedin.com/in/tnick
Sent from Ünalan, İstanbul, Turkey

On Fri, Jan 15, 2010 at 11:01 PM, Wojciech Lewandowski 
lewandow...@ai.com.pl wrote:

  Nick,

 I may look into the code but don't expect much this time.  You need to
 attach the code first, though ;-). Few academy guys wrote
 couple dissertations on rasterization and aliasing errors in shadow
 mapping. Unless you try to do some exotic stuff like variance or logarithmic
 map you will have to use polygon offset. I guess you will end up to
 cranking up PolygonOfset even more if current values fail at some distance.
 I don't really have other tricks in my sleeve.

 Wojtek


  *From:* Trajce Nikolov nikolov.tra...@gmail.com
 *Sent:* Friday, January 15, 2010 9:08 PM
 *To:* OpenSceneGraph Users osg-users@lists.openscenegraph.org
 *Subject:* Re: [osg-users] light lobes and shadow maps

 That is exactly what I did. Please have a look at the updated code. The
 uniform is updated thru a callback and it multiplies the matrices, still
 there is a visual artifact.I dont have compute_near_far. The projection
 matrix is fixed with very small far plane (100 units, with the znear of
 0.01).

 Nick

 http://www.linkedin.com/in/tnick


 On Fri, Jan 15, 2010 at 9:47 PM, Wojciech Lewandowski 
 lewandow...@ai.com.pl wrote:

  Hi,

 Light close to obstacles ? If you have COMPUTE_NEAR_FAR it may clamp near
 plane to very small value which may impact depth resolution. Other issue
 maybe related to GLSL float precision. The trick with multiplying view
 space coord by inverse view matrix to get world coord is performed on float
 values inside GLSL.  Precision wise it would be better to multiply light
 camera MVP matrix by main camera INVERSE VIEW on the CPU. Osg Matrices use
  doubles. Put the result of the multiplication on GLSL matrix Uniform and
 use it to multiply gl_Vertex in the shader. Such approach multiplies
 matrices with high precision and resulting matrix will be better suited to
 be cast on single prec. GLSL matrix. The drawback of this solution is: you
 need to update the uniform every frame, because main camera view changes
 with each move.

 Wojtek


  *From:* Trajce Nikolov nikolov.tra...@gmail.com
 *Sent:* Friday, January 15, 2010 7:37 PM
 *To:* OpenSceneGraph Users osg-users@lists.openscenegraph.org
   *Subject:* Re: [osg-users] light lobes and shadow maps

 Hi Wojtek,

 now I spent more time exploring this, the polyoffset seam to work, but
 there is still a bit of shimmering. Its interesting, I put the light source
 in move, when it moves backwards, the obstacles are lighten ok, but forward,
 when the light comes close to the obstacles, the lighting is incorrect with
 shimmering . Any clue how to resolve this artifact ?

 Nick

 http://www.linkedin.com/in/tnick


 On Fri, Jan 15, 2010 at 4:48 PM, Trajce Nikolov nikolov.tra...@gmail.com
  wrote:

 ok .. make sense. Here is updated code, if some one wants to benefit
 from. LightLobes with handling of obstacles :). Thanks to Wojiech, Robert
 and the online community

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

   On Fri, Jan 15, 2010 at 3:53 PM, Wojciech Lewandowski 
 lewandow...@ai.com.pl wrote:

  0.0 = shadow2DProj( shadow_texture, projShadow ).r  = 1.0

 Shimering is a result of self shadowing. Boosting  depths in shadow map
 with glPolygonOffset usuallly fixes this. There are many schools for
 PolygonOffset settings. I usually set glPolygonOffset( 1.1, 4.0 ) and draw
 objects with front face culling (see StandardShadowMap::ViewData::init(0 
 for
 details ).  But for this setup models need to work correctly with backface
 culling on. If you do not enforce backface culling PolygonOffset may need
 different initialization.

 Wojtek

 - Original Message -

  *From:* Trajce Nikolov nikolov.tra...@gmail.com
 *To:* OpenSceneGraph Users osg-users@lists.openscenegraph.org
   *Sent:* Friday, January 15, 2010 2:46 PM
 *Subject:* Re: [osg-users] light lobes and shadow maps

 one more question. What are the possible values for shadow2DProj(
 shadow_texture, projShadow ).r ? I am trying to put the light attenuation
 back . and to avoid the shimmering
 Nick

 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

 On Fri, Jan 15, 2010 at 3:35 PM, Trajce Nikolov 
 nikolov.tra...@gmail.com wrote:

 Hey Wojtek  Thanks a lot. !! I will tune it to fix the shimmering


 Nick

 http://www.linkedin.com/in/tnick


   On Fri, Jan 15, 2010 at 3:08 PM, Wojciech Lewandowski 
 lewandow...@ai.com.pl wrote:

  Trajce,

 Attached is a fixed source code. There is a lots of shadow shimmering
 on my GF8800. You will have to add some depth bias while rendering shadow
 map. Selection proper PolygonOffset values is usually a matter of trial 
 and
 error so leave this for you.

 Wojtek

 - Original Message -

 *From:* Trajce Nikolov 

Re: [osg-users] light lobes and shadow maps

2010-01-15 Thread Trajce Nikolov
do you have some pointers, papers to the work of this guys? I am interested
in learning what is that about
Nick

http://www.linkedin.com/in/tnick
Sent from Ünalan, İstanbul, Turkey

On Fri, Jan 15, 2010 at 11:01 PM, Wojciech Lewandowski 
lewandow...@ai.com.pl wrote:

  Nick,

 I may look into the code but don't expect much this time.  You need to
 attach the code first, though ;-). Few academy guys wrote
 couple dissertations on rasterization and aliasing errors in shadow
 mapping. Unless you try to do some exotic stuff like variance or logarithmic
 map you will have to use polygon offset. I guess you will end up to
 cranking up PolygonOfset even more if current values fail at some distance.
 I don't really have other tricks in my sleeve.

 Wojtek


  *From:* Trajce Nikolov nikolov.tra...@gmail.com
 *Sent:* Friday, January 15, 2010 9:08 PM
 *To:* OpenSceneGraph Users osg-users@lists.openscenegraph.org
 *Subject:* Re: [osg-users] light lobes and shadow maps

 That is exactly what I did. Please have a look at the updated code. The
 uniform is updated thru a callback and it multiplies the matrices, still
 there is a visual artifact.I dont have compute_near_far. The projection
 matrix is fixed with very small far plane (100 units, with the znear of
 0.01).

 Nick

 http://www.linkedin.com/in/tnick


 On Fri, Jan 15, 2010 at 9:47 PM, Wojciech Lewandowski 
 lewandow...@ai.com.pl wrote:

  Hi,

 Light close to obstacles ? If you have COMPUTE_NEAR_FAR it may clamp near
 plane to very small value which may impact depth resolution. Other issue
 maybe related to GLSL float precision. The trick with multiplying view
 space coord by inverse view matrix to get world coord is performed on float
 values inside GLSL.  Precision wise it would be better to multiply light
 camera MVP matrix by main camera INVERSE VIEW on the CPU. Osg Matrices use
  doubles. Put the result of the multiplication on GLSL matrix Uniform and
 use it to multiply gl_Vertex in the shader. Such approach multiplies
 matrices with high precision and resulting matrix will be better suited to
 be cast on single prec. GLSL matrix. The drawback of this solution is: you
 need to update the uniform every frame, because main camera view changes
 with each move.

 Wojtek


  *From:* Trajce Nikolov nikolov.tra...@gmail.com
 *Sent:* Friday, January 15, 2010 7:37 PM
 *To:* OpenSceneGraph Users osg-users@lists.openscenegraph.org
   *Subject:* Re: [osg-users] light lobes and shadow maps

 Hi Wojtek,

 now I spent more time exploring this, the polyoffset seam to work, but
 there is still a bit of shimmering. Its interesting, I put the light source
 in move, when it moves backwards, the obstacles are lighten ok, but forward,
 when the light comes close to the obstacles, the lighting is incorrect with
 shimmering . Any clue how to resolve this artifact ?

 Nick

 http://www.linkedin.com/in/tnick


 On Fri, Jan 15, 2010 at 4:48 PM, Trajce Nikolov nikolov.tra...@gmail.com
  wrote:

 ok .. make sense. Here is updated code, if some one wants to benefit
 from. LightLobes with handling of obstacles :). Thanks to Wojiech, Robert
 and the online community

 Nick

 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

   On Fri, Jan 15, 2010 at 3:53 PM, Wojciech Lewandowski 
 lewandow...@ai.com.pl wrote:

  0.0 = shadow2DProj( shadow_texture, projShadow ).r  = 1.0

 Shimering is a result of self shadowing. Boosting  depths in shadow map
 with glPolygonOffset usuallly fixes this. There are many schools for
 PolygonOffset settings. I usually set glPolygonOffset( 1.1, 4.0 ) and draw
 objects with front face culling (see StandardShadowMap::ViewData::init(0 
 for
 details ).  But for this setup models need to work correctly with backface
 culling on. If you do not enforce backface culling PolygonOffset may need
 different initialization.

 Wojtek

 - Original Message -

  *From:* Trajce Nikolov nikolov.tra...@gmail.com
 *To:* OpenSceneGraph Users osg-users@lists.openscenegraph.org
   *Sent:* Friday, January 15, 2010 2:46 PM
 *Subject:* Re: [osg-users] light lobes and shadow maps

 one more question. What are the possible values for shadow2DProj(
 shadow_texture, projShadow ).r ? I am trying to put the light attenuation
 back . and to avoid the shimmering
 Nick

 http://www.linkedin.com/in/tnick
 Sent from Devlet, Ankara, Turkey

 On Fri, Jan 15, 2010 at 3:35 PM, Trajce Nikolov 
 nikolov.tra...@gmail.com wrote:

 Hey Wojtek  Thanks a lot. !! I will tune it to fix the shimmering


 Nick

 http://www.linkedin.com/in/tnick


   On Fri, Jan 15, 2010 at 3:08 PM, Wojciech Lewandowski 
 lewandow...@ai.com.pl wrote:

  Trajce,

 Attached is a fixed source code. There is a lots of shadow shimmering
 on my GF8800. You will have to add some depth bias while rendering shadow
 map. Selection proper PolygonOffset values is usually a matter of trial 
 and
 error so leave this for you.

 Wojtek

 - Original Message -

 *From:* Trajce Nikolov 

[osg-users] getWorldMatrices of Node

2010-01-15 Thread Danny Riflko
Hi, I'm using getWorldMatrices of Node to transform local coordinates to world 
coordinates.


Code:

hipsT-addChild(rightHipT);
rightHipT-addChild(rightKneeT);
rightKneeT-addChild(rightAnkleT);
rightAnkleT-addChild(rightFoot);
scene-addChild(hipsT);

osg::MatrixList worldMatrices = rightFoot-getWorldMatrices();

for(osg::MatrixList::iterator itr = worldMatrices.begin();
itr != worldMatrices.end();
++itr) {
osg::Matrix matrix = *itr;
osg::Vec3 center = rightFoot-getBound().center() * matrix;
}



I took the code of for-cycle from here:
http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/CameraControlFindingWorldCoordinates


These: hipsT, rightHipT, rightKneeT, rightAnkleT are PAT's and rightFoot is a 
Node*. The question is why the of size of worldMatrices is just one matrix? 
Shouldn't it have a matrix for each PAT?

Thank you!

Cheers,
Danny

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





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


Re: [osg-users] getWorldMatrices of Node

2010-01-15 Thread Martin Beckett
It isn't, worldmatrices is a list of all the individual matrices up the leg to 
the top.

But multiplying these together gives a single matrix that is equivalent to 
going through all these individual conversions - thats the whole beauty of 
matrix transforms.

Cheers,
Martin

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





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


Re: [osg-users] getWorldMatrices of Node

2010-01-15 Thread Danny Riflko
Then why std::cout  worldMatrices.size()  std::endl; says it's 1?

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





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


[osg-users] Ortho, zoom and Sphericalmanipulator

2010-01-15 Thread Martin Beckett
I need to set a 2d view of a basically flat landscape. I am using Spherical 
manipulator and perspective view

To get the world position of a mouse pick (while in plan view) I need the 
eye-distance, but in the same 'normalised' units as GUIEventAdapter 
getX/Ynormalized(). Not sure how I can do this.

Alternatively I could switch to an Orthoview, but then I lose zoom. Would it be 
reasonable to extend SphericalManipulator to include 'zoom' in ortho mode?

modjtabaf - I think you did the mods to the SphericalManipulator, any thoughts?

Cheers,
Martin

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





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


Re: [osg-users] getWorldMatrices of Node

2010-01-15 Thread Jean-Sébastien Guay

Hi MArtin, Danny,


It isn't, worldmatrices is a list of all the individual matrices up the leg to 
the top.


No - getWorldMatrices() returns the list of the localToWorld matrices 
for all paths from the node to the root. So if your node has only one 
path from itself to the root, then getWorldMatrices() will return only 
one matrix as it does for you.


So in other words, it doesn't return every matrix from the node to the 
root, it returns a single matrix for each path which contains the whole 
transform from local to world space.


This is because a scene graph in OSG is not a tree (where each node 
would have a single parent) but a DAG (directed acyclic graph - where 
each node may have multiple parents). So there may be multiple paths 
from any node to the root. Only you can know if there is only one, OSG 
can't know this, so it gives you a function to get localToWorld matrices 
for all paths and then lets you decide if you want to use just one of 
them, all of them, or whatever you want.


And if you look at what the for loop does, it gives you a different 
osg::Vec3 for each element of worldMatrices... So that's a different 
world-space position for each path from the node to the root.


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   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


Re: [osg-users] light lobes and shadow maps

2010-01-15 Thread Wojciech Lewandowski
Google for Shadow Maps. You will come up with a number of techniques. Few of 
them:

http://www.punkuser.net/vsm/

http://gamma.cs.unc.edu/LOGPSM/

http://developer.download.nvidia.com/presentations/2008/GDC/GDC08_SoftShadowMapping.pdf

Most of these belong to the family of soft shadow algorithms. Soft shadows 
usually oversample depth texel and produce some average shadow term. Clamping 
this term to 0 if value is below certain threshold (for example 0.25) usually 
removes some of self shadowing artifacts.

I will have the second look on the code but not today.
  
Wojtek


From: Trajce Nikolov 
Sent: Friday, January 15, 2010 10:16 PM
To: OpenSceneGraph Users 
Subject: Re: [osg-users] light lobes and shadow maps


do you have some pointers, papers to the work of this guys? I am interested in 
learning what is that about
Nick

http://www.linkedin.com/in/tnick
Sent from Ünalan, İstanbul, Turkey 


On Fri, Jan 15, 2010 at 11:01 PM, Wojciech Lewandowski lewandow...@ai.com.pl 
wrote:

  Nick,

  I may look into the code but don't expect much this time.  You need to attach 
the code first, though ;-). Few academy guys wrote couple dissertations on 
rasterization and aliasing errors in shadow mapping. Unless you try to do some 
exotic stuff like variance or logarithmic map you will have to use polygon 
offset. I guess you will end up to cranking up PolygonOfset even more if 
current values fail at some distance.  I don't really have other tricks in my 
sleeve.  

  Wojtek



  From: Trajce Nikolov 
  Sent: Friday, January 15, 2010 9:08 PM
  To: OpenSceneGraph Users 
  Subject: Re: [osg-users] light lobes and shadow maps


  That is exactly what I did. Please have a look at the updated code. The 
uniform is updated thru a callback and it multiplies the matrices, still there 
is a visual artifact.I dont have compute_near_far. The projection matrix is 
fixed with very small far plane (100 units, with the znear of 0.01). 

  Nick

  http://www.linkedin.com/in/tnick



  On Fri, Jan 15, 2010 at 9:47 PM, Wojciech Lewandowski lewandow...@ai.com.pl 
wrote:

Hi,

Light close to obstacles ? If you have COMPUTE_NEAR_FAR it may clamp near 
plane to very small value which may impact depth resolution. Other issue maybe 
related to GLSL float precision. The trick with multiplying view space coord by 
inverse view matrix to get world coord is performed on float values inside 
GLSL.  Precision wise it would be better to multiply light camera MVP matrix by 
main camera INVERSE VIEW on the CPU. Osg Matrices use  doubles. Put the result 
of the multiplication on GLSL matrix Uniform and use it to multiply gl_Vertex 
in the shader. Such approach multiplies matrices with high precision and 
resulting matrix will be better suited to be cast on single prec. GLSL matrix. 
The drawback of this solution is: you need to update the uniform every frame, 
because main camera view changes with each move. 

Wojtek



From: Trajce Nikolov 
Sent: Friday, January 15, 2010 7:37 PM
To: OpenSceneGraph Users 
Subject: Re: [osg-users] light lobes and shadow maps


Hi Wojtek, 


now I spent more time exploring this, the polyoffset seam to work, but 
there is still a bit of shimmering. Its interesting, I put the light source in 
move, when it moves backwards, the obstacles are lighten ok, but forward, when 
the light comes close to the obstacles, the lighting is incorrect with 
shimmering . Any clue how to resolve this artifact ?

Nick

http://www.linkedin.com/in/tnick



On Fri, Jan 15, 2010 at 4:48 PM, Trajce Nikolov nikolov.tra...@gmail.com 
wrote:

  ok .. make sense. Here is updated code, if some one wants to benefit 
from. LightLobes with handling of obstacles :). Thanks to Wojiech, Robert and 
the online community 

  Nick

  http://www.linkedin.com/in/tnick
  Sent from Devlet, Ankara, Turkey 


  On Fri, Jan 15, 2010 at 3:53 PM, Wojciech Lewandowski 
lewandow...@ai.com.pl wrote:

0.0 = shadow2DProj( shadow_texture, projShadow ).r  = 1.0 

Shimering is a result of self shadowing. Boosting  depths in shadow map 
with glPolygonOffset usuallly fixes this. There are many schools for 
PolygonOffset settings. I usually set glPolygonOffset( 1.1, 4.0 ) and draw 
objects with front face culling (see StandardShadowMap::ViewData::init(0 for 
details ).  But for this setup models need to work correctly with backface 
culling on. If you do not enforce backface culling PolygonOffset may need 
different initialization.

Wojtek

- Original Message - 
  From: Trajce Nikolov 
  To: OpenSceneGraph Users 
  Sent: Friday, January 15, 2010 2:46 PM
  Subject: Re: [osg-users] light lobes and shadow maps


  one more question. What are the possible values for shadow2DProj( 
shadow_texture, projShadow ).r ? I am trying to put the light attenuation back 
. and to avoid the shimmering
  Nick