# Marble fractal lines and foliation

Hi,

I was wondering if anyone could help point me in the right direction for generating fractal lines and foliation in Marble as line work. Essentially the impurities in marble creates its pattern, and I would like to generate this in Grasshopper rather than tracing an existing. I’ve started with Fields and then with land contours but it doesnt get that “blocky” feel to it.

See inspiration pics

Fractals is not the way to do that. Controlled recursion [kinda a “special” kind of swarms, so to speak] is. That said speed is the paramount issue … most examples that I’ve seen are slower than any Harley Davidson. I have some “similar” defs (I bet that Tom J has as well [swarms]) but they are carried over 100% via C# code. Notify if you want one for playing around.

But if I was you … I would do it the good old way: trace a real thing and forget computers.

2 Likes

Forgot to mention one of the dominent theories on fluid dynamics:

Google: C# Navier-Stokes, Navier-Stokes fluid simulation etc etc

See this classic as well:

fluid-dynamics-GDC03.pdf (1.0 MB)

1 Like

Did you look at procedural texture ?
There are some example, it could be simple to extract lines with color variation.
http://www.upvector.com/?section=Tutorials&subsection=Intro%20to%20Procedural%20Textures
http://lodev.org/cgtutor/randomnoise.html
A simple solution, you will need

marble turbulence noise.gh (15.3 KB)

7 Likes

Just playing
{pt.x, pt.y,(1+sin((pt.x+att*noise/2)a)cos((pt.yattnoise/2)*a))/2}

11 Likes

Thank you guys for the responses,

I ended up just line tracing it on Illustrator and importing the lines into Rhino… sorta cheating, but I don’t really have the time to delve into the complex maths and scripting

There is no complex in the script I published. Just sliders in order to duplicate classical marble texture.
Nevertheless it was an interesting question

Hi Laurent, huge fan of your work you have posted on GH forums. Is there a way to apply this technique to a sphere instead of a rectangle? Only interested in constructing a mesh for rendering, not extracting contours.

Yes it is possible to apply this technique to sphere.

Bust instead of applying contour I apply Mesh Iso Splitting, so you need to put a value (double not point) at each vertex of the mesh then iso-splitting then colorize.

10 Likes

Here an example with no cut on the sphere.
I use a icosaedron sphere of my own. You have to specify the maximum number of vertices. Here less than half a million. I put many choices. All the equations are in C# to go faster.
Sphere is radius 1, so as noise is scale dependant. I advise you to use 1 unit objects, but it is not mandatory. You can lower the number of vertices to go faster.
Hope it helps.

marble turbulence noise on sphere no cut.gh (24.6 KB)

7 Likes

Thanks so much! You have been extremely helpful.

8 Likes

That is a great effect, Laurent

Hi Laurent,
I was just wondering if you knew a way in which the pattern can become more sparse the further it gets from an attractor curve? I tried to play with the script you supplied, but I just cant seem to work it out.

Thanks

We the graphics guys do this usually with a technique called Domain Warping which is similar to Laurent’s answer just warp your noise function in a noise function instead of using trig: `double myNoiseValue = noise( myPosition + noise( myPosition ) );` noise here should probably be instead a fractional Brownian motion/fractal sum but a simple noise will do and is faster.

2 Likes

Hello Laurent,
I was wondering, how did you flatten the texture in grasshoper?

Hello
I use a square plane mesh, then screen copy. It is also possible to generate the the bitmap withing Grasshopper.

And if you want tileable use a torus for XYZ then use UV coordinate to have to texture on a plane. There are some explanation on the forum.

Note getting periodic noise is really easy once you get the gist of it, the trick is simple: mod your coordinates, is that easy. So you take your UVs and simply do % with the size of the texture, it doesn’t work for everything but for most “classic” noise generation techniques like Perlin, Value, etc… it is that easy. There are examples for that online search for tileable perlin or whatever shader and there probably exists a shadertoy that does it.

Hello Laurent, I admire your work, but, I have tried to transform procedural texture to a texture file, with this file of yours, but I cannot convert it into an image, could you please explain how you do it a little clearer with an image of the file gh. I appreciate your help

Hello
as it is described in this post there are many ways.

As now there are also many image plugins, from JAVID,
Build Bitmap

IMAGE
Build Bitmap

Here a way using the excellent Nautilus plugin

Take a Mesh Plane (Bitmap will be (number of face+1)*(number of face+1))
Take a component that put colors on a Mesh (here Fast Noise Lite from Nautilus)
Plug a Gradient if you want something different than black and white
Use Object to Image that try to convert a rectangular mesh to an image, it converts also a File Path or an image !
Then export using Save Bitmap from BITMAP+ plugin

And now if you want tileable texture, use a torus Twisted Torus, for example

colored mesh to tileable bitmap.gh (19.6 KB)
colored mesh to bitmap.gh (16.0 KB)

Related to this discussion

For tileable I think an extra pixel row and column could help. It is the main problem of conversion between mesh and image. Most of the time color is on vertex but for image color is on pixel (face for a quad mesh). So you could use

5 Likes