POV-Ray : Newsgroups : povray.general : rounded_objects: a new feature? Server Time
3 May 2024 07:49:32 EDT (-0400)
  rounded_objects: a new feature? (Message 15 to 24 of 24)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Bald Eagle
Subject: Re: rounded_objects: a new feature?
Date: 19 Sep 2016 12:40:01
Message: <web.57e013ea696ad3b488d9aa0@news.povray.org>
These are very good  :)

I was unsure this would get any farther than speculation, but these scenes are a
very nice prototypical realization of your ideas.


I have to ask:

Could you explain some of the notation that you have in your select() directive?

For example: 2*(q<0)-1   ....   I had no idea one could do this type of thing
:O

Hardly a day goes by that I learn something new here!


Post a reply to this message

From: John Greenwood
Subject: Re: rounded_objects: a new feature?
Date: 20 Sep 2016 04:15:00
Message: <web.57e0ee71696ad3a7cafab50@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> These are very good  :)

Thanks

> I was unsure this would get any farther than speculation, but these scenes are a
very nice prototypical realization o
f your ideas.
>
>
> I have to ask:
>
> Could you explain some of the notation that you have in your select() directive?
>
> For example: 2*(q<0)-1   ....   I had no idea one could do this type of thing
> :O
>
> Hardly a day goes by that I learn something new here!

select((F>q)-(F<-q),2*(q<0)-1,p*pow(F/q,5)-(2*p+.5)*pow(F/q,3)+(1.5+p)*F/q,1-2*(q<0))+n

In words this select directive says:

If F is more than q return a value of 1 but with the same sign as q
If F is less than -q return a value of 1 but with the opposite sign to q
In between return a value according to the polynomial which has turning points
at +/- q

The parameter p (profile) controls the contribution of the 5th power term in the
polynomial and changes the coefficients of the the two terms so as make the
turning points stay in the same position.

I am farly sure that, if a sine curve were to be used, the corner would be a
true circle. With a cubic, ie p = 0, it is within 2% of a circle.


Post a reply to this message

From: John Greenwood
Subject: Re: rounded_objects: a new feature?
Date: 20 Sep 2016 05:10:01
Message: <web.57e0fbb0696ad3a7cafab50@news.povray.org>
scott <sco### [at] scottcom> wrote:
> >>> If you're on to something then some working
> >>> example code will go *far* further than just a text description.
> >>
> >> Totally agree, I am working on it.
> >
> > And here it is:
>
> A good start!
>
> How would you go about doing the union (or difference) of two rounded
> cubes? I tried to modify the code to do this but couldn't get it to
> work. If that works nicely then I think you're on to something...
>
> BTW you could always use a macro for each element, that depending on
> some global switch, either used the standard POV non-rounded primitive
> (for speed of setting up the scene) or the isosurface variant (for final
> render).

Excellent idea.

And here are unions:

// This work is licensed under the Creative Commons Attribution 3.0 Unported
License.
// To view a copy of this license, visit
http://creativecommons.org/licenses/by/3.0/
// or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain
View,
// California, 94041, USA.

// Demonstration of nion for rounded objects

// Vers: 1.00
// Date: 20 Sept 2016
// Auth: John Greenwood

#version 3.7 ;

#include "colors.inc"

camera {location <10,7,30> angle 12 look_at <0,0,0> }

  background { color rgb<0.2, 0.4, 0.8>  }
  light_source {<10,5,10> color White}
  global_settings {assumed_gamma 1.0 }


  #declare R_function = function( F,q,p,n){

select((F>q)-(F<-q),2*(q<0)-1,p*pow(F/q,5)-(2*p+.5)*pow(F/q,3)+(1.5+p)*F/q,1-2*(q<0))+n

                                        }

  #declare Vo =1;
    #declare R_limit = function(V){select((V+1>Vo)-(V+1<-Vo),
-1,-.5*pow((V+1)/Vo,3)+1.5*(V+1)/Vo,+1)-1}


  #declare Corner_Profile = -0;   // -.5 gives rounded bevel, 0 almost round,
+.5 Not noticebly sharper
  #declare Corner_round = .3;

  isosurface {
     function    {

               R_function(-sqrt(pow(x-1,2)+pow(y,2)+pow(z,2))+1,-1,0,-1)

  +R_limit(
                 R_function(x+1.5,-Corner_round,Corner_Profile,1)
              +R_function(x-.5,+Corner_round,Corner_Profile,1)
              +R_function(y-.5, Corner_round,Corner_Profile,1)
              +R_function(y+1.5,-Corner_round,Corner_Profile,1)
              +R_function(z-1.5,+Corner_round,Corner_Profile,1)
              +R_function(z+.5,-Corner_round,Corner_Profile,1)-2 )


             +1
                 }
     threshold 0
      max_gradient 20
     contained_by { box { -2, 2 } }
  texture {pigment {color rgb < 1, 0.9, 0.65>}}
      translate < 0,1.4,0>
               }


  isosurface {
     function    {

         R_limit( R_function(-sqrt(pow(y-.5,2)+pow(z,2))+.5,-.3,0,-1)
                 +R_function(x+.5 ,-.3,0,1)
                 +R_function(x-1.5,+.3,0,1))

       +R_limit( R_function(-sqrt(pow(y+.5,2)+pow(z,2))+.5,-.3,0,-1)
                +R_function(x+1.5,-.3,0,1)
                +R_function(x-.5,+.3,0,1))
                +1
                 }
     threshold 0
      max_gradient 20
     contained_by { box { -2, 2 } }
  texture {pigment {color rgb < 1, 0.9, 0.65>}}
      translate < 0,-1.5,0>

               }


Post a reply to this message

From: John Greenwood
Subject: Re: rounded_objects: a new feature?
Date: 20 Sep 2016 06:25:01
Message: <web.57e10dd0696ad3a7cafab50@news.povray.org>
scott <sco### [at] scottcom> wrote:
> >>> If you're on to something then some working
> >>> example code will go *far* further than just a text description.
> >>
> >> Totally agree, I am working on it.
> >
> > And here it is:
>
> A good start!
>
> How would you go about doing the union (or difference) of two rounded
> cubes? I tried to modify the code to do this but couldn't get it to
> work. If that works nicely then I think you're on to something...

Like this:

// This work is licensed under the Creative Commons Attribution 3.0 Unported
License.
// To view a copy of this license, visit
http://creativecommons.org/licenses/by/3.0/
// or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain
View,
// California, 94041, USA.

// Demonstration of subtraction for rounded objects

// Vers: 1.00
// Date: 20 Sept 2016
// Auth: John Greenwood

#version 3.7 ;

#include "colors.inc"

camera {location <10,7,30> angle 15 look_at <0,0,0> }

  background { color rgb<0.2, 0.4, 0.8>  }
  light_source {<10,5,10> color White}
  global_settings {assumed_gamma 1.0 }


  #declare R_function = function( F,q,p,n){

select((F>q)-(F<-q),2*(q<0)-1,p*pow(F/q,5)-(2*p+.5)*pow(F/q,3)+(1.5+p)*F/q,1-2*(q<0))+n

                                        }

  #declare Vo =1;
    #declare R_limit = function(V){select((V+1>Vo)-(V+1<-Vo),
-1,-.5*pow((V+1)/Vo,3)+1.5*(V+1)/Vo,+1)-1}


  #declare Corner_Profile = -0;   // -.5 gives rounded bevel, 0 almost round,
+.5 Not noticebly sharper
  #declare Corner_round = .3;

  isosurface {
     function    {

            +   R_function(-sqrt(pow(x-1,2)+pow(y,2)+pow(z,2))+1.5,-.3,0,-1)

  +R_limit(
                 R_function(x-1,+Corner_round,Corner_Profile,1)
              +R_function(x+1,-Corner_round,Corner_Profile,1)
              +R_function(y-1, Corner_round,Corner_Profile,1)
              +R_function(y+1,-Corner_round,Corner_Profile,1)
              +R_function(z-1,+Corner_round,Corner_Profile,1)
              +R_function(z+1,-Corner_round,Corner_Profile,1)-2 )


             +3      //Increasing this by two gives the intersection
                 }
     threshold 0
      max_gradient 20
     contained_by { box { -2, 2 } }
  texture {pigment {color rgb < 1, 0.9, 0.65>}}
      translate < -2.5,1.5,0>
               }


  isosurface {
     function    {

            +
R_function(-sqrt(pow(x+.8,2)+pow(y+.5,2)+pow(z+1,2))+1.5,-.3,0,-1)

  -R_limit(
                 R_function(x-1.5,+Corner_round,Corner_Profile,1)
              +R_function(x+1,-Corner_round,Corner_Profile,1)
              +R_function(y-1.5, Corner_round,Corner_Profile,1)
              +R_function(y+1,-Corner_round,Corner_Profile,1)
              +R_function(z-1.5,+Corner_round,Corner_Profile,1)
              +R_function(z+1,-Corner_round,Corner_Profile,1)-2 )


             +1
                 }
     threshold 0
      max_gradient 20
     contained_by { box { -2, 2 } }
  texture {pigment {color rgb < 1, 0.9, 0.65>}}
      translate < 2.5,-1.5,0>
               }


  isosurface {
     function    {

            -   R_function(-sqrt(pow(x-1,2)+pow(y-.5,2)+pow(z-1,2))+1,-.3,0,-1)

  +R_limit(
                 R_function(x+1.5,-Corner_round,Corner_Profile,1)
              +R_function(x-1,+Corner_round,Corner_Profile,1)
              +R_function(y-1.5, Corner_round,Corner_Profile,1)
              +R_function(y+1,-Corner_round,Corner_Profile,1)
              +R_function(z-1.5,+Corner_round,Corner_Profile,1)
              +R_function(z+1,-Corner_round,Corner_Profile,1)-2 )


             +1
                 }
     threshold 0
      max_gradient 20
     contained_by { box { -2, 2 } }
  texture {pigment {color rgb < 1, 0.9, 0.65>}}
      translate < 2.5,1.3,0>
               }


  isosurface {
     function    {

        - R_limit(
                 R_function(-sqrt(pow(x-.5,2)+pow(z,2))+1,-.3,0,-1)
                +R_function(y-1 ,+.3,0,1)
                +R_function(y+1,-.3,0,1))

       +R_limit( R_function(-sqrt(pow(x+.5,2)+pow(z,2))+1,-.3,0,-1)
                +R_function(y-1.5,+.3,0,1)
                +R_function(y+1.5,-.3,0,1))
                +1
                 }
     threshold 0
      max_gradient 20
     contained_by { box { -2, 2 } }
  texture {pigment {color rgb < 1, 0.9, 0.65>}}
      translate < -2.5,-1.5,0>

               }


Post a reply to this message

From: scott
Subject: Re: rounded_objects: a new feature?
Date: 20 Sep 2016 06:27:17
Message: <57e10f05$1@news.povray.org>
On 20/09/2016 10:04, John Greenwood wrote:
> scott <sco### [at] scottcom> wrote:
>>>>> If you're on to something then some working
>>>>> example code will go *far* further than just a text description.
>>>>
>>>> Totally agree, I am working on it.
>>>
>>> And here it is:
>>
>> A good start!
>>
>> How would you go about doing the union (or difference) of two rounded
>> cubes? I tried to modify the code to do this but couldn't get it to
>> work. If that works nicely then I think you're on to something...
>>
>> BTW you could always use a macro for each element, that depending on
>> some global switch, either used the standard POV non-rounded primitive
>> (for speed of setting up the scene) or the isosurface variant (for final
>> render).
>
> Excellent idea.
>
> And here are unions:

Looks good.

Just one small thing though, it looks like something odd is going on 
with the top (+y) face of the cube and also the join with that face and 
the sphere (maybe related). There is a "ridge" of some kind along the 
join, and the entire top face of the cube bends upwards way before the 
round should start (see attached).


Post a reply to this message


Attachments:
Download 'union.png' (37 KB)

Preview of image 'union.png'
union.png


 

From: John Greenwood
Subject: Re: rounded_objects: a new feature?
Date: 20 Sep 2016 08:15:01
Message: <web.57e12820696ad3a7cafab50@news.povray.org>
scott <sco### [at] scottcom> wrote:
> On 20/09/2016 10:04, John Greenwood wrote:
> > scott <sco### [at] scottcom> wrote:

> >> How would you go about doing the union (or difference) of two rounded
> >> cubes? I tried to modify the code to do this but couldn't get it to
> >> work. If that works nicely then I think you're on to something...

> >
> > And here are unions:
>
> Looks good.
>
> Just one small thing though, it looks like something odd is going on
> with the top (+y) face of the cube and also the join with that face and
> the sphere (maybe related). There is a "ridge" of some kind along the
> join, and the entire top face of the cube bends upwards way before the
> round should start (see attached).

The radius of the round at the junction between the two objects is a function of
the radii of the two contributing faces and will be sharper. I think what you
are seeing is just a very sharp corner. The rising of the top face of the cube
is due to the field from the sphere.

There are going to be limitations!

I am looking at a way to specify a larger radius at the intersection of the two
objects.


Post a reply to this message

From: scott
Subject: Re: rounded_objects: a new feature?
Date: 20 Sep 2016 11:03:30
Message: <57e14fc2$1@news.povray.org>
>> Just one small thing though, it looks like something odd is going on
>> with the top (+y) face of the cube and also the join with that face and
>> the sphere (maybe related). There is a "ridge" of some kind along the
>> join, and the entire top face of the cube bends upwards way before the
>> round should start (see attached).
>
> The radius of the round at the junction between the two objects is a function of
> the radii of the two contributing faces and will be sharper. I think what you
> are seeing is just a very sharp corner.

Starting from the sphere, there seems to be a very sharp corner, 
followed by some kind of plateau, followed by a large radius that forms 
the top face of the cube.

You can exaggerate it by changing to a bevel (-0.5) and increasing the 
round size to 0.5 (attached is a section view) - maybe this helps to 
debug it?


Post a reply to this message


Attachments:
Download 'union exaggerated.png' (15 KB)

Preview of image 'union exaggerated.png'
union exaggerated.png


 

From: John Greenwood
Subject: Re: rounded_objects: a new feature?
Date: 21 Sep 2016 03:55:01
Message: <web.57e23cbd696ad3a7cafab50@news.povray.org>
scott <sco### [at] scottcom> wrote:
> >> Just one small thing though, it looks like something odd is going on
> >> with the top (+y) face of the cube and also the join with that face and
> >> the sphere (maybe related). There is a "ridge" of some kind along the
> >> join, and the entire top face of the cube bends upwards way before the
> >> round should start (see attached).
> >
> > The radius of the round at the junction between the two objects is a function of
> > the radii of the two contributing faces and will be sharper. I think what you
> > are seeing is just a very sharp corner.
>
> Starting from the sphere, there seems to be a very sharp corner,
> followed by some kind of plateau, followed by a large radius that forms
> the top face of the cube.
>
> You can exaggerate it by changing to a bevel (-0.5) and increasing the
> round size to 0.5 (attached is a section view) - maybe this helps to
> debug it?

Thanks for pointing this out. I am currently trying to work out what actually
happens at the line of union, and indeed what is wanted. This is probably an
example of something we don't want.


Post a reply to this message

From: John Greenwood
Subject: Re: rounded_objects: a new feature?
Date: 27 Sep 2016 14:25:00
Message: <web.57eab82f696ad36a8469130@news.povray.org>
"John Greenwood" <joh### [at] john-greenwoodcouk> wrote:
> scott <sco### [at] scottcom> wrote:
> > >> Just one small thing though, it looks like something odd is going on
> > >> with the top (+y) face of the cube and also the join with that face and
> > >> the sphere (maybe related). There is a "ridge" of some kind along the
> > >> join, and the entire top face of the cube bends upwards way before the
> > >> round should start (see attached).
> > >
> > > The radius of the round at the junction between the two objects is a function of
> > > the radii of the two contributing faces and will be sharper. I think what you
> > > are seeing is just a very sharp corner.
> >
> > Starting from the sphere, there seems to be a very sharp corner,
> > followed by some kind of plateau, followed by a large radius that forms
> > the top face of the cube.
> >
> > You can exaggerate it by changing to a bevel (-0.5) and increasing the
> > round size to 0.5 (attached is a section view) - maybe this helps to
> > debug it?
>
> Thanks for pointing this out. I am currently trying to work out what actually
> happens at the line of union, and indeed what is wanted. This is probably an
> example of something we don't want.

Thinking about it, this is a result of way it works. The corner prifile is
created by the addition of the component fields and if one of these has a sharp
change, this will come through.

I am working on a way to have a union of two R_objects with a rounding of its
own that swamps that of the components. It is a bit more complicated than what I
have done so far.

I also think we could have hypobolic corners, ie, would be assymptopic to two
intersecting plane surfaces.


Post a reply to this message

From: John Greenwood
Subject: Re: rounded_objects: a new feature?
Date: 3 Oct 2016 07:10:00
Message: <web.57f23b7a696ad3a7cafab50@news.povray.org>
"John Greenwood" <joh### [at] john-greenwoodcouk> wrote:

> I am working on a way to have a union of two R_objects with a rounding of its
> own that swamps that of the components. It is a bit more complicated than what I
> have done so far.

I am struggling with this, I may ask for help in a new topic.

> I also think we could have hypobolic corners, ie, would be assymptopic to two
> intersecting plane surfaces.

This however works. I have tidied up the workings a bit and added two new types
of corner profile, a flat bevel and the hyperbolic corner.

In this example the corner profile parameter takes a value from -1 to +1. The
whole number values are special cases, +1 gives a hyperbolic corner and -1 gives
a flat bevel with sharp corners. In between putting this parameter just more
than -1 gives a rounded bevel and increasing to just less than 1 makes it
increasingly rounded, with nearly circular at a value of .6


// This work is licensed under the Creative Commons Attribution 3.0 Unported
License.
// To view a copy of this license, visit
http://creativecommons.org/licenses/by/3.0/
// or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain
View,
// California, 94041, USA.

// Demonstration of R_objects elements for rounded objects

// Vers: 1.00
// Date: 03 Oct 2016
// Auth: John Greenwood

#version 3.7 ;

#include "colors.inc"

camera {location <4,10,30> angle 10 look_at <0,0,0> }

  background { color rgb<0.2, 0.4, 0.8>  }
  light_source {<10,5,10> color White}
  global_settings {assumed_gamma 1.0 }


  #declare R_function = function( F,p){
    select((p+.999) , select((F>1)-(F<-1) , -1 , F , 1)+1
                 , select(p-1 , select((F>1)-(F<-1) , -1 ,
..5*p*pow(F,5)-(p+.5)*pow(F,3)+(1.5+.5*p)*F , 1)+1
                               ,F/(sqrt(.25+pow(F,2))) +1
           ) )
                                        }

  #declare Corner_Profile1 = +1;   // = p in the above equations
  #declare Corner_Profile2 = -1;   // = p in the above equations

//  p = -1 sharp bevel and p = +1 gives hyperbolic corner. Between these, as p
increases, the corner goes from a nearly flat getting increasingly rounded with
nearly circular at p = +.6

  #declare Corner_round1 = .5;
  #declare Corner_round2 = .5;

  isosurface {
     function {
              -R_function((x+1.5)/Corner_round1,Corner_Profile1)
              +R_function((x-1.5)/Corner_round2,Corner_Profile2)
              +R_function((y-1.5)/Corner_round2,Corner_Profile2)
              -R_function((y+1.5)/Corner_round1,Corner_Profile1)
              +R_function((z-1.5)/Corner_round2,Corner_Profile2)
              -R_function((z+1.5)/Corner_round1,Corner_Profile1)
            +5
              }

     threshold 0
      max_gradient 20
     contained_by { box { -2.2, 2.2 } }
  texture {pigment {color rgb < 1, 0.9, 0.65>}}

               }


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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