Flower and ocean

 
 
 
Posted by:havardsc
Data created:24 October 2012

Hi,

im really digging this tool so far! Using Lab and Ephere.Geometry.dll it is super easy to create more complex meshes and hook them up with max.

Here is some stuff I got so far:

A flower animated by its input nodes:

I actually built this in the node editor at first, but it got lost after I installed the newest build. Since it was a cumbersome process with many nodes it was faster to write it to a class library in C# and use it from there. 

Here is the lab setup showing the animatable inputs. The CreateFlower node is loaded from the class library. To get an idea of what each input does and the equations used to buiild the flower: http://demonstrations.wolfram.com/VirtualFlowersWithCrispatePetals/

Here is the C# code I wrote: http://pastebin.com/D9sph6AK

 

I have also implemented some Tessendorf water using this article as source:

http://www.keithlantz.net/2011/10/ocean-simulation-part-one-using-the-discrete-fourier-transform/ 

Here is the simple lab setup:

 

I can upload the C# project if anyone wants it. The next step is to try and make a modifier out of it.

 

Wow, amazing! Great job, and it is good to see that Lab is useful for you.

I've been holding back but I will also try to start posting some stuff soon.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Thanks a lot, the C# code is much appreciated. Great to see how easy it is to create geometry for Lab.

I'd love to see the Tessendorf one, too.

Martin

Martin

 

Great work!

I especially like the tessendorf example, was it made as a modifier or as a primitive?

Hi again.

 

hedphelym, at first it was a primitive but now I've  made it into a modifier.

Here it is applied to a geosphere:

http://folk.ntnu.no/havardsc/scripts/Tessendorf.rar

Here is the .ctx file, the class library and the corresponding .maxml file, as well as the source files for the class library.

(Some of the code has a c++ style over it since it is more or less a direct port from the source link posted in my first post, and I didn't want to break anything before I got it working :))

It would be cool, in addition to the mesh output from the modifier, to also add additional data as output. Maybe they could show up as readable properties on the object? Say I want to add vertex velocity data as well as the mesh as output. Further I could create a lab texture that used that data as input to create some cool maps. 

Sorry for slow reply.
I'd like to say thanks for sharing this!
That's very kind of you.
I will download and have a look at it when I get home tonight.

 

Going to dump some more tests I did:

A flocking modifier;

In this case the boids are bound by these weighted rules: cohesion, alignement, separation, maxspeed, movement inertia, max bounds and a leader (the static box). 

it's somewhat based on this http://www.red3d.com/cwr/boids/ without the neighbouring constraint, it just using a spherical distance to determine neighbours to ease the implementation. I also use a kd-tree to speed it up a bit.

Code: http://pastebin.com/G0XTgVAz

 

The next thing is a cruel heightfield water implementation as a geometric primitive, inspired from this nice talk http://www.matthiasmueller.info/talks/GDC2008.pdf

As a friend of mine put it, a boat driving through jelly:

The collision is just a position delta length times a user defined scalar on the grid points inside the boat.

Code: http://pastebin.com/5EgEQG0y

 

The last thing is just a quick implementation of a voxelizer:

A static method pastable in a script node: http://pastebin.com/ugzaTseA

Awesome stuff again. Is the flocking modifier a single mesh? I will have to go through all of your files to see how you did it.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

It's a single mesh, yes. Here is a screen of the setup with the modifier disabled: http://i.imgur.com/gawy4.png

The leaderTransform and predatorTransform should be properties like the rest of the input instead of arguments of the update function, but I had trouble of getting the updated values in the previous build and tried different setups to get it working.

Wow, these tests are amazing! Great job! :)

I just saw these now and it's very impressive. C++ code is out of my league though, and I am trying to figure out if Lab can be useful for me with my limited programming knowledge.

What piqued my interested with the last build was that it now has spacewarp support which I'm really interested in. Going to refresh my memory by watching some videos and see how far I can get. This is motivating to see these examples. I'm surprised there's not more action on this forum though. 

I hope that you can find it useful, Tobbe. We've been doing work to simplify things recently so I hope that helps. Feel free to ask any questions.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Don't suppsoe anyone would recompile these above examples into downloadable working examples - they would be a great learning resource.

There are many/any working downloadable files to help people starting out the the Lab.

Or if general more projects for people to download and see how others are putting projects  together.

 

I can compile and rehost the stuff again. My site got taken down since it was hosted on my university's host and I just graduated half a year a go. I also got some other small projects I can post. 

I can compile and rehost the stuff again. My site got taken down since it was hosted on my university's host and I just graduated half a year a go. I also got some other small projects I can post. 

 

That would be great ! They all look like such great projects and good learning resources - especially as I've never used C# and I think the way of referencing .dll's may have changed since you posted.

 

 

 

Referencing assemblies should be the same, by adding a comment at the top of the script with a list of assembly names separated by a space.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Hi again,

I uploaded some projects to a repository: https://bitbucket.org/havardsc/laboratorium.

The first project is spacecolonization, an elegant algorithm for creating structures that don't intersect with  themselves, like branches and veins. In short, the algorithm scatters attractor points that the structure move towards and 'eats' them up when they are close enough. The actual algorithm in implemented as a spline, that grows over time. In addition, I added a mesher that can animate the thickness of the structure over time. Here are some examples:

Just the spline growing on a teapot. The attractor points are scattered on the surface of the teapot.

A spline growing on a plane with the added mesher on top, increasing the thickness over time:

A structure growing on a teapot with a negative thickness growt value:

The next project is a simple deformer with the option of creating creases on the edges of the mesh collisions as well as returning to it's original state.

A collision with edge creases and and the mesh returns to it original state:

A simple collision with an added flex modifier:

The last project is a little test I did to create a custom user interface that controls lab. It is a texture plugin that creates a cruel camoflague pattern using 5 different colors. These five colors is fetched from https://kuler.adobe.com/. The gui lists 15 random colors themes from Kuler and the texture changes accordingly when you select a theme. The gui is created using wpf, and the textureplugin is automatically setup using maxscript. The color themes are fetched asynchronously from the web so the gui does not hang when the color theme list is fetched/updated.

Here is a screenshot of how it looks in max:

 

 

Here is an example of how I usually set up these projects:

- First you need to copy the .dll files to the %localappdata%\Local\Ephere\Library\bin folder

- Then create a nameofmydll.maxml file and it content should look something like this:

?xml version="1.0" encoding="utf-8" ?>
MetaAssembly Name="nameOfDll" xmlns="http://www.ephere.com/modeling/dependency/metaassembly.xsd" LicenseCode="Ask for key"> 
Pluggable Type="FullNamespacePathToClass.Class"/>
/MetaAssembly>

So in my case, to expose the space colonisation and deformer projects, the file looks like this:


?xml version="1.0" encoding="utf-8" ?>
MetaAssembly Name="HavardscLaboratorium" xmlns="http://www.ephere.com/modeling/dependency/metaassembly.xsd" LicenseCode="Ask for key"> 
Pluggable Type="HavardscLaboratorium.Deformer.Deformer"/>
Pluggable Type="HavardscLaboratorium.SpaceColonisation.SpaceColonisation"/>
/MetaAssembly>
   

   

 

Here is how I set up the space colonisation project in the plugin:

First I create the spline class from a static constructor taking a mesh where the attractor points are scattered on, as weel as starting points for the structure. The spline class has an update method that takes a time variable and outputs a spline. This spline is feeded to the mesher, which also is created from a static constructor and an update method which takes the spline as input. The mesher update method generates a mesh that is the output of the plugin.

 

So that is how I usually do it when creating stuff with Lab. The code in the repository not documented in any way and is pretty sloppy, so be aware :)

Ok, first of all WOW. That stuff is all awesome and a great usage of both Coden and Lab.

I cannot access the files on Bitbucket, it says I don't have access. The WPF GUI is a very clever touch, it looks very powerful. Would you be open to a possibility of making some tutorials on this? :)

Marsel Khadiyev (Software Developer, EPHERE Inc.)

 

The repository is now (hopefully) public.

I can probalby write some stuff down on how to do the wpf gui, it's pretty straight forward. The only issue I had was getting .net events to work when hosting .net controls in a rollout of a custom attribute's. (Some details on that here: http://forums.cgsociety.org/showpost.php?p=7804882&postcount=1)

 

Edit: I forgot to add that in order to run the camogenerator project you would need a Kuler-key to access the API, which they at the moment no longer give out. I don't think it would be smart to add my Kuler-key to the repository since it is public.

Thanks a lot Havard,

Downloaded the repository successfully. I don't have a Kuler API key but I will peruse the sources anyways :) Keep up the great work and let me know if you bump into anything else.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

I second that WOW and thanks for sharing - shall pour over these asap.

Thanks hotknife!

I added a new project which lets you get a 3d map from anywhere in the world using Bing maps, I think it is really cool to play with. It creates a wpf-control from Bing that lets you zoom in anywhere and with the click of a button the map is instantly transferred to max with elevation data applied. It is an adaptation from this blog post: http://www.bing.com/blogs/site_blogs/b/maps/archive/2013/02/12/3d-elevation-models-with-bing-maps-wpf.aspx

 

 

Got a couple of questions:

Is there a way to apply smoothing groups to a mesh using lab/coden?

Can I upload/distribute the project's .maxml-file? Im asking since it has a license code attached to it. 

The Bing maps integration looks very cool. I was certain we supported smoothing groups but perusing the code reveals that it might not have been fully exposed. I will see if this could be done for the next build.

Regarding distributing the maxml file yes, you can distribute and share it without restrictions.

Marsel Khadiyev (Software Developer, EPHERE Inc.)