Particle troubles.

scratchyrice

01-02-2009 18:30:23

Why is it that when i add a particle system to my scene, With caelum enabled, The particles seem to go "behind" the clouds?

Cheers.

Scratchy

scratchyrice

02-02-2009 15:16:59

Anybody?

Cheers

Scratchy

cdleonard

03-02-2009 14:18:51

My guess is that transparency sorting goes wrong somehow; there are a lot of ways that can happen. You can't just throw transparent objects at Ogre and expect it to always "just work"; there are lots of subtle issues involved. You need to provide a lot more information: screenshots; particle material scripts; any "interesting" settings you might have. Caelum's clouds shouldn't really be any different from any other semi-transparent plane.

scratchyrice

03-02-2009 23:16:50

Ah ok, Im quite new to ogre (1 year), So i havent got it all figured out yet. Here is a screenshot of the problem:


As you can see, The droplet's appear to be behind the clouds. To follow is all the code i have used.
C++ code used to load and display the particle system:
Ogre::ParticleSystem * psys = mySceneEnvironment->mySceneManager->ogreSceneManager->createParticleSystem("rain", "Precipitation/Rain");
Ogre::SceneNode * rnode = mySceneEnvironment->mySceneManager->ogreSceneManager->getRootSceneNode()->createChildSceneNode();
rnode->translate(0, 3000, 0, Ogre::Node::TS_PARENT);
rnode->attachObject(psys);


The particle script code:
particle_system Precipitation/Rain
{
material Precipitation/Droplet
particle_width 10
particle_height 100
cull_each false
quota 10000
// Make common direction straight down (faster than self oriented)
billboard_type oriented_common
common_direction 0 -1 0

// Area emitter
emitter Box
{
angle 0
emission_rate 1000
time_to_live 5
direction 0 -1 0
velocity 50
colour_range_start 0.3 1 0.3
colour_range_end 0.7 1 0.7
width 1000
height 1000
depth 0
}

// Gravity
affector LinearForce
{
force_vector 0 -200 0
force_application add
}

}


And the droplet material used for the particle:
material Precipitation/Droplet
{
technique
{
pass
{
scene_blend colour_blend
depth_write off

texture_unit
{
texture basic_droplet.png
}
}
}
}


It is probably something very simplistic with the material, But i have yet to learn the material system fully.

Thanks in advance.

Scratchy

cdleonard

04-02-2009 10:48:08

My guess is that the particle system is too high up and sorts as farther than the clouds (which are lower). Try to move the particle system to a different position; it might fix it. You can also try to add another smaller transparent object and see how it behaves.

Ogre will try to detect objects which are transparent and sort them from back to front. This is based on the "root" position of each object and will fail if the objects are large or the intersect each other. I don't know of any good way to debug such issues.

scratchyrice

04-02-2009 16:06:12

Ah, Thanks for clearing that up. I moved the particle system node position down to below the sky, And it works fine.

Cheers

Scratchy