Rock generator

SheknShekn Posts: 9
edited December 2016 in Canvas Graphs and Presets

One more procedural stuff - rock generator. This node is one-to-one implementation of the similar compaund for Softimage (look, for example, here).

Download: https://dl.dropboxusercontent.com/u/11446262/FE_RockGenerator1.2.zip
Use attached *.canvas file with latest version of the compaund.

Example of generated rocks:

This node creates very dense mesh. Use the parameter of subdivision from 2 to 4.

Some new nodes was created specially for rock generator. But these nodes can be used separately:

  1. Perlin noise. Based on build-in extension but have some additional parameters.

  2. Simplex noise. Similar to perlin noise.

  3. Worley noise. Another noise. This node is similar to the compaund with the same name in Softimage.

  4. Turbulize around value. Combination of perlin and simplex noise to one node. This node is similar to compaund with the same name in Softimage.

  5. Box primitive. New primitive like a cube but with additional parameters for subdivision of it sides along x-, y- and z-axis.

  6. Subdivide. The implementation of Catmull-Clark subdivision algorithm. It works without any pex-operators, because I had problems with access to polygon mesh data in parallel way. So, this node works not extremely fast. But it works.

Comments

  • craouettecraouette Posts: 113

    really nice... and useful general purpose presets!
    thanks for sharing!!!

  • malbrechtmalbrecht Posts: 684 ✭✭✭

    Coooooool! Thanks for sharing!

    Marc


    Marc Albrecht - marc-albrecht.de - does things.

  • malbrechtmalbrecht Posts: 684 ✭✭✭

    Just noticed something I was struggling with as well:

    It works without any pex-operators, because I had problems with access to polygon mesh data in parallel way

    ... what you could do is do the calculation (haven't looked at the code yet, though) in parallel, running on a "blind" Vec3 (or whatever) array and only copy data to the point positions in the PolygonMesh once you're done. I did that in a few experiments and it does give you some performance boosts, if the calculations are many.

    Marc


    Marc Albrecht - marc-albrecht.de - does things.

  • mootzoidmootzoid Fabric Employee Posts: 180 Fabric Employee

    Really awesome set of tools, thanks for sharing this!

  • SheknShekn Posts: 9

    About problem of subdivision in parallel:

    Subdivision process can be divided into two steps. At first we gather the data about mesh structure and, at second, we construct a new mesh. What data we need? In Catmul-Clark algorithm for each face, edge and vertex of the mesh we should create a new vertex (and calculate it position) in the new mesh. It's easy to found position of face-vertex, because this position is average of positions polygon's vertices. So, we can calculate and store it to array in pex-operator, because calculations independent for different polygons.

    But for edge-vertices there are problems. We can not iterate over edges of the mesh, because in PolygonMesh class no indexes for edges. It is possible to get edge by choosing polygon and point of this polygon. If we start pex-operator by polygon indices, then each edge we will considered twice. May be it can be solved by considering only edge with minimum first point index, but it needs more tests. As a result we iterate over edges in for-loop and store in additional array considered edges. It is impossible in pex-operator.

    Similar problems are in the second step, when we construct a new subdivided mesh. Again, may be all these problems may be solved, but it needs some more develop.

    And yes, I am sorry for my english.

  • jfriedmanjfriedman Posts: 79 ✭✭

    Whoa, Cat-clark subdivision? Well done! A simple cat-clark is something we've been looking at making ourselves for a while. Thank you for contributing this!

    By the way, about making the whole thing more PEXy, do you think it may be a win to first iterate through the mesh and cache the minimal information needed to actually do the main work it in a PEX call?

    Alternatively, it may be a win to have a PEX with only 2 parallel items, where one does the edge vertices, and the other does the vertex and polygon vertices (possibly in its own pex call). The only way to know for sure is to measure.

    Btw, I'm interested in contributing to this if you'd like collaboration.

  • Daniele NieroDaniele Niero Posts: 201 ✭✭
    edited March 2016

    Super useful.

    Last year I was doing a simple demo scene in Unreal and I spent so much time building 4, I repeat FOUR!!, rocks in ZBrush :)
    This would have helped a lot ;)

    Speaking about subd... wouldn't be useful if OpenSubd was ported to KL? Fabric guys... ;)

  • borjaborja Administrator, Fabric Employee Posts: 427 admin

    Pretty good @Shekn !

    Borja Morales
    Technical Product Manager
    Fabric Software Inc.

  • wilsimarwilsimar Posts: 6

    very usefull.. thks

  • jfriedmanjfriedman Posts: 79 ✭✭

    Hi @Shekn,

    A small contribution. I improved the performance of the catmul clark subdivision. On my machine, the difference is 950ms vs 75ms, for two iterations on the teapot. The lions share of the improvement was something really simple, changing your "fill vertex data" loop to be a PEX call, which got it down to about 120 ms. Aside from that, I put creating the polygons and the fill vertex data into a 2 task PEX, which got it down to 85ms or so (somehow, doing both together takes about long each one does on its own). The remaining are some minor things, like caching fewer things.

    I also wrapped it up in a compound, where it updates a polygonmesh stored in a variable, which I think is a little friendlier to other things that might look for structureVersion updates and the like (and doesn't have much of a performance penalty).

    Thanks a ton again for providing this.

  • jfriedmanjfriedman Posts: 79 ✭✭

    One more. I made it so corner points (points with only one polygon) stay put in subdivision. Also, this one is less crash prone when you start generating millions of polygons (though still a bit..)

    By the way, perhaps consider putting this in a git repo somewhere to make it easier to contribute to? Also, I had to renamed the attachment for the forum to allow me to upload it, so, it should probably be called Subdivide.canvas (and this should probably be done with git).

  • SheknShekn Posts: 9

    Thank you, Jfriedman, for your modifications. Your compaund really works faster.

  • SheknShekn Posts: 9

    I fond that RockGenerator does not works in FE 2.3.1, because some problems with conversion from Float32 to Float64 (or vice verse). So, I fix it and add some small optimizations.

Sign In or Register to comment.