javaapigraphicsjava-3dlight

Creating 'laserlights' with Java3D/other 3D API


Yesterday I decided to start my new simulator project with Java and Java3D. Since I already programmed Java before it was a big plus and I could directly start with the simulator. Now I was a bit thinking about how I was going to approach this, and I directly stumbled and the biggest part of my program: the laser in the simulators.

I want to create lasers similar to these (of course I won't ever come that close in the beginning, but you get the idea)

alt text
(source: wrzuta.pl)

The problem is, can anyone give me a rough explanation of how to approach this? I walked through the full documentation of Java3D but I couldn't find a feature to create things like these. Just some starting point would be nice already.

(If anyone recommends a different 3D API for this kind of task, which is also for Java, please tell me)

Thanks in advance,

William v. Doorn


Solution

  • Let me preface my answer by saying my experience with Java3D is quite limited. I've played with the examples, but that's about it. However, many of the rules apply across 3D environments.

    If you're talking about a static image: use very narrow cones, add color and transparency, possibly a texture to decrease the alpha component with respect to the distance from the cone's central axis.

    If you're talking about an animated scene, that gets a bit harder. You need to synthesize the fog. Volumetrics will give you incredible images, but it's computationally expensive, and I don't think Jave3D supports it. However, I think you can fake it if you have an object that is parent to all of the laser beams and Java3D will let anchor a texture to the parent and let the children inherit it.

    Update 1: I would start with a Cone with a very small radius as a single beam.