How do i make a beam of light?

Blitz3D Forums/Blitz3D Beginners Area/How do i make a beam of light?

nerdy_kid(Posted 2008) [#1]
Say if i wanted to create a headlight for a car, or something, how would i make that beam appear?


chwaga(Posted 2008) [#2]
you could create a transparent white cone parented to the car and oriented to the headlights, and hide it by changing the alpha.


nerdy_kid(Posted 2008) [#3]
That sounds kinda tacky though.
Besides, i already tried using a mesh for a beam, and it looked HORRIBLE.


sswift(Posted 2008) [#4]
Run electricity through a filament.


sswift(Posted 2008) [#5]
But seriously, your options in Blitz3D are kind of limited.

That said, I think if you create a texture map which white, with an alpha channel which is a circular gradient that is white in the middle and black around the edges, and then apply that to say a pyramid mesh attached to the lights as a spherical environment map, that that might give you an effect more like what you're looking for.

Alternatively try the above gradient as a texture instead of an alpha map, again, using spherical environment mapping, and then set the mesh blend mode to add.

But I think the first method will give you a more realistic effect. You may wish to tweak the transparency by turning down the alpha on the mesh, but basically a beam of light that you can see, you can see because it's bouncing off dust in the air, and that beam will be much brighter than anything around it, so you should see the color of the beam much more than whatever other colors are behind it, so alpha would let through less of the color of stuff behind the beam than add would.


Ross C(Posted 2008) [#6]
It's all about a good texture too. Failing the alpha channel, use the multiple texture blend mode will give you the same thing i believe. Having a good beam texture will make it look 100 times better. As sswift says, if you can add such things as rust, rain... etc, the beam will show it up. Another option, slightly more tricky, is to have a sprite as well as the beam. Align the sprite to the road, make it white, fading outwards, and scale it's size based on the length of the cone/pyramid, and it's angle.


nerdy_kid(Posted 2008) [#7]
Thanks everyone. That should help out a lot.


D4NM4N(Posted 2008) [#8]
Here is a good way to do fake volumetric light:
Have 2 items:

-First a cone with a faded gradient texture that is white one end and fades to black towards the large end of the cone.
-Secondly a sprite with a flare texture (like the bullet in the castle demo but whiter).

Initially, set the flare and cone to both entityalpha 0.
In the loop somewhere, Use "deltayaw" to determine how much of an angle you are looking at the lightsource and when at a range of maybe -30 to 30 degrees, using entity alpha and a bit of maths fade out the cone and fade in the sprite depending to how "straight on" you are looking at the light.

I had some great results with this in the past.


Ross C(Posted 2008) [#9]
Check out my laser cannon thing in the blitz3d help forum. I use 4 cylinders, each with a spheremap textured on, so only the middle of the cylinder is textured white, fading to bleck.


H. T. U.(Posted 2008) [#10]
Use a sprite with a view mode of 1. Easy to make,easy to edit, and it looks good. I only use meshes to simulate VERY strong beams of light, like a laser.