POV-Ray : Newsgroups : povray.general : Mapping Textures on irregular shapes : Re: Mapping Textures on irregular shapes Server Time
17 May 2024 16:35:02 EDT (-0400)
  Re: Mapping Textures on irregular shapes  
From: Josh
Date: 1 May 2020 16:50:07
Message: <web.5eac8b5172e01857dc1270cd0@news.povray.org>
"Josh" <nomail@nomail> wrote:
> "Josh" <nomail@nomail> wrote:
> > "Bald Eagle" <cre### [at] netscapenet> wrote:
> > > "Josh" <nomail@nomail> wrote:
> > >
> > > > > A starting point :
> > > > > function { Fnct01(x+sin(y*2+z*3),y-cos(x*7),z+cos(y*5)) }
> > >
> > > I honestly can't even begin to imagine what inspired _that_.
> > >
> > > > That produced interesting results. It split the shape up and duplicated it a
> > > > bunch of times. I'll have to think about it.
> > >
> > > You and me both  :O
> > >
> > > > In the meantime, does anyone know what the isosurface function would be for a
> > > > rounded box?
> > >
> > > As a matter of fact, I do!  :)
> > >
> > > #declare R = 20;
> > > #declare RoundedBox = function {pow(x,R) + pow(y,R) + pow(z,R) - 1} // rounded
> > > cube
> > >
> > > I haven't tried making all of the R's different ... yet   ;)
> > >
> > > Hope it's going well, and you're making progress.
> >
> > Well, it's interesting. I was hoping that the rounded box would be in the form
> > of:
> > float sdRoundBox( vec3 p, vec3 b, float r )
> > {
> >   vec3 q = abs(p) - b;
> >   return length(max(q,0.0)) + min(max(q.x,max(q.y,q.z)),0.0) - r;
> > }
> >
> > from the Inigo Quilez examples you posted earlier. I'm trying to figure out how
> > to union/merge boxes together and then round them all together. The math is
> > confusing me. I took enough calculus years ago I should be able to figure it
> > out, lol. His SDF functions are very similar to isosurface functions, yet they
> > are different enough I can't get them to match. In his SDF functions he is able
> > to simply subtract r from the function to round a shape, but I can't get the
> > isosurface functions to match that.
> >
> > Josh
>
> In other words, I'm not sure what vector functions povray has. How would I
> convert that function to a povray function?
>
> Josh

Here's my attempt to declare that function in povray, but it won't compile...

#macro sq(X) X*X #end

#declare BOX_SHAPE2=
function(x,y,z,k1,k2,k3)
{
  #declare q = <abs(x), abs(y), abs(z)>-<k1,k2,k3>;
  sqrt(sq(max(q.x,0))+sq(max(q.y,0))+sq(max(q.z,0)))

}

Josh


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.