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
0
Question by GeorgeRigato · Nov 12, 2012 at 01:10 PM · lightparticleshurikenflashlightvolumetric

Using shuriken to create volumetric lights effect

Gents,

I'm trying really hard to create a volumetric effect of a flashlight in a foggy environment.

The visual effect intended is this:

alt text

I've reached two possible solutions:

-The simplest one is to have a translucent mesh goin out of the flashlight. But the angle of the light will vary and the distance of the light "hitting" the objects will vary also. So i think it generates too many issues with a poor quality effect, and thus is not worth it. Maybe it is great for some static lights.

-The other one is the particle system, but my efforts were merely tweak the massive amount of parameters, changing the material and stuff. The closest I reached of achieving success was changing the render mode to stretched billboard and play a little with speed scale and length scale. I already discovered that each particle lifetime must be 1 or less. The duration of the hole loop doesn't matter as long it is bigger than particle lifetime. And particle speed would reflect on each particle/ray length, and increasing speed will lead to more spacing between particles and then more particle count to fill the gaps.

This is where I got:

alt text

I think the particle system could respond better to the scene, as this light would be hold by the player's character, and would be walking around and lighting things up.

The biggest concerns I have right now are the performance, as this particle system would take hundreds of thousands of particles to work properly. And the collision with different objects with different distances to the particle/light source.

Any one with experience with this matter could "shed some light" to help me solve this?

Thanks in advance.

light-cone.jpg (7.0 kB)
myvolumetricparticle.jpg (78.9 kB)
Comment
Add comment
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

5 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by GeorgeRigato · Nov 12, 2012 at 03:28 PM

(I would post this as a comment on my own first post, but I need to post a image.)

After some work, i reached this:

alt text

alt text

But it's not quite there yet. I need more fill, but without adding an absurd amount of particles.

reaching a perfect filled cone/cilinder, with right transparency and with low particles is the goal here. Later I can worry about collision and stuff.

Any ideas?


myvolumetricparticle3.jpg (135.4 kB)
myvolumetricparticle4.jpg (102.0 kB)
Comment
Add comment · 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
0

Answer by elpierrot · Nov 12, 2012 at 04:33 PM

You should work with a cone mesh and a nice shader

Comment
Add comment · Show 2 · 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 GeorgeRigato · Nov 12, 2012 at 04:41 PM 0
Share

I don't know if you read the beginning of the first post where I quote a mesh as an option for solution but I'd rather go with particles.

If you really want to help people you should develop better your answer or explanation.

I'm not doubting your capabilities or skills, but I'm trying to bring attention on your communication effort.

Thanks anyway for stating your $$anonymous$$d.

avatar image elpierrot · Nov 12, 2012 at 04:45 PM 0
Share

sorry I read too fast but that's the common solution for this kind of stuff. Shader could do the difference between a cheap solution and a nice one.

avatar image
0

Answer by GeorgeRigato · Nov 12, 2012 at 05:41 PM

Well,

this is the latest progress after some work:

alt text

alt text

I noticed the stretched billboard have a better effect when looked sideways, and the perspective of the game (3rd person, from behind) doesn't take advantage of that. Instead of a cone of light, I'm getting more a fog/mist effect over my path of light.


myvolumetricparticle5.jpg (190.5 kB)
myvolumetricparticle6.jpg (214.5 kB)
Comment
Add comment · 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
0

Answer by lightbug · Feb 28, 2013 at 02:19 PM

very nice! I used a plane with a particle/alpha bleeding shader (with diferent lights cookies) and a script that controls the alpha depending of the distance between the player and the plane (near : alpha = 0 , far : alpha =x)

 GameObject camara;
     public float alpha_maximo = 0.5f;
     public float distancia_critica = 15;
     public float distancia_muerta = 1;
     float alpha_final;
     public Color color;
     
     
     
     void Start () {
         camara = Camera.mainCamera.gameObject;
         
     }
     
     
     void Update () {
         
         //look at me
         transform.rotation = Quaternion.Euler(transform.eulerAngles.x,
                                                 camara.transform.eulerAngles.y,
                                                 transform.eulerAngles.z);
         
         
         //compute alpha
         Vector3 distancia = camara.transform.position - transform.position;
         if(Vector3.Magnitude(distancia)< distancia_critica){
             alpha_final = (alpha_maximo)*(Mathf.Pow((Vector3.Magnitude(distancia))/distancia_critica,2));
             if(Vector3.Magnitude(distancia)< distancia_muerta){
                 print ("muerta");
                 alpha_final = 0;
             }
             
         }else{
         alpha_final = alpha_maximo;
             
         }
         
         
         //new alpha
         gameObject.renderer.material.SetColor("_TintColor", 
             new Vector4(color.r,color.g,color.b,alpha_final));
         
         
         
         
         
         
         
         /////////
     }
 }
Comment
Add comment · 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
0

Answer by MarkD · Apr 04, 2014 at 06:14 PM

Well there is this system https://www.assetstore.unity3d.com/#/content/13196

It uses a smart setup of planes to generate "fake" volumetric light (not actual light itself just the effect). It has different setup features, one of them is cone casting where you can setup the shape to match your spot light source, in one of the images this is shown with a projector. It works light source independent, but can also get range distance from a light source if needed (or set it manually, in your case you can use the light source).

Comment
Add comment · 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

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

13 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

Related Questions

Nothing should be seen without the flashlight pointing at it. 1 Answer

Flashlight Flicker! 2 Answers

Cone mesh that gradually fades? 2 Answers

How do you acces your new shuriken world collisions form script? 0 Answers

Making a Shuriken Particle System Turn on and off. 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