Problem with fog and particle system

taribo

18-04-2007 14:58:33

Hi i've a problem with my scene i added fog and a particle system and this is the result:
when i'm near the particle system all work fine:

but when i'm far this is the wrong result:


this is my code:

def _createScene(self):
sceneManager = self.sceneManager
camera = self.camera
camera.nearClipDistance = 0.5

camera.setPosition (10, 1, 0)
camera.lookAt(-50, 1, 0)

sceneManager.ambientLight = ogre.ColourValue(0.9, 0.9, 0.9)
#sceneManager.setSkyDome(True, 'Examples/CloudySky', 5.0, 8.0)
#sceneManagersetSkyPlane(True, plane, "Examples/SpaceSkyPlane", 100, 45, True, 0.5, 150, 150)

#particle system
particleSystemManager = ogre.ParticleSystemManager.getSingleton()
particleSystem1 = sceneManager.createParticleSystem('Nimbus', 'Examples/GreenyNimbus')
sceneManager.getRootSceneNode().createChildSceneNode().attachObject(particleSystem1)

fadeColour = (0.5, 0.5, 0.5)
self.renderWindow.getViewport(0).backgroundColour = fadeColour

#FOG
#self.sceneManager.setFog(ogre.FOG_EXP2, fadeColour, 0.1)
self.sceneManager.setFog(ogre.FOG_LINEAR, fadeColour, 0, 50, 500)



for index in xrange(1, 522):
entity = sceneManager.createEntity('robot%d' % index, 'Indexed ('+ str(index) +').mesh')
sceneManager.getRootSceneNode().attachObject(entity)

light = sceneManager.createLight('MainLight')
light.setPosition (0, 80, 0)

Where is the error?
thank you for help

taribo

18-04-2007 23:03:02

code of particle system

Examples/GreenyNimbus
{
material Examples/FlarePointSprite
point_rendering true
// point rendering means size is controlled by material
// provide fallback sizes for hardware that doesn't support point sprite
particle_width 30
particle_height 30
cull_each false
cull_each false
quota 10000
billboard_type point

// Area emitter
emitter Box
{
angle 30
emission_rate 30
time_to_live 5
direction 0 1 0
velocity 0
colour_range_start 1 1 0
colour_range_end 0.3 1 0.3
width 60
height 60
depth 60
}

// Make em float upwards
affector LinearForce
{
force_vector 0 100 0
force_application add
}

// Fader
affector ColourFader
{
red -0.25
green -0.25
blue -0.25
}


}

taribo

19-04-2007 12:09:42

i need help...

bharling

19-04-2007 18:04:12

Have u tried turning off the point-rendering setting? (thats if you want the particles to get smaller as you move away).

You might want to check the Examples/FlarePointSprite material. It looks like a problem with the blend mode applied to the flare texture. I had a similar problem, heres what i did, it might work in your case but no guarantees!


material plant/ALPHA/TEX/gLeaves
{
technique
{
pass
{
depth_write off
scene_blend alpha_blend
diffuse 0.800000 0.800000 0.800000
specular 0.500000 0.500000 0.500000 12.500000
texture_unit
{
texture gLeaves.png
}
}
}
}


note the 'depth_write off' and 'scene_blend' lines. I'm sure the problem lies in the material script, rather than the particle script. best of luck !

taribo

21-04-2007 01:32:39

you've right the problem is in the material
this is the code:
material Examples/FlarePointSprite
{
technique
{
pass
{
lighting off
scene_blend alpha_blend
depth_write off

point_sprites on
point_size 2
point_size_attenuation on

texture_unit
{
texture flare.png
}
}
}
}

as you can see i've add depth_write off and scene_blend but now the problem is near

how can i remove the black?

jacmoe

21-04-2007 03:05:18

Go back to your initial material script code, and then look at the fog_override attribute:
http://www.ogre3d.org/docs/manual/manual_16.html#SEC52
Try fog_override true in the material script for your particles, and watch the result.. :wink: