Jump to content

[SOLVED] Particle system errors


photo

Recommended Posts

1. Launching Unigine Game SDK

 2. Launching Cool SFX librfry

 3. Choose: fire1

 4. Launching the editor from console

 5. Launch the node panel for editing the node

 6. Delete everything except nodes: fire and fire_low1

 7. Editing fire_low1:

    - deleting force

    - label Dymanic:

      Emitter=Point Sequens=50 Limit=10 Size=0,0,0 Direction=10,0,0 spread=0,0,0

      Gravity=0,0,0 Velocity=3,0.8 Life time 0.3,0.1 Radius=0.3,0.02 Growth=0.1,0.1

    - label Params :

      Type=Length

      Every check-box except 'Emitter enabled' and 'Emitter based' switch off

      Spawn rate=30 Restitution=0

    - label Surfaces:

      Every check-box except 'Enabled' switch off    

    - As a result we get something like a fire from the nozzle of the space rocket with the emitter point. Save changes

 8. Bring the camera closer. As we see it's OK(see the screen shot in the point of creation)

    

62ed96f53085a881c88d7e2edff1de91.jpeg

9e22f4eb7c402dd2a5d30346a2902d19.jpeg

 

 9. Change the first coordinate in position from zero up to 10000000

10. Make the camera coordinate change too(Tools/Camera) up to 10000000

11. Let's try to move the object(moving fire on the screen). But we see that the fire visualisation was broken. The same is for bounding box and coordinate system (last was distorted) (see screen shot on a large distance from point of creation)

 

0f7f788ec2f9fd6677a0bcb1275490aa.jpeg

b3bc143256c33bc7fb82170aedbe8137.jpeg    

34bca557c2bfb8b9532754792163456b.jpeg

77e89906be82f08785bf18d8643d6689.jpeg

633bb6ca1c398318528bba17107fefdc.jpeg

30b18d6935df36333f82bdb50eb73dfd.jpeg

6129b1ef93b3782ef0ca5ee335fd209f.jpeg

cfbdcc29c9460e49e88d0e9dbcc97172.jpeg

 

So the fire is hardly ever seen or it is seen only in some positions.

Perversions(Collisions) are changing depending on the distance (situation is coming worse in case of larger distance from the point of creation(ObjectParticles::world_offset))

 

In my opinion, this problem is non-exotic. The situation is quite usual.

When we are trying to create a rocket with fire-on and moving it around the Earth on large distance(thousands km(millions m)) the fire starts "rotating" around the rocket.

 

The problem is seemed to be connected with the lack of accuracy. When we are transforming nodes  dmat4 is using double .

But further the emitter's transformation cats double to float (ex. ObjectParticles::update_transform():  particles->setEmitterTransform(mat4(transform));

Link to comment

Hi Vitaly!

 

First of all, we don't recommend to use Game SDK with float precision support for such large distance to objects. I've made a screenshot that shows difference between float and double precision builds (with regular ObjectMeshStatic). You can see that on left side of this picture object bounds are deformed (Game SDK), but on the right side everything is OK (Sim SDK):

 

compare.png

 

Switching to double precision will fix manipulators and objects bounds issues.

 

If I understand you correctly you want to get a close-up view of the rocket engine and rocket itselft can be at the very distant point (for example, 10.000.000)?

 

I've tried to reproduce it with double precision build and it seems everything is working fine after saving world and reloading it:

 

10000000_object.png

 

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

I've used Unigine Game SDK only to show the mistake in your code.

As for me, I use your SDK with the keys, that provide the highest accuracy (USE_DOUBLE, UNIGINE_DOUBLE)

The problem is described below.

I create the rocket model and it's fire. I move them on the long distance and as I can see:

the fire is presented as a set of chaotic small particles that are appearing not from the

nozzle of the rocket, as it was at the moment of creation, but around the rocket, in different places.

Besides, they are situated on long distances from it.

As we can see in the code of method void ObjectParticles::update_transform() the current position of the rocket

is saved in world_offset and as for placing the fire (Particles), you subtract this offset,

as the result the coordinate system of fire is moved to zero.

This happens only at the moment of the fire creation(by the condition: particles->getNumParticles() == 0).

If the fire with the rocket now are moved on the long distance, the fire position will be the result of subtraction

"current rocket position" - "default rocket position" (default position is saved to the world_offset).

The rocket position and the world_offset are double accuracy, but the local coordinate system of the fire is

presented by float(Use_DOUBLE is used, as I've already mentioned).

The fire particles are created in the local float accuracy system, which is non-zero value (it is far away from it).

So after moving fire particles to the rocket coordinate system by adding world_offset, the particles are not involved

into the nozzle's area, they are created far away from it. But If we delete the fire at this very moment

and create it once again, the last position will be saved to the world_offset and everything will be OK,

because the local coordinate system is now placed in zero. This is the result of reloading the world, as you said.

 

For example: void ObjectParticles::update_transform() this is unigine's code:

 

// emitter offset

if(particles->getNumParticles() == 0) {

Vec3 old_world_offset = world_offset;

if(particles->isEmitterShift() == 0) world_offset = getWorldTransform().getColumn3(3);

else if(particles->isEmitterEnabled() == 0) world_offset = getWorldTransform().getColumn3(3);

 

But if we replace it by:

// emitter offset

if(particles->getNumParticles() == 0 ||

particles->getEmitterType()==Particles::EMITTER_POINT) { //!!!

Vec3 old_world_offset = world_offset;

if(particles->isEmitterShift() == 0) world_offset = getWorldTransform().getColumn3(3);

else if(particles->isEmitterEnabled() == 0) world_offset = getWorldTransform().getColumn3(3);

else if(particles->getEmitterType()==Particles::EMITTER_POINT) world_offset = getWorldTransform().getColumn3(3); //!!!

 

After every update of the rocket translation, the last position of the rocket will be saved to the world_offset

(now it is made once only at the beginning). And the problem is fixed.

But I'm not so sure about using this part of code. May be it might spoil something else.

Link to comment

Hello, Vitaly!

 

I've successfully reproduced that glitch and will report to our dev team, no ETA though. Thanks a lot for detailed instructions and for fix suggestions!

 

Update: that cast from to mat4 is actually safe because we've translated emitter by the world_offset before casting.

Link to comment
  • 3 months later...
×
×
  • Create New...