Re: [osg-users] Precipitation Effect, Snow, bad rendering at slow speed

2009-12-22 Thread Robert Osfield
Hi Massimo,

Thanks for the pictures.  Moving slow is a walking pace, not at
360km/h.. that's pretty fast in my book.  The streaks are motion blurr
on the particles as when you are moving fast the particle moves
relative to the eye point between frames will be stretched out.  As
the particle is stretched out the alpha value also gets reduced so it
becomes more transparent particle to make sure the overall coverage of
the background is the same.  So the slow case it looks like things
are working correctly to me.

For the fast case the motion blur support in PrecipitationEffect is
failing as the camera is moving so fast between the particle cells
that their is no previous frame position recorded for it to compute
the motion blur for.  This is a limitation/bug in PreciptationEffect.
I wrote this class originally for a driving sim so it works well for
driving speeds, but at jet aircraft speeds this particle cell issue
rears it's head.  These cells are virtual cells, which are in fact a
single osg::Geometry that is transformed many times in the view in
front of you, these virtual cells are reassigned on the fly to give
you the effect of having an infinite particle system.

I can think of two solutions - to better compute the previous frame
position of a virtual cell that is newly coming into the view, or the
more hacky solution, increase the depth of cells further out from
camera so that the first frame that they become in view are miss out
on the motion blur is far away enough from the camera as to not be
seen.  The former of the two solution really has to be the right way
to go.

Now fixing this bug will lead to motion blur at both your slow and
fast speeds, which I can't say how you'll react to, as you picked out
the slow viz as the one in error, rather than the fast speed.  One
could possible offer the option of removing the motion blur effect or
scaling it down, but this itself might lead to other artifacts such as
strobe like effect as you will find it easier to spot patterns in the
particles as you go from cell to cell.

Robert.

On Mon, Dec 21, 2009 at 8:12 PM, Massimo Tarantini subbi...@yahoo.it wrote:

 From your description it sounds like an issue that occurs when the
 camera moves very fast relative to the particle system, rather than
 very slow.  My only guess is that you've model units that aren't in
 meters so the velocities are out.



 Now i have also posted the 3 images to imageshack:

 http://img189.imageshack.us/img189/5565/static594.jpg
 http://img189.imageshack.us/img189/9955/movingslow526.jpg
 http://img189.imageshack.us/img189/5372/movingfast976.jpg

 Anyway, the problem is in movingslow526.jpg at 360kmh, while 
 movingfast976.jpg at 1800kmh is better, and static594.jpg (stopped) is 
 perfect.
 My terrain is generated with osgdem (non Geogentric), and is in UTM33/WGS84. 
 The  Geographics coordinates are in meters.

 Thanks.[/list]

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





 ___
 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] Precipitation Effect, Snow, bad rendering at slow speed

2009-12-22 Thread Massimo Tarantini

robertosfield wrote:
 Hi Massimo,
 
 Thanks for the pictures.  Moving slow is a walking pace, not at
 360km/h.. that's pretty fast in my book.  The streaks are motion blurr
 on the particles as when you are moving fast the particle moves
 relative to the eye point between frames will be stretched out.  [...]
 


Thanks for the long answer,
and sorry for my lack of precision about slow speed.

...

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





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


Re: [osg-users] Precipitation Effect, Snow, bad rendering at slow speed

2009-12-21 Thread Massimo Tarantini

 From your description it sounds like an issue that occurs when the
 camera moves very fast relative to the particle system, rather than
 very slow.  My only guess is that you've model units that aren't in
 meters so the velocities are out.
 


Now i have also posted the 3 images to imageshack:

http://img189.imageshack.us/img189/5565/static594.jpg
http://img189.imageshack.us/img189/9955/movingslow526.jpg
http://img189.imageshack.us/img189/5372/movingfast976.jpg

Anyway, the problem is in movingslow526.jpg at 360kmh, while movingfast976.jpg 
at 1800kmh is better, and static594.jpg (stopped) is perfect.
My terrain is generated with osgdem (non Geogentric), and is in UTM33/WGS84. 
The  Geographics coordinates are in meters.

Thanks.[/list]

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





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


Re: [osg-users] Precipitation Effect, Snow, bad rendering at slow speed

2009-12-19 Thread Robert Osfield
Hi Massimo,

On Fri, Dec 18, 2009 at 6:04 PM, Massimo Tarantini subbi...@yahoo.it wrote:
 I have attached 3 Images to show what i mean.
 In the image moving_slow.jpg the camera is moving slowly towards the 
 mountains, and the snow looks like rays of light coming out of the screen.

The pictures didn't come through.  I use the mailing lists, but
checked the forum thread and it doesn't show any pictures either.

From your description it sounds like an issue that occurs when the
camera moves very fast relative to the particle system, rather than
very slow.  My only guess is that you've model units that aren't in
meters so the velocities are out.

Try the precipitation example to see if it works fine.


 With vync do you mean Wait Vertical Update ON/OFF?
 I have tried both in ATI Control Panel, and nothing change.

vysnc is Vertical Sync (of the graphics swap buffers with monitor
refresh), with will be likely Wait Vertex Update in your control
panel.

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


[osg-users] Precipitation Effect, Snow, bad rendering at slow speed

2009-12-18 Thread Massimo Tarantini
Hi all,

i have added some snow to my scene (it's Christmas time!), after looking the 
example osgprecipitation. 
It renders very well when the scene is static, and quite well when moving fast, 
but very bad when moving slow.


Code:
osg::ref_ptrosgParticle::PrecipitationEffect precipitationEffect = new 
osgParticle::PrecipitationEffect;
precipitationEffect-snow(1.0);
/* It Does not work, if i set to false: what does it mean? */
precipitationEffect-setUseFarLineSegments(true);
precipitationEffect-getFog()-setDensity(0.00012f);
precipitationEffect-getFog()-setMode(osg::Fog::EXP2);
precipitationEffect-getFog()-setFogCoordinateSource(osg::Fog::FRAGMENT_DEPTH);
root-addChild( precipitationEffect.get() );
root-getOrCreateStateSet()-setAttributeAndModes(precipitationEffect-getFog());



Can you give me some hint? 
It Could a problem of my ATI Radeon 3650 AGP, or could be my code?

Thanks

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




Attachments: 
http://forum.openscenegraph.org//files/moving_fast_976.jpg
http://forum.openscenegraph.org//files/moving_slow_526.jpg
http://forum.openscenegraph.org//files/static_594.jpg


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


Re: [osg-users] Precipitation Effect, Snow, bad rendering at slow speed

2009-12-18 Thread Robert Osfield
HI Massimo,

What exactly do you mean by bad rendering?

Do you have vync on?

Robert.

On Fri, Dec 18, 2009 at 1:58 PM, Massimo Tarantini subbi...@yahoo.it wrote:
 Hi all,

 i have added some snow to my scene (it's Christmas time!), after looking the 
 example osgprecipitation.
 It renders very well when the scene is static, and quite well when moving 
 fast, but very bad when moving slow.


 Code:
 osg::ref_ptrosgParticle::PrecipitationEffect precipitationEffect = new 
 osgParticle::PrecipitationEffect;
 precipitationEffect-snow(1.0);
 /* It Does not work, if i set to false: what does it mean? */
 precipitationEffect-setUseFarLineSegments(true);
 precipitationEffect-getFog()-setDensity(0.00012f);
 precipitationEffect-getFog()-setMode(osg::Fog::EXP2);
 precipitationEffect-getFog()-setFogCoordinateSource(osg::Fog::FRAGMENT_DEPTH);
 root-addChild( precipitationEffect.get() );
 root-getOrCreateStateSet()-setAttributeAndModes(precipitationEffect-getFog());



 Can you give me some hint?
 It Could a problem of my ATI Radeon 3650 AGP, or could be my code?

 Thanks

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




 Attachments:
 http://forum.openscenegraph.org//files/moving_fast_976.jpg
 http://forum.openscenegraph.org//files/moving_slow_526.jpg
 http://forum.openscenegraph.org//files/static_594.jpg


 ___
 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] Precipitation Effect, Snow, bad rendering at slow speed

2009-12-18 Thread Massimo Tarantini

robertosfield wrote:
 HI Massimo,
 
 What exactly do you mean by bad rendering?
 Do you have vync on?
 
 Robert.
 


Thanks for your answer Sir,
and... sorry for my bad English. 

I have attached 3 Images to show what i mean. 
In the image moving_slow.jpg the camera is moving slowly towards the mountains, 
and the snow looks like rays of light coming out of the screen. 

With vync do you mean Wait Vertical Update ON/OFF?
I have tried both in ATI Control Panel, and nothing change.

...

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





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


Re: [osg-users] Precipitation effect coming too fast, and hiding on some areas

2008-12-19 Thread Robert Osfield
Hi Fred and Jefferson,

On Thu, Dec 18, 2008 at 8:39 AM,  fredlis...@free.fr wrote:
 Unfortunately, it doesn't seem to work ( at least for me ). I modified the 
 osgprecipitation example to add a simple clip plane, and although the model 
 is clipped, the rain continues to appear in the half space clipped.

 Attached the modified example.

I tested the modified example and it didn't function for a number of reasons..

First up the clipping plane has to be placed in eye coordinates and
osg::ClipNode didn't provide an option for placing it in an absolute
reference frame (an absolute/identity view matrix puts you in eye
coords) so I went ahead an added this to osg::ClipNode, so there now
is a ClipNode::setReferenceFrame(RefernceFrame) method along the same
lines as the same method in osg::LightSource, osg::TexGenNode and
osg::Camera (all instance have the same menaning.)

The next problem was that ClipNode was decorating the whole scene, not
just the precipitation effect so I restructed the example.  So it now
looks like (note the setReferenceFrame and CliPlane in eye coords) :

osg::ref_ptrosg::Group group = new osg::Group;

if (clipDistance!=0.0)
{
osg::ref_ptrosg::ClipNode clipNode = new osg::ClipNode;
clipNode-addClipPlane( new osg::ClipPlane( 0 ) );
clipNode-getClipPlane(0)-setClipPlane( 0.0, 0.0, -1.0,
-clipDistance );
clipNode-setReferenceFrame(osg::ClipNode::ABSOLUTE_RF);
clipNode-addChild(precipitationEffect.get());

group-addChild(clipNode.get());
}
else
{
group-addChild(precipitationEffect.get());
}

group-addChild(loadedModel.get());

The osgprecitpitation example also now has a --clip distance command
line option to allow us to enable the above optional code path.  Try
values like 10 or 20 when loading the standard test example lz.osg.

Once this was all in place the precipitation effect still wasn't being
clipped, so I investigated user defined clipping plane and GLSL and
found that we need to explicitly set the gl_ClipVertex variable the
vertex shader.  Adding this fixed the clipping problem and hey presto
we can clip the precipitation effect and not the scene.

All these changes are now checked into svn/trunk and will be part of
the up coming 2.7.8 dev release.

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


Re: [osg-users] Precipitation effect coming too fast, and hiding on some areas

2008-12-18 Thread fredlist01
Hi Robert  Jefferson,

- Jefferson Pinheiro a écrit :
 
 2) Use an osg::ClipPlane to clip the precipitation effect. Using a
 clip plan would also allow you to control angle of the clipping.
 
 I don't know how to use that (I'm a beginner). Fred, I would be
 grateful if you could share your code, if you do it.

Unfortunately, it doesn't seem to work ( at least for me ). I modified the 
osgprecipitation example to add a simple clip plane, and although the model is 
clipped, the rain continues to appear in the half space clipped.

Attached the modified example.

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

#include osgDB/ReadFile
#include osgDB/FileUtils
#include osgUtil/Optimizer
#include osgUtil/CullVisitor
#include osgViewer/Viewer
#include osg/ClipNode

#include osg/MatrixTransform
#include osgUtil/TransformCallback
#include osgParticle/PrecipitationEffect

#include iostream

class MyGustCallback : public osg::NodeCallback
{

public:

MyGustCallback() {}

virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
osgParticle::PrecipitationEffect* pe = 
dynamic_castosgParticle::PrecipitationEffect*(node);

float value = sin(nv-getFrameStamp()-getSimulationTime());
if (value-0.5)
{
pe-snow(1.0);
}
else
{
pe-rain(0.5);
}

traverse(node, nv);
}
};


int main( int argc, char **argv )
{

// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(argc,argv);

// set up the usage document, in case we need to print out how to use this 
program.

arguments.getApplicationUsage()-setApplicationName(arguments.getApplicationName());

arguments.getApplicationUsage()-setDescription(arguments.getApplicationName()+
 example provides an interactive viewer for visualising point clouds..);

arguments.getApplicationUsage()-setCommandLineUsage(arguments.getApplicationName()+
 [options] filename ...);
arguments.getApplicationUsage()-addCommandLineOption(-h or 
--help,Display this information);
arguments.getApplicationUsage()-addCommandLineOption(--snow 
density,Set the snow with a density between 0 and 1.0);
arguments.getApplicationUsage()-addCommandLineOption(--rain 
density,);
arguments.getApplicationUsage()-addCommandLineOption(--particleSize 
size,);
arguments.getApplicationUsage()-addCommandLineOption(--particleColour 
red green blue alpha,);
arguments.getApplicationUsage()-addCommandLineOption(--wind x y 
z,Set the wind speed in model coordinates);
arguments.getApplicationUsage()-addCommandLineOption(--particleSpeed 
float,Set the particle speed);
arguments.getApplicationUsage()-addCommandLineOption(--nearTransition 
distance,Set the near transistion distance);
arguments.getApplicationUsage()-addCommandLineOption(--farTransition  
distance,Set the far transistion distance);
arguments.getApplicationUsage()-addCommandLineOption(--particleDensity 
density,Set the particle density);
arguments.getApplicationUsage()-addCommandLineOption(--cellSize x y 
z,Set the cell size in model coordinates);
arguments.getApplicationUsage()-addCommandLineOption(--fogDensity 
density,Set the fog density);
arguments.getApplicationUsage()-addCommandLineOption(--fogColour red 
green blue alpha,Set fog colour.);

arguments.getApplicationUsage()-addCommandLineOption(-useFarLineSegments,Switch
 on the use of line segments);


// construct the viewer.
osgViewer::Viewer viewer;

osg::ref_ptrosgParticle::PrecipitationEffect precipitationEffect = new 
osgParticle::PrecipitationEffect;

float intensity;
while (arguments.read(--snow, intensity)) 
precipitationEffect-snow(intensity);
while (arguments.read(--rain, intensity)) 
precipitationEffect-rain(intensity);

float value;
while (arguments.read(--particleSize, value)) 
precipitationEffect-setParticleSize(value);


Re: [osg-users] Precipitation effect coming too fast, and hiding on some areas

2008-12-17 Thread Jefferson Pinheiro
Hi Robert,

On Mon, Dec 15, 2008 at 7:55 AM, Robert Osfield robert.osfi...@gmail.comwrote:

 Hi Fred  Jefferson,

 On Sun, Dec 14, 2008 at 10:49 AM, Frederic Bouvier fredlis...@free.fr
 wrote:
  I have a patch to PrecipitationEffect that seems to work. I'll submit it
  to osg-submissions

 I've just done a review of these changes and don't feel that there are
 mostr straightforward and effecient way to implement what is
 effectively near plan clipping.  The code will make the vertex program
 slower, and not cut down on rasteristation and fill load.

 I feel a better route would be to either:

 1) use two Camera's to depth partition the scene as suggested earlier
 in this thread, as this would give you control over the worlds depth
 range where the precipitation exists


This one works!



 2) Use an osg::ClipPlane to clip the precipitation effect.  Using a
 clip plan would also allow you to control angle of the clipping.


I don't know how to use that (I'm a beginner). Fred, I would be grateful if
you could share your code, if you do it.



 Neither the above routes require any changes to the core OSG, and both
 would not affect the vertex program load, and would clip out fragment
 so would cut down the fragment program load so would be more efficient
 than the submitted fix.

 Could you test out the above suggestions?

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




-- 
Jefferson Pinheiro
(51) 9192 3535
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Precipitation effect coming too fast, and hiding on some areas

2008-12-15 Thread Robert Osfield
Hi Laurent,

On Mon, Dec 15, 2008 at 10:18 AM, Laurent Di Cesare
laurent.dices...@masagroup.net wrote:
 In my application, rain inside buildings is problematic if people enter the
 buildings (which they weren't supposed to do until recently). A clip plane
 method might work better than a near/far/depth partition.

Using the stencil buffer for non planer clipping of fragments would
work in the case of buildings.   Or just switch the effect off but
this would only be fine if you didn't look out of a window.

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


Re: [osg-users] Precipitation effect coming too fast, and hiding on some areas

2008-12-15 Thread fredlist01
Hi Robert,

- Robert Osfield a écrit :

 Hi Fred  Jefferson,
 
 On Sun, Dec 14, 2008 at 10:49 AM, Frederic Bouvier
 fredlis...@free.fr wrote:
  I have a patch to PrecipitationEffect that seems to work. I'll
 submit it
  to osg-submissions
 
 I've just done a review of these changes and don't feel that there
 are
 mostr straightforward and effecient way to implement what is
 effectively near plan clipping.  The code will make the vertex
 program
 slower, and not cut down on rasteristation and fill load.
 
 I feel a better route would be to either:
 
 1) use two Camera's to depth partition the scene as suggested earlier
 in this thread, as this would give you control over the worlds depth
 range where the precipitation exists
 
 2) Use an osg::ClipPlane to clip the precipitation effect.  Using a
 clip plan would also allow you to control angle of the clipping.
 
 Neither the above routes require any changes to the core OSG, and
 both
 would not affect the vertex program load, and would clip out fragment
 so would cut down the fragment program load so would be more
 efficient
 than the submitted fix.
 
 Could you test out the above suggestions?

I will test the osg::ClipPlane route. I don't feel confortable to take 
the depth partitioning route at this moment, and we already use this 
technique for other purpose in FlightGear, that may conflict with that.
For the moment, the transition distance between the near camera and the 
far camera is too far away to be useful for this purpose.

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


Re: [osg-users] Precipitation effect coming too fast, and hiding on some areas

2008-12-15 Thread Laurent Di Cesare

Robert Osfield wrote :

Hi Fred  Jefferson,

On Sun, Dec 14, 2008 at 10:49 AM, Frederic Bouvier fredlis...@free.fr wrote:
  

I have a patch to PrecipitationEffect that seems to work. I'll submit it
to osg-submissions



I've just done a review of these changes and don't feel that there are
mostr straightforward and effecient way to implement what is
effectively near plan clipping.  The code will make the vertex program
slower, and not cut down on rasteristation and fill load.

I feel a better route would be to either:

1) use two Camera's to depth partition the scene as suggested earlier
in this thread, as this would give you control over the worlds depth
range where the precipitation exists

2) Use an osg::ClipPlane to clip the precipitation effect.  Using a
clip plan would also allow you to control angle of the clipping.
  
In my application, rain inside buildings is problematic if people enter 
the buildings (which they weren't supposed to do until recently). A clip 
plane method might work better than a near/far/depth partition. However, 
even with such a solution, I'd still end up with rain visible in some 
buildings (depending on where the user places the camera).
I'm sorry I'm not being very productive, because I have little to 
provide in terms of solutions, but I want to point out that a partial 
solution to the issue which slows down the shader, as Robert says, 
doesn't look like a good solution.


Laurent.

Neither the above routes require any changes to the core OSG, and both
would not affect the vertex program load, and would clip out fragment
so would cut down the fragment program load so would be more efficient
than the submitted fix.

Could you test out the above suggestions?

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


  


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


Re: [osg-users] Precipitation effect coming too fast, and hiding on some areas

2008-12-15 Thread Robert Osfield
Hi Fred  Jefferson,

On Sun, Dec 14, 2008 at 10:49 AM, Frederic Bouvier fredlis...@free.fr wrote:
 I have a patch to PrecipitationEffect that seems to work. I'll submit it
 to osg-submissions

I've just done a review of these changes and don't feel that there are
mostr straightforward and effecient way to implement what is
effectively near plan clipping.  The code will make the vertex program
slower, and not cut down on rasteristation and fill load.

I feel a better route would be to either:

1) use two Camera's to depth partition the scene as suggested earlier
in this thread, as this would give you control over the worlds depth
range where the precipitation exists

2) Use an osg::ClipPlane to clip the precipitation effect.  Using a
clip plan would also allow you to control angle of the clipping.

Neither the above routes require any changes to the core OSG, and both
would not affect the vertex program load, and would clip out fragment
so would cut down the fragment program load so would be more efficient
than the submitted fix.

Could you test out the above suggestions?

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


Re: [osg-users] Precipitation effect coming too fast, and hiding on some areas

2008-12-14 Thread Joakim Simonsson


Hi Fred,

On Sat, 13 Dec 2008 17:02:38 +0100, Frederic Bouvier fredlis...@free.fr  
wrote:



If you want to see this funny effect in action, watch this video
http://www.vimeo.com/2511328 ( move forward to 5:00 )


Very nice vid. But besides from raining inside the plane, it seems that  
the rain particles are too vertical - like the particles have a  
transform that follows the camera. Hmm.. I don't know, but you would  
expect horizontal rain at high speeds. I managed to get horizontal rain  
with the osg's precepitation effect.


But maybe vertical rain is your intent?



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


Re: [osg-users] Precipitation effect coming too fast, and hiding on some areas

2008-12-14 Thread Robert Osfield
HI Joakim  Fred,

I noticed the same vertical rain artifact.
osgParticle::PreciptiationEffect will normally fall vertically but
when the camera moves it will appear with the correct motion, so it
looks like the effect is moving with the camera with this usage,
normally the effect would be move with the world, not the camera.

Robert.

On Sun, Dec 14, 2008 at 9:47 AM, Joakim Simonsson joa...@autosim.no wrote:

 Hi Fred,

 On Sat, 13 Dec 2008 17:02:38 +0100, Frederic Bouvier fredlis...@free.fr
 wrote:

 If you want to see this funny effect in action, watch this video
 http://www.vimeo.com/2511328 ( move forward to 5:00 )

 Very nice vid. But besides from raining inside the plane, it seems that the
 rain particles are too vertical - like the particles have a transform that
 follows the camera. Hmm.. I don't know, but you would expect horizontal rain
 at high speeds. I managed to get horizontal rain with the osg's
 precepitation effect.

 But maybe vertical rain is your intent?



 --
 Joakim Simonsson
 ___
 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] Precipitation effect coming too fast, and hiding on some areas

2008-12-14 Thread Frederic Bouvier
Hi Robert,

Robert Osfield a écrit :
 Hi Fred,

 On Sat, Dec 13, 2008 at 4:02 PM, Frederic Bouvier fredlis...@free.fr wrote:
   
 The same problem affect FlightGear too : it rains into the cockpit.
 Would it be possible to kill a particle when it comes under a certain
 distance from the viewer ?

 If you want to see this funny effect in action, watch this video
 http://www.vimeo.com/2511328 ( move forward to 5:00 )
 

 The particle positions are generated down in the vertex program, so to
 cull based on position them you'd need to add logic into the vertex
 program to modify the alpha value to 0.0 to make it disappear.   It's
 worth mentioning you can't cull vertices and associated primitives
 with a vertex program as it's strictly one vertex one vertex out.  You
 could use a geometry shader to cull, or a fragment shader.
   

Thank you for pointing out the direction to take.

 A simpler route would be to use the stencil buffer to clip out the
 fragment where you don't want rain.
   

I don't think it will work because we want to see rain through the
windshield but we don't want to see droplets or
snowflakes in front of it.

 Another route would be to drawn the scene in two passes, first draw
 the terrain and precipitation effect, then draw the cockpit.   Using
 such an approach would allow you to depth partition the scene and get
 better depth precision for the two parts of the scene.  Personally
 this would be the route I'd take.
   

Same problem here. Snowflakes in front of the windshield will not be erased.

I have a patch to PrecipitationEffect that seems to work. I'll submit it
to osg-submissions

-Fred

-- 
Frédéric Bouvier
http://my.fotolia.com/frfoto/   Photo gallery
http://fgsd.sourceforge.net/FlightGear Scenery Designer

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


Re: [osg-users] Precipitation effect coming too fast, and hiding on some areas

2008-12-13 Thread Frederic Bouvier
Jumping into the thread,

Robert Osfield a écrit :
 Second question
 It also rains inside my car. I tried adding a node mask for that, but it
 didn't seem to work. Is it possible not to make it rain inside the cars
 (which are on a separete osg::Group)?
 

 PrecipitationEffect doesn't have an support itself for constraining
 the effect to appear inside/outside specified geometries.

 The best thing you could do would be to either try using the stencil
 buffer to prevent the fragments of the effect being rendered where you
 don't want them.
   

The same problem affect FlightGear too : it rains into the cockpit.
Would it be possible to kill a particle when it comes under a certain
distance from the viewer ?

If you want to see this funny effect in action, watch this video
http://www.vimeo.com/2511328 ( move forward to 5:00 )

-Fred

-- 
Frédéric Bouvier
http://my.fotolia.com/frfoto/   Photo gallery
http://fgsd.sourceforge.net/FlightGear Scenery Designer

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


Re: [osg-users] Precipitation effect coming too fast, and hiding on some areas

2008-12-13 Thread Ümit Uzun
I think there is a big hole somewhere on the cocpit's ceiling :P

2008/12/13 Frederic Bouvier fredlis...@free.fr

 Jumping into the thread,

 Robert Osfield a écrit :
  Second question
  It also rains inside my car. I tried adding a node mask for that, but it
  didn't seem to work. Is it possible not to make it rain inside the cars
  (which are on a separete osg::Group)?
 
 
  PrecipitationEffect doesn't have an support itself for constraining
  the effect to appear inside/outside specified geometries.
 
  The best thing you could do would be to either try using the stencil
  buffer to prevent the fragments of the effect being rendered where you
  don't want them.
 

 The same problem affect FlightGear too : it rains into the cockpit.
 Would it be possible to kill a particle when it comes under a certain
 distance from the viewer ?

 If you want to see this funny effect in action, watch this video
 http://www.vimeo.com/2511328 ( move forward to 5:00 )

 -Fred

 --
 Frédéric Bouvier
 http://my.fotolia.com/frfoto/   Photo gallery
 http://fgsd.sourceforge.net/FlightGear Scenery Designer

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




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


Re: [osg-users] Precipitation effect coming too fast, and hiding on some areas

2008-12-13 Thread Robert Osfield
Hi Fred,

On Sat, Dec 13, 2008 at 4:02 PM, Frederic Bouvier fredlis...@free.fr wrote:
 The same problem affect FlightGear too : it rains into the cockpit.
 Would it be possible to kill a particle when it comes under a certain
 distance from the viewer ?

 If you want to see this funny effect in action, watch this video
 http://www.vimeo.com/2511328 ( move forward to 5:00 )

The particle positions are generated down in the vertex program, so to
cull based on position them you'd need to add logic into the vertex
program to modify the alpha value to 0.0 to make it disappear.   It's
worth mentioning you can't cull vertices and associated primitives
with a vertex program as it's strictly one vertex one vertex out.  You
could use a geometry shader to cull, or a fragment shader.

A simpler route would be to use the stencil buffer to clip out the
fragment where you don't want rain.

Another route would be to drawn the scene in two passes, first draw
the terrain and precipitation effect, then draw the cockpit.   Using
such an approach would allow you to depth partition the scene and get
better depth precision for the two parts of the scene.  Personally
this would be the route I'd take.

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


[osg-users] Precipitation effect coming too fast, and hiding on some areas

2008-12-12 Thread Jefferson Pinheiro
I'm working on a driving project on OSG, and now I am making it rain. I
added a precipitation effect for that. My scale is 1 unit = 1 cm.

*First question:*
When my car runs just a bit (say, 5 km/h), the rain comes at my face as
though I was running at 200 km/h. And if I run faster than 20 km/h or so,
the rain bacomes glitchy (looks like it's snowing, too).

How do I change the speed at which the rain comes?

*Second question*
It also rains inside my car. I tried adding a node mask for that, but it
didn't seem to work. Is it possible not to make it rain inside the cars
(which are on a separete osg::Group)?

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


Re: [osg-users] Precipitation effect coming too fast, and hiding on some areas

2008-12-12 Thread Jefferson Pinheiro
Hi Robert,

On Fri, Dec 12, 2008 at 2:26 PM, Robert Osfield robert.osfi...@gmail.comwrote:

 Hi Jefferson,

 On Fri, Dec 12, 2008 at 3:56 PM, Jefferson Pinheiro
 jeffersonmpinhe...@gmail.com wrote:
  I'm working on a driving project on OSG, and now I am making it rain. I
  added a precipitation effect for that. My scale is 1 unit = 1 cm.
 
  First question:
  When my car runs just a bit (say, 5 km/h), the rain comes at my face as
  though I was running at 200 km/h. And if I run faster than 20 km/h or so,
  the rain bacomes glitchy (looks like it's snowing, too).

 Shudder.  Why or why would you have such a scale?  Can't you just have
 a sensible scale like 1 unit = 1m?


Even so,  my colleague's project is on that scale and the same thing
happens.



 I you really must have such as scale then try putting a scale above
 the PrecipitationEffect.


setParticleSize? I tried increasing that, and big values causes the rain to
look like snow; lower values makes it look normal or too small.
Or adding a matrix transform and scale matrix? That didn't seem to work,
either.



  How do I change the speed at which the rain comes?

 Have you looked at the API?


I tried several combinations of setParticleSpeed, wind and cell size, the
problem persisting.

Is it possible to just disable the effect of rain coming at your face when
the camera moves forward?



  Second question
  It also rains inside my car. I tried adding a node mask for that, but it
  didn't seem to work. Is it possible not to make it rain inside the cars
  (which are on a separete osg::Group)?

 PrecipitationEffect doesn't have an support itself for constraining
 the effect to appear inside/outside specified geometries.

 The best thing you could do would be to either try using the stencil
 buffer to prevent the fragments of the effect being rendered where you
 don't want them.


Thanks, I'll take a look at that.



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




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


Re: [osg-users] Precipitation Effect

2008-09-10 Thread selman duatepe
Hi Robert,

Thank you for quick response. I have three PrecipitationEffect active at one
time. I am trying for snow, rain, hail effect active at one time.

Selman

On Wed, Sep 10, 2008 at 3:35 PM, Robert Osfield [EMAIL PROTECTED]wrote:

 Hi Selman,

 On Wed, Sep 10, 2008 at 1:13 PM, selman duatepe [EMAIL PROTECTED]
 wrote:
  I have multiple precipitation effect objects. When I set the wind
 parameters
  of precipitation effect objects, only one precipitation effect object
  influence this wind parameters, the others are not.
 
  Anyone experienced about this problem?

 I haven't personally tried multiple osgParticle::PrecipitationEffect,
 when I wrote it I had in mind that only one would likely be active at
 any one time.

 Do you have multiple PrecipitationEffect active at one time?  What
 effect are you trying for?

 If you have multiple effects on at one time then perhaps lazy state
 updating on the uniform might be causing problems.  This is just a
 wild guess though.

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

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


Re: [osg-users] Precipitation Effect

2008-09-10 Thread Robert Osfield
Hi Selman,

On Wed, Sep 10, 2008 at 1:13 PM, selman duatepe [EMAIL PROTECTED] wrote:
 I have multiple precipitation effect objects. When I set the wind parameters
 of precipitation effect objects, only one precipitation effect object
 influence this wind parameters, the others are not.

 Anyone experienced about this problem?

I haven't personally tried multiple osgParticle::PrecipitationEffect,
when I wrote it I had in mind that only one would likely be active at
any one time.

Do you have multiple PrecipitationEffect active at one time?  What
effect are you trying for?

If you have multiple effects on at one time then perhaps lazy state
updating on the uniform might be causing problems.  This is just a
wild guess though.

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