- Home /
3D Space Gun Pulse Laser Graphics
I'm working on a space game, and I was wondering, what is the best way to create the graphics for all those bright-colored glowing energy weapons that sci-fi spaceships shoot at eachother?
Specifically, I mean the sort lasers you see here (game is Freelancer if you're curious):
If I just use a linerenderer, it's very flat and rectangular - especially when viewed from the front or behind instead of the side, so that doesn't work. My next idea was to use a particlesystem, but it always looks weird at the part where the particles spawn, and it doesnt look nice from the front or back either. I've tried using a quad or particlesystem as a billboard with a trailrenderer, too, best result so far but it still seems off. Using a full cilinder or capsule mesh also looks weird and just seems wrong, too.
So yeah, I'm (still) stumped this one, would love to hear some thoughts.
Answer by hyperi0n · Jan 10, 2016 at 08:22 AM
I faced the same issue a long time ago in a game-engine far far away.. but the basic idea will also work in Unity. Note that I was really noob when I came up with it, so there may be radically better solutions out there that I don't know of.. but here's what I used and it always served me well:
It's a simple setup using three textured quads. It works OK with only the first two quads, but will give bad results when looking directly at the laser bolt from the front or back. So I add the third quad which always needs to face the camera like a billboard (you may need to add a script to tell it to ignore/override it's parents rotation so that it faces the cam). Note, you may also try and fade this third quad in/out depending on the angle the camera is looking at the bolt, so that it's invisible when looking from the side and fades in the more "from-the-front" you look at it, to give it a kind of lense-flarey look :)
Obviously the graphics used in the example are ugly (esp. for the 3rd quad :D ) Didn't have access to my old files when writing this.
Hope this helps you out and looking forward to what other people have come up with :)
You can improve upon this a little by adding a couple of extra planes (4 quads, rotated 45 degrees each), and then writing a vertex shader that fades out the most edge-on planes based upon their normals. (dot product of world-space normal and direction to the camera, with a scale/bias to tweak the fade)
Answer by Stefan02 · Jan 10, 2016 at 07:21 AM
Maybe you can use this :https://www.assetstore.unity3d.com/en/#!/content/29160 It's not something special but anyway it's good;)
Your answer
Follow this Question
Related Questions
Raycast trail renderer? 3 Answers
LineRenderer Distortion 2 Answers
jiggly beam like tf2 medi gun? 1 Answer