3d modeling tools

278 views
Skip to first unread message

Lee Spector

unread,
Mar 12, 2012, 10:58:43 AM3/12/12
to clo...@googlegroups.com

I'm starting a new project involving 3d modeling and I'd like info on availability of related clojure tools -- and I'd also like to pitch a related tool-building project for anyone who might be interested in working on such a thing.

First, I see from github that penumbra is not under active development. Is there a more active project or recommended approach for 3d graphics in clojure?

How about for physics (especially physics engines that can make use of large numbers of cores)?

How about (especially) something that integrates 3D graphics, a simulation loop architecture, and features like fast neighbor/collision detection?

What I'd really love more than anything else would be a version of Jon Klein's "breve" system (http://www.spiderland.org/breve), or a tool with many of the same features, that makes it really simple to write simulations in clojure. Breve allows coding in its own language ("steve") and in python... but it's not being actively developed. I'm not suggesting a project that actually uses breve's code base (although it's open source and that would be possible -- also, Jon was my student and developed breve in part under my funding/direction, and while he has since moved on to other things he's still reachable and helpful) but rather something independent that provides similar functionality in the clojure world.

What functionality do I mean? Well, breve provides lots of goodies including trivial installation, a nice GUI for coding and running simulations, painless and pretty 3d graphics, physics, a simulation loop and event handling architecture, fast collision detection, etc. But I could see great value in tools that handled only certain subsets of this.

For example I could definitely see forgetting about the coding GUI since that's a whole can of worms being dealt with elsewhere in the community, and also a lot of simulation projects don't need physics. So something that provided just the 3d graphics and a nice way to set up common simulation loops (for example, making it easy and concise to code up the "swarm" demo in breve) would be great.

I'd love pointers to any tools that anyone thinks are relevant, and assuming that there's not already a wonderful integrated tool that I don't know about I'd be happy to correspond/collaborate with anyone who wants to develop one.

Thanks,

-Lee

Niels van Klaveren

unread,
Mar 16, 2012, 10:05:02 AM3/16/12
to clo...@googlegroups.com
AFAIK there's not much projects focussing on 3D in Clojure, but you can take a look at processing (http://processing.org) and one of it's Clojure wrappers. It's a great little language for 2D/3D visuals, and there's plenty of swarm-like demos for it (http://openprocessing.org). For 3D calculations, (verlet) physics and more there's the java library toxiclibs (http://toxiclibs.org), whose author is currently porting/wrapping  to Clojure.

It's not really a cut-and-dried solution, but it's pretty flexible and has a simple API unlike a lot of 3D projects which focus very narrowly on games development.

Regards,

Niels

Op maandag 12 maart 2012 15:58:43 UTC+1 schreef Lee het volgende:

Lee Spector

unread,
Mar 19, 2012, 7:15:53 PM3/19/12
to clo...@googlegroups.com

On Mar 16, 2012, at 10:05 AM, Niels van Klaveren wrote:
> AFAIK there's not much projects focussing on 3D in Clojure, but you can take a look at processing (http://processing.org) and one of it's Clojure wrappers. It's a great little language for 2D/3D visuals, and there's plenty of swarm-like demos for it (http://openprocessing.org). For 3D calculations, (verlet) physics and more there's the java library toxiclibs (http://toxiclibs.org), whose author is currently porting/wrapping to Clojure.
>
> It's not really a cut-and-dried solution, but it's pretty flexible and has a simple API unlike a lot of 3D projects which focus very narrowly on games development.

Thanks Niels.

I've actually used Processing quite a bit -- even taught a couple of courses with it -- and I've played a little with the Processing library via Clojure. I'll have to look into that again in this context.

I recall some frustration with Clojure+Processing which I think stemmed from (1) feeling trapped in the applet context, (2) not knowing how to run programs that use the library on nodes without graphic displays (from which I would dump data to files -- I do lots of runs on cluster nodes to collect data), and (3) not knowing how to get Processing-based projects to take advantage of multiple cores. If you or anyone else has comments related to these issues then I would love to hear them.

The toxiclibs library also looks quite interesting. Do you know of any examples that show this being invoked from Clojure?

-Lee


Jeff Rose

unread,
Mar 20, 2012, 12:32:18 AM3/20/12
to Clojure
If you are going to use processing from Clojure, you'll want to
checkout Quil:

https://github.com/quil/quil

It's a more Clojure friendly take on processing sketches, and it's a
lot less painful to get up and running.

-Jeff

Karsten Schmidt

unread,
Mar 21, 2012, 7:14:51 AM3/21/12
to clo...@googlegroups.com

> For 3D calculations, (verlet) physics and more there's the java library
> toxiclibs (http://toxiclibs.org), whose author is currently porting/wrapping
> to Clojure. It's not really a cut-and-dried solution, but it's pretty
> flexible and has a simple API unlike a lot of 3D projects which focus
> very narrowly on games development.

Hi guys,

the Clojure version of toxiclibs is NOT going to be a wrapper of the existing Java version, but a complete re-write & opportunity to re-think the current architecture and benefit from Clojure's qualities (e.g. protocols & concurrency). Also, both the Java and the upcoming Clojure version are actually only focussed on generic operations & data structures for 2d/3d geometry tasks, interpolation, verlet physics simulation, voxels, color theory and related concepts. Neither deals with rendering/displaying the results.

So far the Clojure version is still very alpha, and only parts of the core library have been implemented (geometry tools, mesh & OBJ export)...

The repository is here (but lacking any documentation, check the tests, though, for general usage):
http://hg.postspectacular.com/toxiclibs.clj/
http://hg.postspectacular.com/toxiclibs.clj/src/tip/test/toxi/test/geom.clj

A recent version is also on Clojars:

[org.toxiclibs/toxiclibs-clj "0.2.0-SNAPSHOT"]

As mentioned, am making heavy use of protocols (and defrecords). Here's a slightly outdated map to show the overall structure:

http://flickr.com/photos/toxi/7002599609

To give you a better idea, below is also a little example to generate a 3D cog mesh and export it as OBJ model (e.g. for 3D printing or use with other 3D tools):  The fn creates a circle, converts it to a polygon, deforms the perimeter to create teeth based on a user provided profile, then tesselates & extrudes the polygon into a triangle mesh...

(use 'toxi.geom.core 'toxi.geom.polygon2d 'toxi.geom.mesh.objexport)

(defn cog
  [radius teeth profile depth]
  (let[nump (count profile)
       parts (->
               (circle radius)
               (->polygon2d (* teeth nump))
               :vertices
               (->> (partition nump)))
       poly (->
              (map (fn[_] (map (fn[v s] (scale-n v s)) _ profile)) parts)
              flatten
              polygon2d)
       mesh (tesselate poly)
       mesh (add-meshes mesh
              [(-> mesh flip (transform (translate (matrix4x4) 0 0 depth)))
               (extrude poly (vec3d 0 0 1) depth)])]
    mesh))

(spit "cog.obj" (->obj (cog 100 10 [1 1.25 1.25 1] 20)))

Result: http://flickr.com/photos/toxi/6856447350/

Best,
K.

David Nolen

unread,
Mar 21, 2012, 9:07:26 AM3/21/12
to clo...@googlegroups.com
Wow very cool :)
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
Reply all
Reply to author
Forward
0 new messages