POV-Ray : Newsgroups : povray.general : How to make a smooth lathe object Server Time
25 Nov 2024 12:25:30 EST (-0500)
  How to make a smooth lathe object (Message 1 to 5 of 5)  
From: xslittlegrass
Subject: How to make a smooth lathe object
Date: 28 May 2014 22:05:00
Message: <web.5386950d197e87511e36f4d20@news.povray.org>
I'm trying to make a lathe object from some data points. My data points look
quite smooth, but the generated lathe object looks not smooth, it looks kind of
like be constructed from flat rings. Do you know why the lathe object is not
smooth and how to solve this problem? I tried different kind of spline but that
doesn't help.
Any suggestions and comments are appreciated.

This is how the data points look like

http://imgur.com/Vkkk5Rq

and this is how the lathe object looks like

http://imgur.com/2UxKgwD

This is the code I used:

#include "colors.inc"

global_settings {
  max_trace_level 5
  assumed_gamma 1.0
  radiosity {
    pretrace_start 0.08
    pretrace_end   0.01
    count 35
    nearest_count 5
    error_bound 1.8
    recursion_limit 2
    low_error_factor .5
    gray_threshold 0.0
    minimum_reuse 0.015
    brightness 1
    adc_bailout 0.01/2
  }
}

#default {
  texture {
    pigment {rgb 1}
    finish {
      ambient 0.0
      diffuse 0.6
      specular 0.6 roughness 0.001
      reflection { 0.0 1.0 fresnel on }
      conserve_energy
    }
  }
}


/*ViewPoint*/
camera {
 location <13., 13., 13.>
 direction <-26., 36., -58.>
 up <0, 0, 28.284271247461902>
 right <37.61808075912433, 0, 0>
 sky <0.2, -1., 0.2>
 look_at <0., 0., 0.>
}

light_source { <250,350,450> 1 }
background { rgb <0,.25,.5> }






lathe{
cubic_spline
73,
<0.0000000,-2.3501925>,
<0.1685586,-2.3471675>,
<0.3384681,-2.3352277>,
<0.5025126,-2.3193158>,
<0.6623041,-2.2934823>,
<0.8291457,-2.2657324>,
<0.9705252,-2.2298038>,
<1.1306533,-2.1905154>,
<1.2814070,-2.1449947>,
<1.4321608,-2.0958930>,
<1.5829146,-2.0454749>,
<1.7336683,-1.9837390>,
<1.8764567,-1.9254786>,
<2.0351759,-1.8630373>,
<2.1615910,-1.8074713>,
<2.3252519,-1.7359309>,
<2.4874372,-1.6679285>,
<2.6288118,-1.6080402>,
<2.7852697,-1.5504389>,
<2.9396985,-1.4933077>,
<3.0978375,-1.4572864>,
<3.2591998,-1.4212990>,
<3.4170854,-1.4017828>,
<3.5916831,-1.4044717>,
<3.7437186,-1.4251713>,
<3.8944724,-1.4653893>,
<4.0539017,-1.5248889>,
<4.1959799,-1.6137235>,
<4.3409756,-1.7200588>,
<4.4743016,-1.8592965>,
<4.6163983,-2.0234848>,
<4.7487437,-2.2505084>,
<4.8574476,-2.4961601>,
<4.9359064,-2.7412525>,
<4.9876708,-3.0150754>,
<5.0140378,-3.3387585>,
<5.0077025,-3.6683417>,
<4.9750873,-3.9702752>,
<4.9120603,-4.2696488>,
<4.8287998,-4.5319714>,
<4.7236181,-4.8090473>,
<4.5979899,-5.0723540>,
<4.4723618,-5.2896726>,
<4.3560994,-5.4773869>,
<4.2211055,-5.6564373>,
<4.0866532,-5.8291457>,
<3.9447236,-5.9817754>,
<3.8141557,-6.1207737>,
<3.6902421,-6.2376063>,
<3.5427136,-6.3657681>,
<3.4037462,-6.4824121>,
<3.2662707,-6.5830365>,
<3.1155779,-6.6935168>,
<2.9666208,-6.7875129>,
<2.8140704,-6.8794731>,
<2.6757471,-6.9595345>,
<2.5230114,-7.0351759>,
<2.3755442,-7.1082081>,
<2.2293408,-7.1722494>,
<2.0831286,-7.2315838>,
<1.9369164,-7.2909182>,
<1.7839196,-7.3408775>,
<1.6337754,-7.3881538>,
<1.4813898,-7.4351413>,
<1.3236470,-7.4714147>,
<1.1714835,-7.5062791>,
<1.0060412,-7.5397206>,
<0.8525576,-7.5628141>,
<0.6909548,-7.5866095>,
<0.5350931,-7.6028495>,
<0.3654070,-7.6152361>,
<0.2010050,-7.6261323>,
<0.0307615,-7.6269192>
 sturm

 texture{
       pigment{color White}
       finish { phong 0.5}}
  }


Post a reply to this message

From: Le Forgeron
Subject: Re: How to make a smooth lathe object
Date: 29 May 2014 04:14:10
Message: <5386ec52$1@news.povray.org>
Le 29/05/2014 04:01, xslittlegrass nous fit lire :
> I'm trying to make a lathe object from some data points. My data points look
> quite smooth, but the generated lathe object looks not smooth, it looks kind of
> like be constructed from flat rings. Do you know why the lathe object is not
> smooth and how to solve this problem? I tried different kind of spline but that
> doesn't help.
> Any suggestions and comments are appreciated.
> 
> This is how the data points look like
> 
> http://imgur.com/Vkkk5Rq
> 
> and this is how the lathe object looks like
> 
> http://imgur.com/2UxKgwD
> 

Greetings,

The surface is smooth... but we have to talk a bit about smoothness.

In math, it's called continuity, and there is 5 degrees of it, from G0
to G4.

cubic spline provides G2.

Control of highlights need more than just G2. Your points, from spline,
are G2, but not globally G4 and bad luck strikes: you have multiple
jumps at G3 & G4, which you see.

Attached are the same scene with a reduction to half and quarter the
number of points. you will see there is less change of highlights. Yet,
the problem is not the number of points, but their jumps in third and
fourth derivatives.

You will need to generate them for G4 by hand (or outside povray), if
you want no highlight, as spline of lathe can only warrant G2.


-- 
IQ of crossposters with FU: 100 / (number of groups)
IQ of crossposters without FU: 100 / (1 + number of groups)
IQ of multiposters: 100 / ( (number of groups) * (number of groups))


Post a reply to this message


Attachments:
Download 'la2.pov.txt' (3 KB) Download 'la4.pov.txt' (3 KB)

From: xslittlegrass
Subject: Re: How to make a smooth lathe object
Date: 29 May 2014 12:05:01
Message: <web.53875a1b3ea07e891f10810d0@news.povray.org>
Le_Forgeron <jgr### [at] freefr> wrote:
> Le 29/05/2014 04:01, xslittlegrass nous fit lire :
> > I'm trying to make a lathe object from some data points. My data points look
> > quite smooth, but the generated lathe object looks not smooth, it looks kind of
> > like be constructed from flat rings. Do you know why the lathe object is not
> > smooth and how to solve this problem? I tried different kind of spline but that
> > doesn't help.
> > Any suggestions and comments are appreciated.
> >
> > This is how the data points look like
> >
> > http://imgur.com/Vkkk5Rq
> >
> > and this is how the lathe object looks like
> >
> > http://imgur.com/2UxKgwD
> >
>
> Greetings,
>
> The surface is smooth... but we have to talk a bit about smoothness.
>
> In math, it's called continuity, and there is 5 degrees of it, from G0
> to G4.
>
> cubic spline provides G2.
>
> Control of highlights need more than just G2. Your points, from spline,
> are G2, but not globally G4 and bad luck strikes: you have multiple
> jumps at G3 & G4, which you see.
>
> Attached are the same scene with a reduction to half and quarter the
> number of points. you will see there is less change of highlights. Yet,
> the problem is not the number of points, but their jumps in third and
> fourth derivatives.
>
> You will need to generate them for G4 by hand (or outside povray), if
> you want no highlight, as spline of lathe can only warrant G2.
>
>
> --
> IQ of crossposters with FU: 100 / (number of groups)
> IQ of crossposters without FU: 100 / (1 + number of groups)
> IQ of multiposters: 100 / ( (number of groups) * (number of groups))

Hi Le,

Thanks for your reply, that's very helpful.
But do you know how to smooth a 2d data set so that it is G4 continuity ?

Best,
xslittlegrass


Post a reply to this message

From: William F Pokorny
Subject: Re: How to make a smooth lathe object
Date: 31 May 2014 08:06:24
Message: <5389c5c0$1@news.povray.org>
On 05/29/2014 12:02 PM, xslittlegrass wrote:
> Hi Le,
>
> Thanks for your reply, that's very helpful.
> But do you know how to smooth a 2d data set so that it is G4 continuity ?
>
> Best,
> xslittlegrass
>
I've no easy answer to your question. Perhaps you could use the points 
as input to some form of catmull-rom spline, but most probably the 
result would still not be exactly the curve you want.

Maybe give inkscape (www.inkscape.org) a try. It has an option to draw 
Bezier curves/splines which can be saved to a file as POV-Ray prisms. 
Images can be imported and used as guides as you draw. The spline 
specification in each POV-Ray prism can be used directly with POV-Ray's 
lathe object. Best is that with a program like inkscape you can see your 
curve as you make adjustments.

In Inkscape, after drawing your initial Bezier curve, you can go to an 
"edit paths by points" mode, select sets of points on the curve by 
shift-picking on the points. With the points selected you can then use 
commands at the top like "Make selected nodes smooth" and "Make selected 
nodes auto-smooth" to keep particular points in line so to speak.

When working in POV-Ray's SDL I've found it easiest to use Bezier 
splines which are made up of sets of 4 vertices/points, two end points 
and two internal control points. Larger curves can be made by 
overlapping end points and smoothness at any overlapping end point is 
accomplished by matching the slopes of the nearest two control points to 
the overlapped points.

There are other interactive tools about for creating lathe and prism 
splines including one mentioned currently on the main povray.org web 
site called Epspline, though I have not used that one myself.

Bill P.


Post a reply to this message

From: xslittlegrass
Subject: Re: How to make a smooth lathe object
Date: 1 Jun 2014 14:45:00
Message: <web.538b73813ea07e891e36f4d20@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:
> On 05/29/2014 12:02 PM, xslittlegrass wrote:
> > Hi Le,
> >
> > Thanks for your reply, that's very helpful.
> > But do you know how to smooth a 2d data set so that it is G4 continuity ?
> >
> > Best,
> > xslittlegrass
> >
> I've no easy answer to your question. Perhaps you could use the points
> as input to some form of catmull-rom spline, but most probably the
> result would still not be exactly the curve you want.
>
> Maybe give inkscape (www.inkscape.org) a try. It has an option to draw
> Bezier curves/splines which can be saved to a file as POV-Ray prisms.
> Images can be imported and used as guides as you draw. The spline
> specification in each POV-Ray prism can be used directly with POV-Ray's
> lathe object. Best is that with a program like inkscape you can see your
> curve as you make adjustments.
>
> In Inkscape, after drawing your initial Bezier curve, you can go to an
> "edit paths by points" mode, select sets of points on the curve by
> shift-picking on the points. With the points selected you can then use
> commands at the top like "Make selected nodes smooth" and "Make selected
> nodes auto-smooth" to keep particular points in line so to speak.
>
> When working in POV-Ray's SDL I've found it easiest to use Bezier
> splines which are made up of sets of 4 vertices/points, two end points
> and two internal control points. Larger curves can be made by
> overlapping end points and smoothness at any overlapping end point is
> accomplished by matching the slopes of the nearest two control points to
> the overlapped points.
>
> There are other interactive tools about for creating lathe and prism
> splines including one mentioned currently on the main povray.org web
> site called Epspline, though I have not used that one myself.
>
> Bill P.

Hi Bill,

Thanks a lot for your detailed answer. I can benefit a lot from it.

Actually, I found that when I plot the revolution plot in Mathematica with the
same data, it also
give the roughness on the surface. So I posted the question on stack exchange.
Someone then give a suggestion of just using a Gaussian filter to smooth the
data before plot it.
And it works very well, here is the result:
http://imgur.com/F8l2F0z

And here is the link of the SE post:
http://mathematica.stackexchange.com/questions/48726/how-to-make-a-smooth-revolution-surface-plot


Thanks a lot for your help.

Best,
xslittlegrass


Post a reply to this message

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