Fork me on GitHub
#datavis
<
2015-11-30
>
kephale14:11:33

Just had to post that intermediate image before switching back to cell simulations, the bunny is just the seed mesh to be deformed. If you squint you can see tiny extrusions along the path of the swarm, but need to do some tweaking to improve the mesh-mesh collision code.

meow14:11:44

@kephale: How are you handling meshes in brevis? Do you have a lot of Java code for that? Have you looked at how http://thi.ng geom handles meshes? Just curious how they compare. I'm having to extend the http://thi.ng mesh quite a bit to do what I want.

kephale14:11:26

Meshes aren’t super clean, but that is getting refactored a bit with some upcoming work from the image stuff. Yes, it is heavy on Java, but what I’ve been doing for that is actually subclassing Clojure maps, so you still get all those perks. I haven’t done that for meshes yet, since the only functionality they have really needed was load, render, and collide.

kephale14:11:47

I’ve skimmed the gmesh code a bit from http://thi.ng, but i havent taken the full serious pass yet

kephale14:11:33

what sort of extensions have you needed?

kephale14:11:46

at least color and x3d?

kephale14:11:29

i cobbled together a prototype for outputting a brevis scene to http://thi.ng luxor

kephale14:11:50

but you dont really need to use geom meshes for that

kephale14:11:58

i guess i’m most likely to add conversions to/from http://thi.ng meshes, and maybe try to match function names where that can still be done

meow14:11:40

I'm adding these operators that take a mesh and create a new mesh using information about vertices, edges and faces from the original mesh. And some of the operations are funky like replacing a vertex with an n-gon face. So I'm having to build additional data structures and maps so that I can do these manipulations. Like this:

(defn vertex-edges
  "Returns a vector of edges for a vertex."
  [mesh vertex]
  (let [dataset ((:vertices mesh) vertex)
        xf (map (fn [datamap] [(:next datamap) (:prev datamap)]))
        np-map (into {} xf dataset)
        start (first (sort (keys np-map)))
        verts (reduce (fn [acc _]
                        (conj acc (np-map (last acc))))
                      [start] (range (dec (count np-map))))
        edges (map (fn [e-vert] [vertex e-vert]) verts)]
    edges))

meow14:11:35

Because the new face needs to be in the right vertex order so that the normal points outward maintaining the integrity of the mesh.

meow14:11:10

So I'm having to really dig into the mesh code to see what kind of helper functions already exist.

meow14:11:40

And when they don't I have to figure out how to get what I need out of how the mesh info is stored internally.

meow14:11:43

So I'm just taking a stab at all this and at some point I'll go back and clean it all up.

meow14:11:53

The lack of documentation, docstrings, variable names that I understand, etc. is making it a challenge.

kephale14:11:37

heh, i can sympathize

kephale14:11:17

just thinking through a way to maximize the ability to reuse your code in brevis, where they might not quite be pure maps

meow14:11:32

Plus the use of protocols defined in separate namespaces and such means that a lot of times Cursive F4 (to move to the source definition) puts me on the protocol definition, not the implementation, which tells me nothing worthwhile.

kephale14:11:54

i haven’t tried overriding specific key entries, which might be interesting

meow14:11:56

I have a couple of meshes (foo and bar) that I keep around to inspect in the REPL, which helps a lot.

kephale14:11:37

i.e. (:vertices mesh) ends up being equivalent to a (.getVertices mesh) call, which I believe would be sliiightly faster

meow14:11:18

mesh is a defrecord so things like (:vertices mesh) tend to be good performance-wise

kephale14:11:06

mmm, brevis meshes are already java classes, which is the only reason i’d do something that obscure

meow14:11:28

a defrecord is a java class

kephale14:11:56

mmm, i mean literally java code

meow14:11:41

I'm happy sticking with clojure code

meow14:11:51

... for all my datavis needs ... 😉

kephale14:11:37

mmm brevis was originally pure clojure, using penumbra to get graphics, but (and if it turns out to not be true i’d be all the happier) moving all rendering to java gave a significant performance boost, which made it easier to move meshes to java

kephale14:11:41

honestly there are some discussions about moving the rendering to native code even, with clojure on top

meow14:11:56

what about webgl?

kephale14:11:26

and just to add, the hope is to not force java on anyone (its an awful thing to do to a person), so using brevis only involves clojure code

meow14:11:42

Not sure what you use for rendering now...

kephale14:11:44

yeah, there is a student helping out who is poking around at the webgl side of things

eggsyntax14:11:41

You're probably aware of this, but just in case: Three.js (which is what MathBox is built on) provides a pretty cool higher-level abstraction over webgl.

kephale14:11:41

it was penumbra, then it got migrated to pure LWJGL, i’m working with some J3D/JOGL people, and will probably move it over to that in december

kephale14:11:10

mmm the student, Tim Stiles, is working in three.js

kephale14:11:26

but i wouldn’t claim to be familiar at the moment : P

eggsyntax14:11:55

I'm essentially not either, since I'm working with a further abstraction over that abstraction 😉

kephale14:11:20

and he’s in JS land, so i’m still quite excited about your cljs version of mathbox

kephale14:11:18

http://thi.ng is certainly providing webgl as well, which keeps me on the fence about what to do next

kephale14:11:45

but the difference in ease between using http://thi.ng, relative to actually extending it, is prohibitive at the moment

eggsyntax14:11:01

Making steady progress on open-sourcing cljs-mathbox, by the way. Currently struggling a bit with getting it working properly with {:optimizations :advanced} & getting the externs file right.

meow14:11:22

This seems to have stalled but for a while Kovas was working on Gamma https://github.com/kovasb/gamma

eggsyntax14:11:34

I'm on vacation, so I'm only putting in about half-time on it, but I'm getting there 😉

kephale14:11:26

oh yeah, gamma looks super cool too

meow14:11:29

I have done nothing with webgl and http://thi.ng so not sure what that is like.

meow14:11:26

Mathbox looks so cool and if we could do that kind of stuff in clojure that would be awesome.

kephale14:11:46

and fwiw, a lot of my image work stays really close to java, so i’m probably more open to tossing in java than i should be

kephale15:11:00

yeah, my first plan for @eggsyntax and @georgek ’s mathbox cljs interface is to try hooking it up to a brevis world running on a cluster for visualizing ecological dynamics

meow15:11:19

I'm totally agnostic on the rendering side of things. I just really needed a mesh construct that I could manipulate and keep valid.

kephale15:11:39

mmm, i’ve been thinking that the smart thing to do would be to setup http://thi.ng meshes to behave like first-class physical objects in brevis

kephale15:11:23

allowing all existing http://thi.ng mesh code to work as usual, but then you can toss it into a simulation where the mesh can be deformed by other objects, and other sorts of physical simulation

meow15:11:35

I think Karsten has a little bit of physics code somewhere in http://thi.ng. Wonder if that would be useful.

meow15:11:05

looks like its just particle physics

kephale15:11:17

yeah, and the example is 2d

meow15:11:42

What kind of deformations do you want to apply to a mesh?

kephale15:11:44

i mean brevis has physics with arbitrary meshes already

kephale15:11:59

its just updating it for concave meshes and such

meow15:11:35

so translating existing vertices along some vector in response to a collision, for example?

meow15:11:50

to create a convex deformation

meow15:11:02

oops, concave

kephale15:11:06

yeah, thats for that swarm brush thing i’ve been playing with

kephale15:11:38

then the other stuff that i’m currently doing in c++ involves actually simulating membrane tensions across the mesh

kephale15:11:44

but thats a different story

kephale15:11:50

the main thing under consideration is making http://thi.ng meshes interchangable with brevis meshes within a brevis simulation

meow15:11:24

Yeah, that's a fairly different set of issues than my work, where I'm adding/removing vertices/faces according to various rules that come out of nowhere, rather than any laws of physics.

kephale15:11:00

well, the actual ops on the mesh are similar though

kephale15:11:24

its just what triggers the function calls that changes

kephale15:11:58

gotta run, but, one thing

kephale15:11:05

for example all the dice on shapeways

kephale15:11:16

it would be amusing to be able to say you’ve rolled them to test whether they are biased ; P

meow15:11:24

And a mesh is really just a minimal data structure that keeps track of vertices, edges, and faces so that their normals are valid. Then its combined with a bunch of functions defined by protocols.

kephale15:11:53

a hangup i get into though, is that i often need metadata at the vertices

meow15:11:03

dice bias is a discussion topic on the shapeways forum

kephale15:11:10

oh really?

meow15:11:32

I'm running into needing more and more metadata as well.

kephale15:11:40

it would be quite fun to take these meshes you’ve been making, inscribe some numbers, and test for bias

kephale15:11:59

but must run, this is a good conversation to start the day with though!

georgek16:11:58

@meow: Your stuff is lookin’ Swank!

georgek16:11:56

@kephale: Your plan sounds bad-ass! Fer it

pleasetrythisathome20:11:57

hey @georgek @eggsyntax. just coming back online after holidays and thought i'd say hi!

pleasetrythisathome21:11:06

glad to see #C0F0V8DT5 is going strong

eggsyntax21:11:41

@pleasetrythisathome: welcome! Yeah, things are off to a flying start simple_smile

pleasetrythisathome21:11:17

I spent a lot of time with toxic.libs when I was using processing a lot years back

pleasetrythisathome21:11:28

have always been a big fan of Karsten's work

meow23:11:16

@pleasetrythisathome: Thanks! I'm having a lot of fun with it.

meow23:11:03

Here's a low poly thing with lots of color blending to make it more interesting https://pbs.twimg.com/media/CVCECZBUkAEq227.png:large

meow23:11:38

I'm still grinding out some basic mesh operators so that I have a basic grammar that I can combine in novel ways.

meow23:11:45

For every function I write I have a ton more that I've thought of. And for every mesh I post I've created dozens and dozens of variations on my machine that I decided weren't good enough.