POV-Ray : Newsgroups : povray.advanced-users : Applying noise to geometry : Re: Applying noise to geometry Server Time15 Sep 2024 16:39:48 EDT (-0400)
 Re: Applying noise to geometry
 From: Chris R Date: 16 May 2023 16:40:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.6463e9ae2d727589a39f4a525cc1b6e%40news.povray.org",
"headline": "Re: Applying noise to geometry",
"dateCreated": "2023-05-16T20:40:00+00:00",
"datePublished": "2023-05-16T20:40:00+00:00",
"author": {
"@type": "Person",
"name": "Chris R"
}
}
yesbird <sya### [at] gmailcom> wrote:
> Hi,
> while working on Yes-project, I am trying to find the way of making
> the objects less 'geometrical', giving them more natural and 'noisy'
> shapes (like in this attachment, for example). The only way I found in
> manual is to play with normals, but I'd like to have an influence on
> geometry, to apply more relief.
>
> It's possible to pass a noisy hi-res mesh from ZBrush, as I'm doing now,
> but this is not 'pure' POV-way and import takes some 'non-zero' time.
>
> Maybe anyone can advise something about such arbitrary geometry
> modifications ?
> Thanks in advance.
> --
> YB
My preferred method for doing this, albeit introducing some longer render times,
is to use isosurface objects.  I usually start with a function that defines the
non-perturbed shape of the object, e.g.:

#local _shape_fn = function(x,y,z) {
sqrt(x*x+y*y+z*z) - 1
}

for a 1-unit radius sphere.

I then use one of several techniques to do the perturbations.  For example,

#local _shape_fn = function(x,y,z) {
sqrt(x*x+y*y+z*z) - (1+0.1*f_snoise3d(x,y,z))
}

or
#local _pattern_fn = function {
pigment {
bozo
color_map {
[0.0 rgb 0]
[1.0 rgb 1]
}
}
}
#local _shape_fn = function(x,y,z) {
sqrt(x*x+y*y+z*z) - (1 + 0.1*_pattern_fn(x,y,z).gray)
}

or, if your shape function is well-behaved, (i.e. returns a value representing
the distance from a point to the surface of your object), you could do it this

#local _shape2_fn = function(x,y,z) {
_shape_fn(x,y,z) - 0.1*_pattern_fn(x,y,z).gray
}

The attached image is a pretty complex example, where the basic shape of the
wood-part of the blocks is basically f_rounded_box, but patterns are applied for
the wood grain, dents in the wood, cracks in the wood, etc.

-- Chris R.
```

Attachments: