Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by jptoniolo · May 01, 2014 at 04:56 AM · c#particlesparticlesystemprocedural

Particles dissapearing when camera is close

Hello. I was trying to copy the Procedural Examples for a convincing lightning bolt particle effect. I noticed that it was using legacy particles, the ParticleEmitter, so I was trying to update it to use the ParticleSystem. I realize I'll have to post a bit of code here, so I apologize for the size:

Awake() of the particles:

void Awake () { oneOverZigs = 1f / (float)zigs;

  gameObject.particleSystem.enableEmission = false;
  particles = new ParticleSystem.Particle[zigs];
  //particleSystem.GetParticles (particles);
  noise = new Perlin ();

  emit (false);

}

emit of the particles:

   public override void emit (bool shouldEmit)
   {
      this.shouldEmit = shouldEmit;
      if (shouldEmit)
      {
         curTime = 0.0f;
         particleSystem.Emit (zigs);
      } else
      {
         particleSystem.Clear ();
      }
   }

Lastly, Update of the particles:

  void Update ()
       {
          if (shouldEmit)
          {
             curTime += Time.deltaTime;
             if (curTime > duration || source == null || dest == null)
             {
                recycle ();
                return;
             }
             float timex = Time.time * speed * 0.1365143f;
             float timey = Time.time * speed * 1.21688f;
             float timez = Time.time * speed * 2.5564f;
         
             for (int i=0; i < zigs; i++)
             {
                Vector3 position = Vector3.Lerp (source.position, dest.position, oneOverZigs * (float)i);
                Vector3 offset = new Vector3 (noise.Noise (timex + position.x, timex + position.y, timex + position.z),
                                         noise.Noise (timey + position.x, timey + position.y, timey + position.z),
                                         noise.Noise (timez + position.x, timez + position.y, timez + position.z));
 
 
                position += (offset * scale * ((float)i * oneOverZigs));
 
             
                particles [i].position = position;
                particles [i].color = Color.white;
                particles [i].size = 0.20f;
             }
         
             //particleEmitter.particles = particles;
             particleSystem.SetParticles (particles, particles.Length);
         
          }    
       }
    }

This works just fine... until I noticed that if I zoom in even modestly close to the particles (particles might take up... a square centimeter on the screen) they completely disappear! I've tried messing with Maximum Size in the renderer of the Particle System to no avail. I'm not getting anywhere near close enough for the camera to be "going through" or past these particles, Im quite far away. It's very strange to see them work fine from a very far distance but as soon as I zoom just a little they all disappear. Any help would be appreciated, thanks!

Pictures... Far enough away: alt text Too close: alt text

You can see the particle emitters in scene view in the second image, but no graphics. You can see the graphics in the first image, just a little further away.

Edit: It should be noted that the Shuriken particle system works just fine when I don't manually assign particle positions like I do in the above script. I use many particle effects and it doesn't matter where the camera is, I can still see them. It's just with these procedurally generated/manipulated particles that I'm having what seems to be clipping issues. Thanks again for any assistance.

Edit 2: It seems to be the direction the camera is facing too... If Im looking "east", I can zoom quite far up to the particles, but if im looking west, i have to zoom out much much further to see them. This is both in scene view and camera view. Maybe that would give a hint to the problem?

badparticles.png (39.8 kB)
goodparticles.png (34.8 kB)
Comment
Add comment · Show 8
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image VesuvianPrime · May 01, 2014 at 11:48 PM 2
Share

Have you tried changing this?

alt text

avatar image jptoniolo · May 02, 2014 at 12:06 AM 0
Share

I did yes, but thanks for your reply! I wish I could post a video, it's truly very bizarre. They work great from far away but get close and the scene view just shows the particle system objects without emission, but you zoom out and it's emitting like it never stopped.

avatar image VesuvianPrime · May 03, 2014 at 10:33 AM 1
Share

Very recently I was trying to write a pointcloud component using Shuriken. I eventually came to the conclusion (like many others) that the Shuriken ParticleSystem is buggy, unfinished and unreliable.

Are you able to recreate your particles using a ParticleEmitter ins$$anonymous$$d?

avatar image VesuvianPrime · May 03, 2014 at 10:46 AM 0
Share

Sorry, I just woke up! I've re-read your question and it looks like you're trying to do something very similar to a point cloud.

I would ask: were your particles working with the ParticleEmitter? Why are you "updating" to ParticleSystem?

You're welcome to my PointCloud component: http://pastebin.com/Z7sF3RJD

avatar image jptoniolo · May 04, 2014 at 05:03 PM 0
Share

Indeed, I've been busy so I haven't gotten around to reverting but yes - just like in the original Procedural Examples code, the ParticleEmitter DOES work with absolutely no issues. The reason I was "updating" was I thought ParticleEmitter was essentially deprecated. So I believe I will just revert to particle emitter and having it work fine. The pointcloud component you mention sounds very interesting, programmatically controlling the particle system for a mathematical simulation. I may download that code and try it out, thank you for the link. But yes I've come to the conclusion that Shuriken is bugged as nobody seems to be able to give me a valid answer as to why the particles randomly disappear. Thanks for your time Vesuvian!

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Budgieboy · May 04, 2014 at 06:47 PM

Try changing the clipping planes on the camera, have the near plane set to something like -5 and see if that works.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image jptoniolo · May 04, 2014 at 09:31 PM 0
Share

Yep! It's clamped at 0.01 (If you want go to behind the camera, just move the camera back I would assume is the logic). It doesn't seem to work :-/. Thank you for the suggestion though!

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Destroy particles based on bounds not lifetime 0 Answers

turn on off particle system 1 Answer

A whip like particle system 1 Answer

How would I attach a float to a particle? 1 Answer

How to get newest Particle in a ParticleSystem 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges