Lightsaber
Blitz3D Forums/Blitz3D Programming/Lightsaber
| ||
How would I go about making a lightsaber blade in Blitz3D? By this, I mean, how do I make it so that there is a white core and a coloured glow around it? How would I achieve a the trailing effect when the saber is moved? Also, is it possible for an object to produce its own light? This might apply to the glow effect I just mentioned, or any other object, like a sphere for a light bulb. |
| ||
for the first two: create 2 blades(cylinders, perhaps...one inside of the other). One will be the "core" and will be smaller. The other will be the "sheath" and will be larger. Set the sheath's alpha to something like .3 to make it semi-transparent. Create a light and parent it to the "core" to make the core seem to have it's own light source. You'll want to parent the sheath to the core, as well. core=CreateCylinder(32) EntityColor core,255,255,255 EntityShininess core,1 ScaleEntity core,.3,3,.3 PositionEntity core,30,10,40 sheath=CreateCylinder(32,1,core) ScaleEntity sheath,2.3,1,2.3 PositionEntity sheath,0,0,0 EntityColor sheath,240,0,0 EntityAlpha sheath,.3 saberLight=CreateLight(1,core) PositionEntity saberLight,0,0,0 Something like the above. Or, you could always use an emitter/particle system :) |
| ||
And for the glowing/trail effect just make copies of the blade and scale them out on the x/z axis (very slightly on the y axis), while slowly lowering the alpha to 0. I haven't tested what it looks like but that's the first approach I'd try. |
| ||
Super triangle count though. Your FPS will drop like a rock. Try using a sphere map on the glow portion to get a fade effect. |
| ||
Why do I see a large, angry lawsuit on the horizon? (Copyright humor) |
| ||
For most magic twinkling shiny stuff you should use the ad ditional blendmode. You may combine this with entityalpha to prevent washed out scenes.eg: EntityAlpha saber,0.5 EntityBlend saber,3 You may use a special corona texture for the blades glow effect. simply add a quad to the blade that contains the glowing corona. If this is once looking good, you could even use an animated texture instead. |
| ||
I have nice looking lightsaber / spaceship exhaust idea but my math is bit rusty for getting it to work. Idea is to use just 2 quads, one aligned to base of saber/exhaust and other alignet to viewer. it should produce nice seamingless glow.. anyone to help with math? Here is mockup of the idea from 3 different point of view: edit: actually bottom one quads should be rotated 90 degrees.. bit aligment error :) ![]() |
| ||
Traditionally when creating lightsaber models the trick was to flip the normals on the outside part of the blade - you do need to make sure backface culling is on however. |
| ||
This is just my opinion but I don't really think a major trail would look good on lightsabers...just a very subtle one when it's moved at high speed. |
| ||
maybe a line of particles with very short life spans |
| ||
Some inspiration for you: http://video.google.com/videoplay?docid=672422470842718521&q=light+saber I suggest creating the saber with a string of glowing points (like the quad for the head on view in the rocket trail image above)--enough of them to create a solid line--and always turn them towards the camera. This way you'll never see flat polygons--as you inevitably will with that rocket trail. You might also randomly tweak the scale of each of them on each frame, to create the flickery glow effect as seen in the above video. |
| ||
Lol. I've seen that video before. The special effects are pretty awesome, even if the fight choreography (I think I spelt that right!!) isn't the best; there are instances where they repeatedly deal attacks to each other's weapons rather than attempting to hit the other's body. |
| ||
A line of sprites is indeed a good idea. even if you use 100 Sprites, it's only 200 Triangles. Only make sure they won't overlap on more than say 3 Sprites at the same time. You may also use some kind of rubberband motion for the sprites, so their motion is a little delayed. This would result in a trail effect. |
| ||
Okay, so Finjogi's effect looks really good. My next question is how would I set up the quads to give that effect? (At the moment i'm not worried about aligning it correctly, I just want to get it working.) |
| ||
If you use sprites (instead of quads) in default mode, they will be aligned to the camera automaticly. I'd do it this way (assuming your just loaded sword mesh is aligned blade up, grip down) figure out the top and the bottom location of the blade. then do somthing like this: n=20 dim s(n) for i=0 to n y=y_bottom+ ((y_top-y_bottom)/n)*i s(i)=createsprite() positionentity s(i),0,y,0 scalesprite s(i),0.1,0.1,0.1 entityparent s(i),sword next Use floats, of course. |
| ||
Great, now what do I do with them, now that i've set up the sprites? |
| ||
of course they need to be textured with a glowing something, fading to black on the edges. Probably you want to use entityorder to make them apear in front of everything. Use the additional Blendmode for the Sprites. Now if you move the sword, this string of sprites will be attached to the blade, and face always to the camera. |