POV-Ray : Newsgroups : povray.binaries.images : Friday Afternoon Doodle Server Time
28 Mar 2024 15:53:43 EDT (-0400)
  Friday Afternoon Doodle (Message 1 to 10 of 13)  
Goto Latest 10 Messages Next 3 Messages >>>
From: Chris R
Subject: Friday Afternoon Doodle
Date: 4 Mar 2022 16:30:00
Message: <web.622284a270cc26e789a9c4065cc1b6e@news.povray.org>
I tend to use isosurfaces a lot in my scenes, mainly because I like the ability
to perturb them with textures to give more realism than normals in the texture
can provide.

One of the things I've noticed is how fast and clean isosurfaces based on built
in functions, like f_rounded_box are, and how bad any of my attempts at doing
extruded shapes end up being, so I thought about using an isosurface to extrude
f_rounded_box.

So I've been playing around with shapes extruded along one of the axes, by
changing the rounding parameter and the scaling parameters on the other two
axes, as well as translating the center of the rounded box along those two other
axes in various ways, including linear interpolation, spline interpolation, and
various other functions.

This is the one where the scale decreases linearly from bottom to top, the
rounding factor decreases linearly from bottom to top, and the x and z centers
of the box are translated using sin(y*2*pi/height) and cos(y*2*pi/height).

It rendered, very quickly, with no holes or artifacts!

I'm sure others have discovered this long ago, but I will certainly be taking
more advantage of this, rather than painful unions whenever possible.

-- Chris R


Post a reply to this message


Attachments:
Download 'roundbox.png' (802 KB)

Preview of image 'roundbox.png'
roundbox.png


 

From: jr
Subject: Re: Friday Afternoon Doodle
Date: 5 Mar 2022 02:55:00
Message: <web.6223163715dda32bed36e5cb6cde94f1@news.povray.org>
hi,

"Chris R" <car### [at] comcastnet> wrote:

lovely shape, a bit like a melting metronome.

> ...
> So I've been playing around ...
> I'm sure others have discovered this long ago, but I will certainly be taking
> more advantage of this, rather than painful unions whenever possible.

well, personally, I have no maths and wouldn't know an isosurface if it bit me
:-).  thinking therefore it would be cool if you could make stuff available in
the form of one or more macros.


regards, jr.


Post a reply to this message

From: William F Pokorny
Subject: Re: Friday Afternoon Doodle
Date: 5 Mar 2022 04:55:16
Message: <62233384$1@news.povray.org>
On 3/4/22 16:29, Chris R wrote:
> One of the things I've noticed is how fast and clean isosurfaces based on built
> in functions, like f_rounded_box are, and how bad any of my attempts at doing
> extruded shapes end up being, so I thought about using an isosurface to extrude
> f_rounded_box.

Cool shape! :-)

Yep, isosufaces are sometimes more flexible and faster than other 
shape/surface options! However, as with most things in POV-Ray, where 
they work best depends greatly on particulars.

Note. IIRC, the f_rounded_box() function has a changing gradient outside 
everywhere and into the rounded box only to the rounding radius - after 
which the returned values become fixed 'inside.' This makes the function 
difficult / impossible to use in many more complex situations. In other 
words. it's a function which can be difficult to use other than as a 
stand alone shape(1).

Bill P.

(1) - Why the povr fork added an explicit f_box() inbuilt.


Post a reply to this message

From: Kenneth
Subject: Re: Friday Afternoon Doodle
Date: 7 Mar 2022 06:00:00
Message: <web.6225e45c15dda32b4cef624e6e066e29@news.povray.org>
"Chris R" <car### [at] comcastnet> wrote:
>
> So I've been playing around with shapes extruded along one of the axes, by
> changing the rounding parameter and the scaling parameters on the other two
> axes, as well as translating the center of the rounded box along those two other
> axes in various ways, including linear interpolation, spline interpolation, and
> various other functions.
>
> This is the one where the scale decreases linearly from bottom to top, the
> rounding factor decreases linearly from bottom to top, and the x and z centers
> of the box are translated using sin(y*2*pi/height) and cos(y*2*pi/height).
>

That's a nice result, and a clever use of functions. And gold colors! I assume
that this is just one function-object, not a 'combination' of several function
shapes?

I experimented with function-based isosurfaces years ago, but have forgotten
some of the finer points, like how to 'taper' an object (like you did in y.) But
I happened to be playing around with this same kind of technique this week! I
can make a nice sine-wave shape, but what is the trick for getting the shape to
taper or scale so nicely? IIRC, it is something relatively simple-- but I
can't remember what :-(


Post a reply to this message

From: Bald Eagle
Subject: Re: Friday Afternoon Doodle
Date: 7 Mar 2022 06:50:00
Message: <web.6225f0e015dda32b1f9dae3025979125@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:

> I experimented with function-based isosurfaces years ago, but have forgotten
> some of the finer points, like how to 'taper' an object (like you did in y.) But
> I happened to be playing around with this same kind of technique this week! I
> can make a nice sine-wave shape, but what is the trick for getting the shape to
> taper or scale so nicely? IIRC, it is something relatively simple-- but I
> can't remember what :-(

IIRC, I emailed you a copy of Mike Williams' isosurface tutorial, which is no
longer on the internet.   :(  Not sure if I can post .odt or .pdf files to this
server anywhere...

I think what you're looking for is under "variable substitution" or something
similar.

We should have a section of the website for archiving these master reference
works - like Friedrich Lohmueller's site.


Post a reply to this message

From: Chris R
Subject: Re: Friday Afternoon Doodle
Date: 7 Mar 2022 09:45:00
Message: <web.62261a6115dda32bd6fc33af5cc1b6e@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:
> On 3/4/22 16:29, Chris R wrote:
> > One of the things I've noticed is how fast and clean isosurfaces based on built
> > in functions, like f_rounded_box are, and how bad any of my attempts at doing
> > extruded shapes end up being, so I thought about using an isosurface to extrude
> > f_rounded_box.
>
> Cool shape! :-)
>
> Yep, isosufaces are sometimes more flexible and faster than other
> shape/surface options! However, as with most things in POV-Ray, where
> they work best depends greatly on particulars.
>
> Note. IIRC, the f_rounded_box() function has a changing gradient outside
> everywhere and into the rounded box only to the rounding radius - after
> which the returned values become fixed 'inside.' This makes the function
> difficult / impossible to use in many more complex situations. In other
> words. it's a function which can be difficult to use other than as a
> stand alone shape(1).
>
> Bill P.
>
> (1) - Why the povr fork added an explicit f_box() inbuilt.

Yes, I have noticed that, especially when attempting to add a wood pigment
function to the exterior with the grain pushing into the box with a very small
rounding radius.  It seems fine for a grain extending out of the box.

-- Chris R.


Post a reply to this message

From: Chris R
Subject: Re: Friday Afternoon Doodle
Date: 7 Mar 2022 10:05:00
Message: <web.62261e5e15dda32bd6fc33af5cc1b6e@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
> "Chris R" <car### [at] comcastnet> wrote:
> >
> > So I've been playing around with shapes extruded along one of the axes, by
> > changing the rounding parameter and the scaling parameters on the other two
> > axes, as well as translating the center of the rounded box along those two other
> > axes in various ways, including linear interpolation, spline interpolation, and
> > various other functions.
> >
> > This is the one where the scale decreases linearly from bottom to top, the
> > rounding factor decreases linearly from bottom to top, and the x and z centers
> > of the box are translated using sin(y*2*pi/height) and cos(y*2*pi/height).
> >
>
> That's a nice result, and a clever use of functions. And gold colors! I assume
> that this is just one function-object, not a 'combination' of several function
> shapes?
>
> I experimented with function-based isosurfaces years ago, but have forgotten
> some of the finer points, like how to 'taper' an object (like you did in y.) But
> I happened to be playing around with this same kind of technique this week! I
> can make a nice sine-wave shape, but what is the trick for getting the shape to
> taper or scale so nicely? IIRC, it is something relatively simple-- but I
> can't remember what :-(

Here's a pretty simple example with linear tapering.  I did something similar
with the image above, but embedded the tapering in functions instead.

#macro TaperedBox(SizeBase,SizeTop,RoundingBase,RoundingTop,Height)
   #local _xSlope = (SizeTop.x - SizeBase.x)/(2*Height);
   #local _zSlope = (SizeTop.z - SizeBase.z)/(2*Height);
   #local _rndSlope = (RoundingTop - RoundingBase)/Height;
   #local _xScaleBase = SizeBase.x/2;
   #local _zScaleBase = SizeBase.z/2;
   #local _xScaleFn = function(l) {
      _xScaleBase + _xSlope*l
   }
   #local _zScaleFn = function(l) {
      _yScaleBase + _ySlope*l
   }
   #local _rndFn = function(l) {
      RoundingBase + _rndSlope*l
   }
   #local _sy = Height/2;
   #local _shapeFn = function(x,y,z) {
      f_rounded_box(x, y, z, _rndFn(y+_sy), _xScaleFn(y+_sy), _sy,
_zScaleFn(y+_sy))
   }

   #local _maxx = max(SizeBase.x,SizeTop.x)/2;
   #local _maxz = max(SizeBase.z,SizeTop.z)/2;
   #local _lbounds = -<_maxx, _sy, _maxz>;
   #local _ubounds = <_maxx, _sy, _maxz>;

   #local _shape = isosurface {
      function {
         _shapeFn(x,y,z)
      }
      threshold 0
      contained_by { box { _lbounds, _ubounds } }
   }

   #undef _shapeFn
   #undef _rndFn
   #undef _zScaleFn
   #undef _xScaleFn

   _shape

#end

TaperedBox(<2,2>, <1,1>, 0.2, 0.1, 2)

I have purposefully, pedantically, broken things out, because it helps me
remember why I wrote the code when I go back to it months down the line.

This should give you a truncated pyramid with a rounded bottom, rounded edges,
with the rounding decreasing as you move up the pyramid.

I use the RC3 Metal macros to create the gold texture.


-- Chris R.


Post a reply to this message

From: Chris R
Subject: Re: Friday Afternoon Doodle
Date: 7 Mar 2022 14:00:00
Message: <web.6226560215dda32bd6fc33af5cc1b6e@news.povray.org>
"Chris R" <car### [at] comcastnet> wrote:
> "Kenneth" <kdw### [at] gmailcom> wrote:
> > "Chris R" <car### [at] comcastnet> wrote:
> > >
> > > So I've been playing around with shapes extruded along one of the axes, by
> > > changing the rounding parameter and the scaling parameters on the other two
> > > axes, as well as translating the center of the rounded box along those two other
> > > axes in various ways, including linear interpolation, spline interpolation, and
> > > various other functions.
> > >
> > > This is the one where the scale decreases linearly from bottom to top, the
> > > rounding factor decreases linearly from bottom to top, and the x and z centers
> > > of the box are translated using sin(y*2*pi/height) and cos(y*2*pi/height).
> > >
> >
> > That's a nice result, and a clever use of functions. And gold colors! I assume
> > that this is just one function-object, not a 'combination' of several function
> > shapes?
> >
> > I experimented with function-based isosurfaces years ago, but have forgotten
> > some of the finer points, like how to 'taper' an object (like you did in y.) But
> > I happened to be playing around with this same kind of technique this week! I
> > can make a nice sine-wave shape, but what is the trick for getting the shape to
> > taper or scale so nicely? IIRC, it is something relatively simple-- but I
> > can't remember what :-(
>
> Here's a pretty simple example with linear tapering.  I did something similar
> with the image above, but embedded the tapering in functions instead.
>
> #macro TaperedBox(SizeBase,SizeTop,RoundingBase,RoundingTop,Height)
>    #local _xSlope = (SizeTop.x - SizeBase.x)/(2*Height);
>    #local _zSlope = (SizeTop.z - SizeBase.z)/(2*Height);
>    #local _rndSlope = (RoundingTop - RoundingBase)/Height;
>    #local _xScaleBase = SizeBase.x/2;
>    #local _zScaleBase = SizeBase.z/2;
>    #local _xScaleFn = function(l) {
>       _xScaleBase + _xSlope*l
>    }
>    #local _zScaleFn = function(l) {
>       _zScaleBase + _ySlope*l
>    }
>    #local _rndFn = function(l) {
>       RoundingBase + _rndSlope*l
>    }
>    #local _sy = Height/2;
>    #local _shapeFn = function(x,y,z) {
>       f_rounded_box(x, y, z, _rndFn(y+_sy), _xScaleFn(y+_sy), _sy,
> _zScaleFn(y+_sy))
>    }
>
>    #local _maxx = max(SizeBase.x,SizeTop.x)/2;
>    #local _maxz = max(SizeBase.z,SizeTop.z)/2;
>    #local _lbounds = -<_maxx, _sy, _maxz>;
>    #local _ubounds = <_maxx, _sy, _maxz>;
>
>    #local _shape = isosurface {
>       function {
>          _shapeFn(x,y,z)
>       }
>       threshold 0
>       contained_by { box { _lbounds, _ubounds } }
>    }
>
>    #undef _shapeFn
>    #undef _rndFn
>    #undef _zScaleFn
>    #undef _xScaleFn
>
>    _shape
>
> #end
>
> TaperedBox(<2,2>, <1,1>, 0.2, 0.1, 2)
>
> I have purposefully, pedantically, broken things out, because it helps me
> remember why I wrote the code when I go back to it months down the line.
>
> This should give you a truncated pyramid with a rounded bottom, rounded edges,
> with the rounding decreasing as you move up the pyramid.
>
> I use the RC3 Metal macros to create the gold texture.
>
>
> -- Chris R.

Sorry, transcription error, yScaleBase should have been zScaleBase in _zScaleFn

-- Chris R.


Post a reply to this message

From: Kenneth
Subject: Re: Friday Afternoon Doodle
Date: 7 Mar 2022 18:50:00
Message: <web.6226991515dda32b4cef624e6e066e29@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "Kenneth" <kdw### [at] gmailcom> wrote:
>
> ...what is the trick for getting the shape to
> > taper or scale so nicely? IIRC, it is something relatively simple-- but I
> > can't remember what :-(
>
> IIRC, I emailed you a copy of Mike Williams' isosurface tutorial, which is no
> longer on the internet.   :(  Not sure if I can post .odt or .pdf files to this
> server anywhere...
>
> I think what you're looking for is under "variable substitution" or something
> similar.
>

Yes, I remember reading part of that last year! So I re-read our email
exchanges... but there's no attachment there(!) :-(  Damn. I've been looking all
over my Win10 computer today for that tutorial, but can't find it. I'm thinking
that *maybe* you posted it to a newsgroup thread instead(?), sometime prior to
April 2021. But I haven't had any luck searching the newsgroups either. Bummer!
I know I have it *somewhere*...


Post a reply to this message

From: Bald Eagle
Subject: Re: Friday Afternoon Doodle
Date: 7 Mar 2022 19:25:00
Message: <web.6226a1d015dda32b1f9dae3025979125@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:

> Yes, I remember reading part of that last year! So I re-read our email
> exchanges... but there's no attachment there(!) :-(  Damn. I've been looking all
> over my Win10 computer today for that tutorial, but can't find it. I'm thinking
> that *maybe* you posted it to a newsgroup thread instead(?), sometime prior to
> April 2021. But I haven't had any luck searching the newsgroups either. Bummer!
> I know I have it *somewhere*...

Backup email and attachments incoming...


Post a reply to this message

Goto Latest 10 Messages Next 3 Messages >>>

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