Can I Programatically create 3d objects?

I (newbie) am looking for a feature, but I don't know what it's called – if it exists.



I know I can create spheres and cubes from java source code–as opposed to creating them in blender and loading them. If I have a list of vertices (corners of triangles), is there a method that creates a custom 3d object from that? I don't mean a whole complex model, rather I was thinking of objects like a cuboid with angels other than 90 degrees? (trapezoid etc.) Or programmatic L or T shaped cuboids (think: 3d Tetris shapes. Of course for tetris you'd just create them once in blender and load them, that's not what I mean. )



I tried googling for programatic java3d object, but maybe it doesn't exist, or I'm just using the wrong words and you guys can give me a hint. I also came across the word mesh, but that seems to be a distorted plane (and not a closed object)?



To give you a picture of how such a custom object would be useful: I would like to connect pieces of loaded models. E.g.load two models of buildings and connect them with a "bridge", or "wall", no matter at what angle they are to each other. 

the term you're looking for is "procedural"… check out something like this: http://www.cs.sunysb.edu/~george/Java3D.htm



That professor's also done classes in 3D sculpture, which may be of interest to you: http://www.cs.sunysb.edu/~cse325/325-projects.jpg



Procedural generation is a huge topic right now in graphics with a popular surge towards large scale environments in 3D worlds…  Things such as "random" cities are starting to appear as a technology.  The key in procedural generation such as this is laying out "cities" that always work… no matter what piece ends up where.  Shrink that concept down to your example of connecting buildings via bridge and you'll see that perhaps this bridge always needs to be on the same level as the connected buildings, which might effect the generation of staircases within said buildings.  The best start to something like this, IMHO would be a thorough understanding of what parts you want to be procedural, and how those portions are designed in the real-world around real-world constraints…



Hope this has helped a bit…

If I have a list of vertices (corners of triangles), is there a method that creates a custom 3d object from that


You can build a TriMesh from those Vertices.
I don't know a good example right now, but check out how spheres or Boxes are made and adapt for your own needs.

There is also a Extrusion class, which may be of use to you.
Procedural generation is a huge topic right now in graphics with a popular surge towards large scale environments in 3-D worlds...


@sbook, thanks, that's the word! So I didn't invent the idea??! Aw shoot. ;)

The fact that I don't know any commercial procedural 3-D game shows that it's probably very difficult... (Only 2-D games like Diablo are already a bit procedural). I'll "just" try to get the minimum of procedural elements going to make my world appear procedural enough.

Things such as "random" cities are starting to appear as a technology. The key in procedural generation such as this is laying out "cities" that always work.. no matter what piece ends up where.  


@sbook: "Random cities that always work" -- exactly.  :)

@Core-Dump, I'll have a look at the TriMesh in AbstractBox.java, thanks! I don't understand the Extrusion class (2-D?) but I've seen extrusion in Blender and this is related to what I was looking for, I need to investigate further. I wonder whether TriMeshs are slower than standard objects.

Thanks you two!
zathras said:

The fact that I don't know any commercial procedural 3-D game shows that it's probably very difficult... (Only 2-D games like Diablo are already a bit procedural). I'll "just" try to get the minimum of procedural elements going to make my world appear procedural enough.


It's certainly no easy task...  If you aren't already, subscribe to the OpenGL News and Khronos.org RSS feeds... In the past few weeks there have been two (and now that I look, both within a day of each other) articles on this topic:

http://feedproxy.google.com/~r/opengl/zOLP/~3/6LUjFfuy2zA/

http://feedproxy.google.com/~r/opengl/zOLP/~3/0l2rgLam9MM/

the first one's product lacks a homepage, but you can still browse the images (which look darn good).  IIRC, the second is a C++ screensaver, but contains a video of it building in a time-lapse format... watch how it takes shape and check out the order of things being constructed.. if it were completely random (which I'm not sure if this is), then the order would be important in determining if Building 'Foo' can go in Location 'Bar' due to Road 'myRoad' and other things like that

I think ya'll are complicated the issue, he wants to make a bridge connecting two buildings.

How about using a Quad?



There are some Geomtries built-in to JME that you can access programaticly. Things like Quads (2D object), Spheres, Cylinders, etc

xopherxm said:

I think ya'll are complicated the issue, he wants to make a bridge connecting two buildings.
How about using a Quad?

There are some Geomtries built-in to JME that you can access programaticly. Things like Quads (2D object), Spheres, Cylinders, etc


OP was talking about having a logic built into the program which would generate geometry automatically...  If he were just looking to build a singe bridge, then your suggestion of quads would be right on the money :D

sbook is right, TriMesh does what I want. When I use a normal rotated cuboid for my diagonal wall, its vertical edges jut into the adjacent building (depending on how thick the walls are).



I want the edges to match up even if they aren't 90