Re: [osg-users] OSG + sky

2007-11-01 Thread Adrian Egli
Hi Jim,

do you have a example or demo of the sky-dome implemenation with the clouds
?

/adegli

2007/11/1, Jim Brooks [EMAIL PROTECTED]:

 I want to integrate enviroment in my application,
 for example clouds and sky. As far as my knowledge
 is concerned this is not possible in OSG
 currenly. Can someone tell me the alternatives.

 OSG can be used to render a sky dome/box and clouds
 (I've done it).

 For cumulus clouds, used libnoise to
 procedurally-generate textures and
 and a custom sprite node that rendered
 a set of viewplane-aligned blended quads
 (OSG::Billboard has/had problems staying rotated to
 viewplane).


 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around
 http://mail.yahoo.com
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 

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


[osg-users] Demo.... Kd-Tree

2007-11-01 Thread Adrian Egli
http://webaddon3d.assoftware.ch/AE/RTTest.rar

/adegli

-- 

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


Re: [osg-users] translate transformation on projection

2007-11-01 Thread Robert Osfield
On 10/31/07, Terry Welsh [EMAIL PROTECTED] wrote:
  If you didn't multiply this translation into the projection matrix, then all
  cameras would render the same eye space, and you'd get the same image from
  all cameras.
 
  If you tried to do this by modifying the modelview matrix instead of the
  projection matrix, the images wouldn't tile seamlessly.

 How does this cause tiling problems?  I have still never found a good
 reason to put translations or rotations in the projection matrix since
 this tends to cause problems with fog and lighting.

A powerwall is an example where the view matrix stays constant between
cameras but the slave cameras use a post translation of the projection
matrix to capture different parts of the display.  The osgwindow
example does this in minature.  The result is jus sheared projection
matrix.

A cylindrical display you'd rotate the view matrix for each of the
slaves but keep the projection matrix the same.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] A parameter in VirtualPlanetBuilder-0.9.1

2007-11-01 Thread Robert Osfield
On 10/31/07, GuiYe [EMAIL PROTECTED] wrote:

arguments.getApplicationUsage()-addCommandLineOption(--layer
 layer_num,Specify the layer that the next source Texture will contribute
 to..);

Who can tell me the meaning of the parameter and how to use this
 parameter?


I can't really add much beyond the command line documentation, a layer in
VPB is simply a separate texture unit, a database with just layer 0 will
have just a single texture applied to texture unit 0, a database with a
layer 0 and layer 1 will have two texture units used 0 and 1.

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


Re: [osg-users] How to detect collisions ?

2007-11-01 Thread Robert Osfield
Try Node::getWorldMatrices()

On 11/1/07, Cervantes Pintor Pedro [EMAIL PROTECTED] wrote:

  Hi,

 I'm trying to detect a collision between two objects by simply using the
 bounding sphere of those objects.

 So i need to collect the world transformation for each object and then
 translate those spheres  so then I can use the intersects method. Now the
 question is, what would be the easiest way to keep track of the acumulated
 transformations for each object?
 Is there any NodeVisitor that keeps track of this ?

 Thanks in advance to all replys


 ___
 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] HUD in multiple display

2007-11-01 Thread santosh
Hi Guys

I had created a HUD for text display and added in the root node. For 
multiple screen display I added the slaves in viewer.
Now I am getting the text on every slave camera which I don't want. I 
want it to be in  only one display.
What sould I do for this ?

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


Re: [osg-users] OSG + sky

2007-11-01 Thread Cole, Charles E. (LARC-B702)[GENEX SYSTEMS]
Just some more suggestions for references ...

 

(1) osgEphemeris, by Don Burns
(http://andesengineering.com/Projects/OsgEphemeris) - uses OSG (and
osgProducer) to create virtual environments for sky, moon, planets, and
stars.

 

(2) Delta3D (http://www.delta3d.org http://www.delta3d.org/ ) - uses
OSG in developing a gaming and simulation engine.

 

(3) FlightGear (http://www.flightgear.org http://www.flightgear.org/ )
- SVN project uses OSG, but prior releases use straight OpenGL for
environment rendering (I believe this part is handled using SimGear,
www.simgear.org http://www.simgear.org/ ).

 

All references are open-source, so they should provide some good
examples how environment rendering is handled both with OSG and OpenGL.

 

chuck

 

 



From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Adrian
Egli
Sent: Thursday, November 01, 2007 3:00 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] OSG + sky

 

Hi Jim, 

do you have a example or demo of the sky-dome implemenation with the
clouds ? 

/adegli 

2007/11/1, Jim Brooks [EMAIL PROTECTED] :

I want to integrate enviroment in my application,
for example clouds and sky. As far as my knowledge 
is concerned this is not possible in OSG
currenly. Can someone tell me the alternatives.

OSG can be used to render a sky dome/box and clouds
(I've done it).

For cumulus clouds, used libnoise to 
procedurally-generate textures and
and a custom sprite node that rendered
a set of viewplane-aligned blended quads
(OSG::Billboard has/had problems staying rotated to
viewplane).


__ 
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
___
osg-users mailing list 
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g 




-- 

Adrian Egli 

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


Re: [osg-users] Demo.... Kd-Tree

2007-11-01 Thread Cedric Pinson
I can't test it under Linux, do you have the source tree, i ll try to 
compile it


Adrian Egli wrote:
 http://webaddon3d.assoftware.ch/AE/RTTest.rar

 /adegli

 -- 
 
 Adrian Egli
 

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

-- 
+33 (0) 6 63 20 03 56  Cedric Pinson mailto:[EMAIL PROTECTED] 
http://www.plopbyte.net


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


Re: [osg-users] HUD in multiple display

2007-11-01 Thread Robert Osfield
Hi Santosh,

On 11/1/07, santosh [EMAIL PROTECTED] wrote:
 I had created a HUD for text display and added in the root node. For
 multiple screen display I added the slaves in viewer.
 Now I am getting the text on every slave camera which I don't want. I
 want it to be in  only one display.
 What sould I do for this ?

osgViewer::CompositeViewer can do this by just placing the HUD views
on each window you required.  Alternatively you can do this using
Viewer and slave cameras.  For the HUD Cameras you simply assign it to
the GraphicsWindow you want it to appear.

Doing it in the scene graph is possible, and in the past as the be the
most straight forward way of doing it - but it has the draw back that
every main camera will have the nested HUD camera in it.

The osghud example in 2.x illustrate al these combinations.

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


Re: [osg-users] HUD in multiple display

2007-11-01 Thread Vican, Justin E.
Hi Santosh,
You can do this with node masks.  Set the node mask for the HUD camera
to 0x1:
  hudCamera-setNodeMask(0x0001);

Then set the cull mask for all cameras in viewer.  For the camera in
which you want the HUD to display:
  masterCamera-setCullMask(0xfffF);

For all other cameras:
  slaveCamera[N]-setCullMask(0xfffE);

The masks will be and-ed, and the HUD will be culled out of all slave
cameras.  This has worked for me with the composite viewer.  I haven't
done any slave cameras, but I imagine something similar will work.

Hope this helps,
Justin



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of santosh
Sent: Thursday, November 01, 2007 8:37 AM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] HUD in multiple display

Hi Guys

I had created a HUD for text display and added in the root node. For 
multiple screen display I added the slaves in viewer.
Now I am getting the text on every slave camera which I don't want. I 
want it to be in  only one display.
What sould I do for this ?

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


Re: [osg-users] OSG + sky

2007-11-01 Thread [EMAIL PROTECTED]
Adrian Egli wrote:
 Hi Jim,
 
 do you have a example or demo 


The Combat Simulator Project (CSP)
http://csp.sourceforge.net/wiki/Main_Page

the sky is also used by:
Global Conflict Blue (GCB)
http://gcblue.com/wiki/index.php/Main_Page

both are gpl projects

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


Re: [osg-users] Demo.... Kd-Tree

2007-11-01 Thread Adrian Egli
:-) no source at the moment for this version, look through the forum and you
will find the source


2007/11/1, Cedric Pinson [EMAIL PROTECTED]:

 I can't test it under Linux, do you have the source tree, i ll try to
 compile it


 Adrian Egli wrote:
  http://webaddon3d.assoftware.ch/AE/RTTest.rar
 
  /adegli
 
  --
  
  Adrian Egli
  
 
  ___
  osg-users mailing list
  osg-users@lists.openscenegraph.org
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 

 --
 +33 (0) 6 63 20 03 56  Cedric Pinson mailto:[EMAIL PROTECTED]
 http://www.plopbyte.net


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




-- 

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


[osg-users] osgconv

2007-11-01 Thread Argentieri, John-P63223
Robert,

osgconv --compressed still doesn't work in windows. Here's the output
from osg 2.2:

Failed to create pbuffer, failing back to normal graphics window.
Error: Unable to create graphis context - cannot run compression
Data written to 'xxx.ive'.

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


Re: [osg-users] OSG crash in _lock_fhandle

2007-11-01 Thread Felix Bwire
Hi there,

I would like to upload .net files in osg. How do I go about it?

Thanx,
Felix

On 9/26/07, Gert van Maren [EMAIL PROTECTED] wrote:

 Hi Robert,

  Thanks for the stack trace but it doesn't really help me much in
  working out what might be amiss.  Does this crash on exit occur in the
  OSG examples or just your app?

 I haven't tried any of the OSG examples. It happens in our app when
 exiting in window mode via the window 'x'. It happens only once, twice a
 day while I am debugging so hard to catch.

   Does it happen on all machines?

 Just tried it on my dual core machine.

   Have
  you tried changing the threading model of the viewer?

 No I haven't. It is hard to catch it. Will try and get more consistent
 crashes.

 Gert



 --
 Gert van Maren

 Head of Research  Development
 K2Vi Virtual Reality Software
 Data Interface Technologies Ltd

 Phone: +64 21 2855581
 Email: [EMAIL PROTECTED]
 Web: http://www.k2vi.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


[osg-users] When is it safe to modify the scenegraph?

2007-11-01 Thread Stephan Maximilian Huber
Hi,

I am updating to osg2.2 and wnat to use the new threading models, but I 
am experiencing problems when using a threading model different to 
SingleThreaded.

So when it is safe to modify the scenegraph? My scenegraph is very 
dynamic, lots of geometries get added, recomputed or removed.

my run-loop looks something like this

while(!_done) {

  // do my animations
  af-animate();
 
  advance();
  eventTraversal();
  updateTraversal();
  renderingTraversal();
}

One of the observed problems is a crash, when I dirty the displaylist of 
a geometry (inside animate()) and when this geometry get drawn at the 
same time. My code Crashes with threading-model 
cullThreadPerCameraDrawThreadPerContext, all other seem to work.

So, when it is safe to modify the scenegraph?

thanks,
Stephan

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


Re: [osg-users] When is it safe to modify the scenegraph?

2007-11-01 Thread Robert Osfield
HI Stephan,

Any Drawable or StateSet that is modified needs to have its
DataVariance set to DYNAMIC when you take advantage of the
DrawThreadPerContext and CullThreadPerCameraDrawThreadPerContext
threading models.

This prevents the next frame from starting till all the dynamic bits
of the scene graph being drawn are dispatched into the OpenGL fifo,
and therefore prevents you from modifying things at the same time they
are being read from.

Robert.

On 11/1/07, Stephan Maximilian Huber [EMAIL PROTECTED] wrote:
 Hi,

 I am updating to osg2.2 and wnat to use the new threading models, but I
 am experiencing problems when using a threading model different to
 SingleThreaded.

 So when it is safe to modify the scenegraph? My scenegraph is very
 dynamic, lots of geometries get added, recomputed or removed.

 my run-loop looks something like this

 while(!_done) {

   // do my animations
   af-animate();

   advance();
   eventTraversal();
   updateTraversal();
   renderingTraversal();
 }

 One of the observed problems is a crash, when I dirty the displaylist of
 a geometry (inside animate()) and when this geometry get drawn at the
 same time. My code Crashes with threading-model
 cullThreadPerCameraDrawThreadPerContext, all other seem to work.

 So, when it is safe to modify the scenegraph?

 thanks,
 Stephan

 ___
 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] Scene renders black when replacing a ShadowedScene

2007-11-01 Thread Chris Denham
I'm getting a problem when assigning a new shadowed scene to the viewer.
What seems to happen is that once the first scene has been rendered,
the assignment of a new shadowed scene results in a everything in the
scene being drawn black. Also odd is the fact that there doesn't seem
to be a problem when a texture is assigned to objects being drawn.

I have created a minimal example that exhibits the problem, and pasted
it below.
Any ideas what's going wrong? Can anyone reproduce the effect?

[I'm using osg2.2 on windowsXP with Radeon X300 with latest drivers.]


#include osg/ShapeDrawable
#include osg/Geode
#include osgGA/TrackballManipulator
#include osgShadow/ShadowedScene
#include osgShadow/ShadowMap
#include osgDB/ReadFile
#include osgViewer/Viewer

const int ReceivesShadowTraversalMask = 0x1;
const int CastsShadowTraversalMask = 0x2;

osg::Node* createShadowedScene(bool withTexture)
{
osgShadow::ShadowedScene* shadowedScene = new osgShadow::ShadowedScene;
shadowedScene-setReceivesShadowTraversalMask(ReceivesShadowTraversalMask);
shadowedScene-setCastsShadowTraversalMask(CastsShadowTraversalMask);
shadowedScene-setShadowTechnique(new osgShadow::ShadowMap());

osg::LightSource* lightSource = new osg::LightSource;
lightSource-getLight()-setPosition(osg::Vec4(0, 0.2, 1, 0));

osg::ShapeDrawable * shape = new osg::ShapeDrawable(new
osg::Sphere(osg::Vec3(0.0f, 0.0f, 0.0f), 200.0));
shape-setColor(osg::Vec4(0.8f, 0.8f, 0.8f, 1.0f));
osg::Geode* geode = new osg::Geode();
geode-addDrawable(shape);

if (withTexture)
{
geode-getOrCreateStateSet()-setTextureAttributeAndModes( 0,
new osg::Texture2D(osgDB::readImageFile(Images/lz.rgb)),
osg::StateAttribute::ON);
}

shadowedScene-addChild(geode);
shadowedScene-addChild(lightSource);

return shadowedScene;
}

int main(int argc, char** argv)
{
bool withTexture = false;

osgViewer::Viewer viewer;
viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
viewer.setCameraManipulator(new osgGA::TrackballManipulator());
viewer.realize();

viewer.setSceneData(createShadowedScene(withTexture));
#if 1
// Drawing the frame then assigning a new shadowed scene
// seems to result in scene being rendered black.
// Although, seems ok when texture is assigned to the object.
viewer.frame();
viewer.setSceneData(createShadowedScene(withTexture));
#endif

viewer.run();

return 0;
}

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


Re: [osg-users] Scene renders black when replacing a ShadowedScene

2007-11-01 Thread Mihai Radu
Just to make sure I understand the issue: from what you are describing,
the problem is that non-textured scene is drawn is black.

This is a result of the shader in use, if you are using the one for
textured objects, it will do a texture access on unit 0, and since there
is no bound texture the result is vec4(0,0,0,1), that when multiplied to
any other color value gives black.

This is a result of some polish still needed for ShadowMap, and some of
the options are:
- if using non-textured scene, make use of the relevant shader ( by
setting _shadowTextureUnit to 0, and then init() )
- set a custom shader and use per-object uniform flag to control color
application ( this is what I've done for work )
   like this:
 if (!s_TexturedObject)
 {
 color.rgb *= gl_Color.rgb;
 color.a = gl_Color.a;
 }
 else
 {
 texColor = texture2D(osgShadow_baseTexture, gl_TexCoord[0].st);
 color *= texColor;
 }
- the most elegant solution :
create a 'fake' texture with (1,1,1,1) and set it to the root of the
scene, so that it will texture any object that was not textured, but
it's superseded by any more localized textures, this way one shader will
work for all objects.
This is borrowed from ParallelSplitShadowMap, and I hope I'll have time
to integrate the same idea in ShadowMap.

Cheers
Mihai

Chris Denham wrote:
 I'm getting a problem when assigning a new shadowed scene to the viewer.
 What seems to happen is that once the first scene has been rendered,
 the assignment of a new shadowed scene results in a everything in the
 scene being drawn black. Also odd is the fact that there doesn't seem
 to be a problem when a texture is assigned to objects being drawn.

 I have created a minimal example that exhibits the problem, and pasted
 it below.
 Any ideas what's going wrong? Can anyone reproduce the effect?

 [I'm using osg2.2 on windowsXP with Radeon X300 with latest drivers.]

 
 #include osg/ShapeDrawable
 #include osg/Geode
 #include osgGA/TrackballManipulator
 #include osgShadow/ShadowedScene
 #include osgShadow/ShadowMap
 #include osgDB/ReadFile
 #include osgViewer/Viewer

 const int ReceivesShadowTraversalMask = 0x1;
 const int CastsShadowTraversalMask = 0x2;

 osg::Node* createShadowedScene(bool withTexture)
 {
 osgShadow::ShadowedScene* shadowedScene = new osgShadow::ShadowedScene;
 
 shadowedScene-setReceivesShadowTraversalMask(ReceivesShadowTraversalMask);
 shadowedScene-setCastsShadowTraversalMask(CastsShadowTraversalMask);
 shadowedScene-setShadowTechnique(new osgShadow::ShadowMap());

 osg::LightSource* lightSource = new osg::LightSource;
 lightSource-getLight()-setPosition(osg::Vec4(0, 0.2, 1, 0));

 osg::ShapeDrawable * shape = new osg::ShapeDrawable(new
 osg::Sphere(osg::Vec3(0.0f, 0.0f, 0.0f), 200.0));
 shape-setColor(osg::Vec4(0.8f, 0.8f, 0.8f, 1.0f));
 osg::Geode* geode = new osg::Geode();
 geode-addDrawable(shape);

 if (withTexture)
 {
 geode-getOrCreateStateSet()-setTextureAttributeAndModes( 0,
 new osg::Texture2D(osgDB::readImageFile(Images/lz.rgb)),
 osg::StateAttribute::ON);
 }
   
 shadowedScene-addChild(geode);
 shadowedScene-addChild(lightSource);

 return shadowedScene;
 }

 int main(int argc, char** argv)
 {
   bool withTexture = false;

 osgViewer::Viewer viewer;
 viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
   viewer.setCameraManipulator(new osgGA::TrackballManipulator());
 viewer.realize();

 viewer.setSceneData(createShadowedScene(withTexture));
 #if 1
   // Drawing the frame then assigning a new shadowed scene
   // seems to result in scene being rendered black.
   // Although, seems ok when texture is assigned to the object.
   viewer.frame();
   viewer.setSceneData(createShadowedScene(withTexture));
 #endif

   viewer.run();

 return 0;
 }

 #endif
 ___
 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] Demo.... Kd-Tree

2007-11-01 Thread Mihai Radu
Hi Adrian,

kd-tree looks like a nice structure to have, in my case for other things
than ray-tracing, like optimizing collisions and path-finding, to be
local to one partition.
Are you planning to integrate kd-tree into osg as a generic algorithm ?
In that case how could it be used ?

If you want some help in this project, let me know how I could start (
not much ray-tracing experience ), but another pair of eyes might be useful.

Cheers
Mihai

Adrian Egli wrote:
 :-) no source at the moment for this version, look through the forum
 and you will find the source


 2007/11/1, Cedric Pinson [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]:

 I can't test it under Linux, do you have the source tree, i ll try to
 compile it


 Adrian Egli wrote:
  http://webaddon3d.assoftware.ch/AE/RTTest.rar
 
  /adegli
 
  --
  
  Adrian Egli
 
 
 
  ___
  osg-users mailing list
  osg-users@lists.openscenegraph.org
 mailto:osg-users@lists.openscenegraph.org
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 

 --
 +33 (0) 6 63 20 03 56  Cedric Pinson mailto:[EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] http://www.plopbyte.net


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




 -- 
 
 Adrian Egli
 

 ___
 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] Shadowmap fidelity for an enironment and objects within it

2007-11-01 Thread Guerrero, Michael (CIV)
Hi, I'm a developer with Delta3D which uses OSG and I've recently
converted a scene to use shadowmaps.  I've managed to get decent results
on the level using a 2048x2048 shadow map but any smaller object within
the level such as a character produces shadows of unacceptable quality.
Please see the following images:

 

Image of the entire scene:
http://img504.imageshack.us/my.php?image=fullscenesp7.jpg

 

Character1: http://img64.imageshack.us/my.php?image=soldier1nj1.jpg

Character2: http://img64.imageshack.us/my.php?image=soldier2ra7.jpg

Character3: http://img229.imageshack.us/my.php?image=soldier3oo3.jpg

 

My question:  is there a way to use multiple shadow maps in a scene?
Maybe one for each character?

 

Thanks,

Michael Guerrero

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


Re: [osg-users] Shadowmap fidelity for an enironment and objects within it

2007-11-01 Thread Mihai Radu
Hi Michael,

Right now there is no implementation that uses multiple simple shadow
maps in osg.
There is ParalelSplitShadowMap, that uses multiple maps but the split is
based on the view frustum, not individual characters. Try and see if it
gives you nice results, it's meant for use large terrains with better
quality closer to the camera eye.

The modifications to ShadowMap would not be extensive, but there would
be a need for a vector of ShadowMap cameras, textures and texgens with
the relevant frustum updates. I would suggest either using node masks to
handle which objects cast shadows, or maybe spotlights with the target
centered on characters, on a relative position to the main transform of
the object, so they follow along.

You are welcome to pitch-in and adapt ShadowMap to this use.

Cheers
Mihai

Guerrero, Michael (CIV) wrote:

 Hi, I’m a developer with Delta3D which uses OSG and I’ve recently
 converted a scene to use shadowmaps.  I’ve managed to get decent
 results on the level using a 2048x2048 shadow map but any smaller
 object within the level such as a character produces shadows of
 unacceptable quality.  Please see the following images:

  

 Image of the entire scene:
 http://img504.imageshack.us/my.php?image=fullscenesp7.jpg

  

 Character1: http://img64.imageshack.us/my.php?image=soldier1nj1.jpg

 Character2: http://img64.imageshack.us/my.php?image=soldier2ra7.jpg

 Character3: http://img229.imageshack.us/my.php?image=soldier3oo3.jpg

  

 My question:  is there a way to use multiple shadow maps in a scene? 
 Maybe one for each character?

  

 Thanks,

 Michael Guerrero

 

 ___
 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] How to get eye positions in passive stereo?

2007-11-01 Thread Jurgen Schulze
Hi,

We are trying to figure out at what positions the eyes are in stereo mode.
The scene gets rendered correctly, but the following code returns the same
exact positions for leftEye and rightEye:

osg::Camera* camLeft  = _renderStageLeft-getCamera();
osg::Camera* camRight = _renderStageRight-getCamera();
Vec3 leftEye, rightEye, center, up;
camLeft-getViewMatrixAsLookAt(leftEye, center, up);
camRight-getViewMatrixAsLookAt(rightEye, center, up);

osg::notify(osg::DEBUG_INFO)  Left eye:leftEye[0]
 ,leftEye[1]  ,leftEye[2]  std::endl;
osg::notify(osg::DEBUG_INFO)  Right eye:   rightEye[0]
 ,   rightEye[1]  ,   rightEye[2]  std::endl;


How can we get the correct positions, which should be 1 IOD apart from each
other?

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


Re: [osg-users] Scene renders black when replacing a ShadowedScene

2007-11-01 Thread Adrian Egli
:-) Yes a fake texture can help GLSL shader based issue. Feel free to
migrate the other shadow
technics.  And if you like working with PSSM feel free to fix the little
issues we still have. i don't
get the time to work on PSSM for next generation.

/adegli

2007/11/1, Mihai Radu [EMAIL PROTECTED]:

 Just to make sure I understand the issue: from what you are describing,
 the problem is that non-textured scene is drawn is black.

 This is a result of the shader in use, if you are using the one for
 textured objects, it will do a texture access on unit 0, and since there
 is no bound texture the result is vec4(0,0,0,1), that when multiplied to
 any other color value gives black.

 This is a result of some polish still needed for ShadowMap, and some of
 the options are:
 - if using non-textured scene, make use of the relevant shader ( by
 setting _shadowTextureUnit to 0, and then init() )
 - set a custom shader and use per-object uniform flag to control color
 application ( this is what I've done for work )
like this:
  if (!s_TexturedObject)
  {
  color.rgb *= gl_Color.rgb;
  color.a = gl_Color.a;
  }
  else
  {
  texColor = texture2D(osgShadow_baseTexture, gl_TexCoord[0].st);
  color *= texColor;
  }
 - the most elegant solution :
 create a 'fake' texture with (1,1,1,1) and set it to the root of the
 scene, so that it will texture any object that was not textured, but
 it's superseded by any more localized textures, this way one shader will
 work for all objects.
 This is borrowed from ParallelSplitShadowMap, and I hope I'll have time
 to integrate the same idea in ShadowMap.

 Cheers
 Mihai

 Chris Denham wrote:
  I'm getting a problem when assigning a new shadowed scene to the viewer.
  What seems to happen is that once the first scene has been rendered,
  the assignment of a new shadowed scene results in a everything in the
  scene being drawn black. Also odd is the fact that there doesn't seem
  to be a problem when a texture is assigned to objects being drawn.
 
  I have created a minimal example that exhibits the problem, and pasted
  it below.
  Any ideas what's going wrong? Can anyone reproduce the effect?
 
  [I'm using osg2.2 on windowsXP with Radeon X300 with latest drivers.]
 
 
 
  #include osg/ShapeDrawable
  #include osg/Geode
  #include osgGA/TrackballManipulator
  #include osgShadow/ShadowedScene
  #include osgShadow/ShadowMap
  #include osgDB/ReadFile
  #include osgViewer/Viewer
 
  const int ReceivesShadowTraversalMask = 0x1;
  const int CastsShadowTraversalMask = 0x2;
 
  osg::Node* createShadowedScene(bool withTexture)
  {
  osgShadow::ShadowedScene* shadowedScene = new
 osgShadow::ShadowedScene;
 
 shadowedScene-setReceivesShadowTraversalMask(ReceivesShadowTraversalMask);
 
 shadowedScene-setCastsShadowTraversalMask(CastsShadowTraversalMask);
  shadowedScene-setShadowTechnique(new osgShadow::ShadowMap());
 
  osg::LightSource* lightSource = new osg::LightSource;
  lightSource-getLight()-setPosition(osg::Vec4(0, 0.2, 1, 0));
 
  osg::ShapeDrawable * shape = new osg::ShapeDrawable(new
  osg::Sphere(osg::Vec3(0.0f, 0.0f, 0.0f), 200.0));
  shape-setColor(osg::Vec4(0.8f, 0.8f, 0.8f, 1.0f));
  osg::Geode* geode = new osg::Geode();
  geode-addDrawable(shape);
 
  if (withTexture)
  {
  geode-getOrCreateStateSet()-setTextureAttributeAndModes( 0,
  new osg::Texture2D(osgDB::readImageFile(Images/lz.rgb)),
  osg::StateAttribute::ON);
  }
 
  shadowedScene-addChild(geode);
  shadowedScene-addChild(lightSource);
 
  return shadowedScene;
  }
 
  int main(int argc, char** argv)
  {
bool withTexture = false;
 
  osgViewer::Viewer viewer;
  viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
viewer.setCameraManipulator(new osgGA::TrackballManipulator());
  viewer.realize();
 
  viewer.setSceneData(createShadowedScene(withTexture));
  #if 1
// Drawing the frame then assigning a new shadowed scene
// seems to result in scene being rendered black.
// Although, seems ok when texture is assigned to the object.
viewer.frame();
viewer.setSceneData(createShadowedScene(withTexture));
  #endif
 
viewer.run();
 
  return 0;
  }
 
  #endif
  ___
  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




-- 

Adrian Egli
___
osg-users mailing list
osg-users@lists.openscenegraph.org

Re: [osg-users] Scene renders black when replacing a ShadowedScene

2007-11-01 Thread Mihai Radu
Hi Chris, Adrian

Here's an updated version of ShadowMap[.cpp] that includes the 'fake'
texture.

Now any model will show up properly, textured or nor.
To see run [the dumptruck is not textured] :
osgshadow dumptruck.osg

Adrian, in your code (PSSM) you assign black(0,0,0,0) as the color for
the 'fake', this gives the same result as a bad texture access, it works
perfectly if you set it to white(1,1,1,1).

This is a nice loose end to take care of, I can now do without an 'if'
in GLSL, and since it's a pretty costly operation, every little bit helps :)
I will submit this to Robert for svn.

Cheers
Mihai
cid:part1.08090808.06060803@cm-labs.comAdrian Egli wrote:
 :-) Yes a fake texture can help GLSL shader based issue. Feel free to
 migrate the other shadow
 technics.  And if you like working with PSSM feel free to fix the
 little issues we still have. i don't
 get the time to work on PSSM for next generation.

 /adegli

 2007/11/1, Mihai Radu [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]:

 Just to make sure I understand the issue: from what you are
 describing,
 the problem is that non-textured scene is drawn is black.

 This is a result of the shader in use, if you are using the one for
 textured objects, it will do a texture access on unit 0, and since
 there
 is no bound texture the result is vec4(0,0,0,1), that when
 multiplied to
 any other color value gives black.

 This is a result of some polish still needed for ShadowMap, and
 some of
 the options are:
 - if using non-textured scene, make use of the relevant shader ( by
 setting _shadowTextureUnit to 0, and then init() )
 - set a custom shader and use per-object uniform flag to control color
 application ( this is what I've done for work )
like this:
  if (!s_TexturedObject)
  {
  color.rgb *= gl_Color.rgb;
  color.a = gl_Color.a;
  }
  else
  {
  texColor = texture2D(osgShadow_baseTexture,
 gl_TexCoord[0].st);
  color *= texColor;
  }
 - the most elegant solution :
 create a 'fake' texture with (1,1,1,1) and set it to the root
 of the
 scene, so that it will texture any object that was not textured, but
 it's superseded by any more localized textures, this way one
 shader will
 work for all objects.
 This is borrowed from ParallelSplitShadowMap, and I hope I'll have
 time
 to integrate the same idea in ShadowMap.

 Cheers
 Mihai

 Chris Denham wrote:
  I'm getting a problem when assigning a new shadowed scene to the
 viewer.
  What seems to happen is that once the first scene has been rendered,
  the assignment of a new shadowed scene results in a everything
 in the
  scene being drawn black. Also odd is the fact that there doesn't
 seem
  to be a problem when a texture is assigned to objects being drawn.
 
  I have created a minimal example that exhibits the problem, and
 pasted
  it below.
  Any ideas what's going wrong? Can anyone reproduce the effect?
 
  [I'm using osg2.2 on windowsXP with Radeon X300 with latest
 drivers.]
 
 
 
 

  #include osg/ShapeDrawable
  #include osg/Geode
  #include osgGA/TrackballManipulator
  #include osgShadow/ShadowedScene
  #include osgShadow/ShadowMap
  #include osgDB/ReadFile
  #include osgViewer/Viewer
 
  const int ReceivesShadowTraversalMask = 0x1;
  const int CastsShadowTraversalMask = 0x2;
 
  osg::Node* createShadowedScene(bool withTexture)
  {
  osgShadow::ShadowedScene* shadowedScene = new
 osgShadow::ShadowedScene;
 
 
 shadowedScene-setReceivesShadowTraversalMask(ReceivesShadowTraversalMask);
 
 shadowedScene-setCastsShadowTraversalMask(CastsShadowTraversalMask);
  shadowedScene-setShadowTechnique(new osgShadow::ShadowMap());
 
  osg::LightSource* lightSource = new osg::LightSource;
  lightSource-getLight()-setPosition(osg::Vec4(0, 0.2, 1, 0));
 
  osg::ShapeDrawable * shape = new osg::ShapeDrawable(new
  osg::Sphere(osg::Vec3(0.0f, 0.0f, 0.0f), 200.0));
  shape-setColor(osg::Vec4(0.8f, 0.8f, 0.8f, 1.0f));
  osg::Geode* geode = new osg::Geode();
  geode-addDrawable(shape);
 
  if (withTexture)
  {
 
 geode-getOrCreateStateSet()-setTextureAttributeAndModes( 0,
  new osg::Texture2D(osgDB::readImageFile(Images/lz.rgb)),
  osg::StateAttribute::ON);
  }
 
  shadowedScene-addChild(geode);
  shadowedScene-addChild(lightSource);
 
  return shadowedScene;
  }
 
  int main(int argc, char** argv)
  {
bool withTexture = false;
 
  

Re: [osg-users] Shadowmap fidelity for an enironment and objects within it

2007-11-01 Thread Adrian Egli
Hi Michael,

may you need just to change to the parallel split shadow map. osgshadow
--pssm ...

/adegli

2007/11/1, Guerrero, Michael (CIV) [EMAIL PROTECTED]:

  Hi, I'm a developer with Delta3D which uses OSG and I've recently
 converted a scene to use shadowmaps.  I've managed to get decent results on
 the level using a 2048x2048 shadow map but any smaller object within the
 level such as a character produces shadows of unacceptable quality.  Please
 see the following images:



 Image of the entire scene:
 http://img504.imageshack.us/my.php?image=fullscenesp7.jpg



 Character1: http://img64.imageshack.us/my.php?image=soldier1nj1.jpg

 Character2: http://img64.imageshack.us/my.php?image=soldier2ra7.jpg

 Character3: http://img229.imageshack.us/my.php?image=soldier3oo3.jpg



 My question:  is there a way to use multiple shadow maps in a scene?
 Maybe one for each character?



 Thanks,

 Michael Guerrero

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




-- 

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


Re: [osg-users] Scene renders black when replacing a ShadowedScene

2007-11-01 Thread Adrian Egli
Thanks Mihai, can you also change the PSSM implementation and update the
code, so robert has only one review to do !
if i will submiss the pssm stuff, he has to review two equal changes.
thanks.

may you can also have a look at PSSM, there are other mails on this topic.
the GLSL shader doesn't work very nice for every
env. may you can test it (The smooth stuff in the PSSM doesn't work nice,
for my ATI card is nice but on others, i don't know)

/Adegli

2007/11/1, Mihai Radu [EMAIL PROTECTED]:

 Hi Chris, Adrian

 Here's an updated version of ShadowMap[.cpp] that includes the 'fake'
 texture.

 Now any model will show up properly, textured or nor.
 To see run [the dumptruck is not textured] :
 osgshadow dumptruck.osg

 Adrian, in your code (PSSM) you assign black(0,0,0,0) as the color for
 the 'fake', this gives the same result as a bad texture access, it works
 perfectly if you set it to white(1,1,1,1).

 This is a nice loose end to take care of, I can now do without an 'if'
 in GLSL, and since it's a pretty costly operation, every little bit helps
 :)
 I will submit this to Robert for svn.

 Cheers
 Mihai
 cid:part1.08090808.06060803@cm-labs.comAdrian Egli wrote:
  :-) Yes a fake texture can help GLSL shader based issue. Feel free to
  migrate the other shadow
  technics.  And if you like working with PSSM feel free to fix the
  little issues we still have. i don't
  get the time to work on PSSM for next generation.
 
  /adegli
 
  2007/11/1, Mihai Radu [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]:
 
  Just to make sure I understand the issue: from what you are
  describing,
  the problem is that non-textured scene is drawn is black.
 
  This is a result of the shader in use, if you are using the one for
  textured objects, it will do a texture access on unit 0, and since
  there
  is no bound texture the result is vec4(0,0,0,1), that when
  multiplied to
  any other color value gives black.
 
  This is a result of some polish still needed for ShadowMap, and
  some of
  the options are:
  - if using non-textured scene, make use of the relevant shader ( by
  setting _shadowTextureUnit to 0, and then init() )
  - set a custom shader and use per-object uniform flag to control
 color
  application ( this is what I've done for work )
 like this:
   if (!s_TexturedObject)
   {
   color.rgb *= gl_Color.rgb;
   color.a = gl_Color.a;
   }
   else
   {
   texColor = texture2D(osgShadow_baseTexture,
  gl_TexCoord[0].st);
   color *= texColor;
   }
  - the most elegant solution :
  create a 'fake' texture with (1,1,1,1) and set it to the root
  of the
  scene, so that it will texture any object that was not textured, but
  it's superseded by any more localized textures, this way one
  shader will
  work for all objects.
  This is borrowed from ParallelSplitShadowMap, and I hope I'll have
  time
  to integrate the same idea in ShadowMap.
 
  Cheers
  Mihai
 
  Chris Denham wrote:
   I'm getting a problem when assigning a new shadowed scene to the
  viewer.
   What seems to happen is that once the first scene has been
 rendered,
   the assignment of a new shadowed scene results in a everything
  in the
   scene being drawn black. Also odd is the fact that there doesn't
  seem
   to be a problem when a texture is assigned to objects being drawn.
  
   I have created a minimal example that exhibits the problem, and
  pasted
   it below.
   Any ideas what's going wrong? Can anyone reproduce the effect?
  
   [I'm using osg2.2 on windowsXP with Radeon X300 with latest
  drivers.]
  
  
 
 
 
   #include osg/ShapeDrawable
   #include osg/Geode
   #include osgGA/TrackballManipulator
   #include osgShadow/ShadowedScene
   #include osgShadow/ShadowMap
   #include osgDB/ReadFile
   #include osgViewer/Viewer
  
   const int ReceivesShadowTraversalMask = 0x1;
   const int CastsShadowTraversalMask = 0x2;
  
   osg::Node* createShadowedScene(bool withTexture)
   {
   osgShadow::ShadowedScene* shadowedScene = new
  osgShadow::ShadowedScene;
  
 
 shadowedScene-setReceivesShadowTraversalMask(ReceivesShadowTraversalMask);
  
 
 shadowedScene-setCastsShadowTraversalMask(CastsShadowTraversalMask);
   shadowedScene-setShadowTechnique(new osgShadow::ShadowMap());
  
   osg::LightSource* lightSource = new osg::LightSource;
   lightSource-getLight()-setPosition(osg::Vec4(0, 0.2, 1, 0));
  
   osg::ShapeDrawable * shape = new osg::ShapeDrawable(new
   osg::Sphere(osg::Vec3(0.0f, 0.0f, 0.0f), 200.0));