Search Unity

Smoke performance problems...

Discussion in 'Scripting' started by Doleman, Oct 23, 2007.

  1. Doleman

    Doleman

    Joined:
    Aug 12, 2005
    Posts:
    87
    Im using the "Example Vehicles" scripts as groundwork for my physics but whenever I try to use the smoke-effects i get a serious performance drop.
    I go from 100fps to about 25-30!

    Heres the code involved


    Code (csharp):
    1.  
    2. // This is in FixedUpdate
    3.  
    4. for(w in wheels)
    5.     {      
    6.         //rotate wheel
    7.         w.rotation += wheelRPM / 60.0 * 360.0* Time.fixedDeltaTime;
    8.         w.rotation = Mathf.Repeat(w.rotation, 360.0);      
    9.         w.graphic.localRotation= Quaternion.Euler( w.rotation, w.maxSteerAngle*steer, 0.0 ) * w.originalRotation;
    10.  
    11.         //check if wheel is on ground
    12.         if(w.coll.isGrounded)
    13.             onGround=true;
    14.        
    15.         var hit : WheelHit;
    16.         var c : WheelCollider;
    17.         c = w.coll;
    18.         if(c.GetGroundHit(hit))
    19.         {
    20.             //if the wheel touches the ground, adjust graphical wheel position to reflect springs
    21.             w.graphic.localPosition.y-=Vector3.Dot(w.graphic.position-hit.point,transform.up)-w.coll.radius;
    22.            
    23.             //create dust on ground if appropiate
    24.             if(rigidbody.velocity.x > 5)
    25.             {
    26.                 groundDustEffect.position=hit.point;
    27.                 groundDustEffect.particleEmitter.worldVelocity=rigidbody.velocity*0.5;
    28.                 groundDustEffect.particleEmitter.minEmission=1;
    29.                 groundDustEffect.particleEmitter.maxEmission=1.5;
    30.                 groundDustEffect.particleEmitter.Emit();                               
    31.             }
    32.         }
    33.  
    34.     }
    35.  
    Anyone have any tips&tricks to save some performance here?

    Best Regards
     
  2. Morgan

    Morgan

    Joined:
    May 21, 2006
    Posts:
    1,223
    What's the hardware? If low-end, maybe fewer particles would help?
     
  3. Doleman

    Doleman

    Joined:
    Aug 12, 2005
    Posts:
    87
    Thats the problem...
    Im using the new iMac 24" with 2.8GHz and 2 Gb memory

    Just a basic terrain and a car
     
  4. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Are you measuring performance in the editor? Editor caps and quantizes the frame rate, so it's a poor indicator for performance. Try seeing what difference it makes in the standalone player.
     
  5. Doleman

    Doleman

    Joined:
    Aug 12, 2005
    Posts:
    87
    Well, I measure it in editor yes...
    But the game starts to stutter, a lot! So I dont think its just because of the fps counter...
     
  6. Doleman

    Doleman

    Joined:
    Aug 12, 2005
    Posts:
    87
    Ok, tried a standalone build and its not much better... :(

    Get 280+ fps without smoke and around 40 with the smoke turned on
    Something is really not right here...

    Any ideas? Anyone using particleeffects in a cargame who can point me in the right direction??
     
  7. David-Helgason

    David-Helgason

    Moderator

    Joined:
    Mar 29, 2005
    Posts:
    1,104
    Can you post a web-player. We might be able to spot the problem offhand.

    d.
     
  8. Doleman

    Doleman

    Joined:
    Aug 12, 2005
    Posts:
    87
  9. drJones

    drJones

    Joined:
    Oct 19, 2005
    Posts:
    1,351
    just jumping in here - are you using the jeep from the vehicles example? that thing is not realtime friendly - way too many materials polys if i recall - i'd definitly use a different vehicle model if that's the case ; )
     
  10. Lka

    Lka

    Joined:
    Aug 6, 2006
    Posts:
    297
    I have a "old" iMac 24'' 2,16 GHz and I get 80-160 fps in full screen
     
  11. jeffcraighead

    jeffcraighead

    Joined:
    Nov 15, 2006
    Posts:
    740
    On a C2D MacBook Pro I get ~100 FPS avg.
     
  12. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    Welcome to the underclocked HD2600 XT and its drivers! Unfortunately, multiplicative effects don't seem to be its strong point. Nor anti-aliasing. Or anything except being DX10-compliant, really. I'm just glad I got the 20" iMac so the card doesn't have to fill as many pixels.