Light Saber Extension Animation

So I am doing a VR project for my VR class (how surprising…).

Anyways, I am thinking about how I want to animate the light beam for a light saber. I was thinking that I could use a modfied cylindar for the light part (animate the emissive color to get a glowing sensation - I could also use a textured plane and just switch out images to make the glow effect as well). Is it necessary to use a ColorInterpolator or is it ok to change those color attributes in a Behavior?

So my main question is how should I animate the light beam from OFF position to ON position.

I was thinking I could do this
Solution 1.
Use a ModelClip object and apply that to the beam. Set the appropriate region on the model clip (at the top of the hilt of the LS). Then translate the beam in the direction of the hilt. That way the entire beam is clipped when in the off position but as soon at it gets out of the bounds of the ModelClip, then it will be visible

Solution 2.
I could deform the geometry essentially stretching it out to the proper link over a period of time. I haven’t done this and am unsure of how to do it. I guess you could use a ScaleInterpolator right?

What do you guys think? Should I do S1 or S2 or something else that I haven’t thought of?

Thanks

For a good light sabre you probably want to use a picture of a light sabre rather than the cylinder - to see the relative virtues of these two look at Dark Forces 2 ( or Jedi Knight) and Jedi Knight 2 (not Dark Forces 3 - I have no idea why) which I think uses the “picture of a light source” technique - you can’t get a convincing glow without it. If you are using a picture of a light sabre you could quite easily have a graphic for the tip of the sabre on one shape and a second one with a narrow band of the as-it-were blade of the sabre that you stretch to size, if you see what I mean.

So is this what you mean?

http://www.parl.clemson.edu/~mspeth/downloads/saber.png

So essentually you would just need graphics to do all the animation (even the transition between on and off). You really don’t need to worry about the transparent box (just add that to the branchgroup for the light saber when the saber is on and remove it when the saber is off).

Um, I dont really understand. Are you saying that you need a seperate graphic for the tip? Or are these images textures that get put on the transparent box (meaning they aren’t images put onto a plane that is BillBoarded)???

That is pretty much what I meant.

[quote] Are you saying that you need a seperate graphic for the tip? Or are these images textures that get put on the transparent box (meaning they aren’t images put onto a plane that is BillBoarded)
[/quote]
I’m saying that you have a small (partially transparent) graphic for the tip, enabling you to have a glow effect around the end of the sabre and another small partially transparent graphic for the blade because that is basically uniform so you only need a small graphic for it.

So if you have a straight section with glow to the sides, which I will represent as “=” and a rounded glow end graphic ( “>” ) you could start like this:

hilt | = >

And then extend the geometry over several frames (or better over a certain duration) either stretching the texture or allowing it to repeat so you get this:

hilt | = = = = = = = = = = >

I think a billboarded plane (or OrientedShape3D, as I think we are supposed to use these days) would work fine for this.

I don’t mean to beat this to death; however, I want to make sure I understand exactly what your talking about.

  1. So you use an OrientedShap3D object and apply a texture to it. In ON mode, we continually switch out textures of this object to make the light saber look like its glowing.

  2. You have a differnt texture for the tip of the blade and a differnt texture for the rest of the blade.

  3. ON/OFF animation envolves scaling the blade plane with repeated texture while keeping the tip of the blade the same (just translate it) over a period of time.

Conclusions - all we are using here are textures mapped onto planes. We aren’t using any 3D models (like a cube or cylindar).

Concerns - if we are only using textures, then how do we get the saber too look 3D when moving it around (Billboarding means to keep the plane always pointed at the users eye).

[quote]
to see the relative virtues of these two look at Dark Forces 2 ( or Jedi Knight) and Jedi Knight 2 (not Dark Forces 3 - I have no idea why) [/qoute]
So are you talking about Academy? From playing academy, it looks like they use a rounded cylindar for the blade and a texture plane or something ontop of the saber (but I could be wrong).

Thanks

I was talking about the second Kyle Katarn one, but Jedi Academy is the same engine. Jedi Outcast- that was it’s name…

As far as I know neither OpenGL nor DirectX can render any kind of glow, so if your lightsabre appears to be glowing you are looking at an image. The way to make it look cylindrical is to draw a convincing picture of a cylinder. Given that the lightsabre is a light source already you won’t get any actual “shading” in terms of light and shadow on it, so the shape is pretty much irrelevant. You don’t need to switch textures for a glow effect, just have an alpha-blended texture so that you have the space around the sabre largely transparent with just a hit of light colour.

You are right about the billboarding thing, I’m not sure that is what I meant.

Perhaps what you can do more easily is use two crossed planes

I am thinking that probably the tip of the blade is on a second Shape or that you are using some clever texture co-ordinates to map parts of the graphic to different parts of the shape. It should be possible to find some of the jedi academy/ jedi knight 2 skins around somewhere which should solve the shape/graphic question, but I’m pretty much sure that you will find we are looking at an image mapped on a flat plane.

If you really want to use a shape, you could always have a cylinder for the blade with an alphablended plane, or crossed planes down the middle of it and sticking out both sides to create the glow. That may even be the best solution.

This may be true for just the glow effect; however, if you look at a light saber, it not only glows, but it is a pulsating glow. Can you still accomplish this with only alpha-blending???

Is this what you’re talking about (how to set alpha blending)?


TransparencyAttributes ta = new TransparencyAttributes( );
ta.setTransparency( 0.5f );
ta.setTransparencyMode( TransparencyAttributes.BLENDED );
app.setTransparencyAttributes( ta ); 

For the 2 planes - are these billboarded planes or planes that are static relative to the blade?

Static relative to the blade, so the effect is kind of like a cross. You were right about the billboarding- I was getting confused about how that worked and in my mind it was the exact solution, although in the real world it wasn’t at all :slight_smile:

I’m thinking that the easiest way is actually to use an image with an alpha channel, but I haven’t worked with any of this in the last year, so I’m afraid I may not be a world of help where that is concerned - I seem to remember that I got most of what I did from j3d.org when I was working on it.

Thanks for your help. I think I figured out a solution.
Here it goes …

  1. Create a Shape3D object (this is just a plane with a texture mapped to it)
    call this saberBeam.

| |
To make a good light saber beam texture (using gimp) do this

  • Select a rectangular region (like the area you want the glow to be in)
  • select the gradiant tool and under the Gradiant option, select Shapeburst(dimpled)
  • now apply the gradient to the selected region
  • choose, filters->blur->Gausian Blurr(RLE)
  • set the fields to 50 and apply
    Thats it, you now should have a nice looking texture.
    | |

  1. Create an OrientedShape3D object.

OrientedShape3D billboard = new OrientedShape3D(saberBeam.getGeometry(),saberBeam.getAppearance(),OrientedShape3D.ROTATE_ABOUT_AXIS,new Vector3f(0f,1f,0f));

Notice, the orientation is very important as well as the vector for the axis.

Thats it. Now if you want to make the saber radiat (swelling and contracting) then you need to create a series of saber textures. (I haven’t done this yet but you will want to modify your original texture (making it bigger and smaller). The more textures you have the better (of course too many will take up too much memory).

For animating the texture, you will want to create a Behavior and basically switch out the textures. If you want to see the code for this, I can post it or e-mail it to you.

Here are some screens that I took of my newly created saber (this is only using 1 texture).

Place note note, that the hilt of the saber’s graphics look like crap and thats because I have mainly just focused on getting the saber’s blade to look right. I also used a cylinder with a sphyere at the top to render the middle part of the blade (it makes it look more solid then just using a textuer).

http://www.parl.clemson.edu/~mspeth/downloads/saber_blade1.png

http://www.parl.clemson.edu/~mspeth/downloads/saber_blade2.png

Well done - that looks great!

Well, I just got done with animating the beam texture as well as scaling the beam geometry.

Check out these cool pics (again, I haven’t worked on the hilt geometry - I know it looks lame).

http://www.parl.clemson.edu/~mspeth/downloads/saber_off.png

http://www.parl.clemson.edu/~mspeth/downloads/saber_mid.png

http://www.parl.clemson.edu/~mspeth/downloads/saber_on.png

Oh, and all I did to make the beams go on and off is extend the Behavior class that modifies the y-value for all coordinates of the saber beam’s geometries.