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:

4885-light-cone.jpg

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:

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.

(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:

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?

You should work with a cone mesh and a nice shader

Well,

this is the latest progress after some work:

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.

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));
		
		
		
		
		
		
		
		/////////
	}
}

Well there is this system Unity Asset Store - The Best Assets for Game Making

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).