POV-Ray : Newsgroups : povray.newusers : Newbie needs help with first project Server Time
5 Oct 2024 15:28:16 EDT (-0400)
  Newbie needs help with first project (Message 4 to 13 of 13)  
<<< Previous 3 Messages Goto Initial 10 Messages
From: clipka
Subject: Re: Newbie needs help with first project
Date: 8 Oct 2009 16:10:33
Message: <4ace4739@news.povray.org>
Jovian Ghost schrieb:

> For my first real project, I thought I'd start small, so I decided to do the
> Chevrolet logo. For those of you who don't know, here it is:
> http://questautosale.com/html/chevy_logo.jpg
...
> I'm first starting with the central square. Looks to me like it's a cut-off
> pyramid, so I created a prism with conic_sweep and a bezier_spline profile.
> Works well, but the problem is at the pyramid's cut-off point, the edges are
> sharp. I was wondering how I could smooth these out? I was thinking something
> like a lathe, except instead of revolving around a single axis, revolve around a
> path.

Well, "small" is not always related to actual size: Trying to model 
/anything/ with rounded-off corners is quite an ambitious project to 
start with.

I think Leroy's advice to try modelling it using cylinders for edges, 
spheres for corners, and some "fillings" for the faces, is the easiest 
to go - though I wouldn't recommend triangles, as they behave badly as 
soon as you try to do more sophisticated things with them (like 
difference or intersection CSG), and are probably not much easier to 
compute than boxes or prisms anyway.

To set up prisms for the sides, just generate them as you would for a 
flat 2D variant of the logo, then apply the Shear_Trans() macro from 
transforms.inc to effectively rotate (not shear!) and at the same time 
stretch it; e.g., if your logo is set up with +X = right, +Y = up and +Z 
= camera direction, you could create the "filling" for the right-hand 
side as:

    #include "transforms.inc"

    #declare SideSlope  = 0.5;
    #declare EdgeRadius = 0.1;

    prism {
      linear_spline
      -EdgeRadius, EdgeRadius,
      ...
      [number of points goes here, followed by desired
      X and Y coordinates; don't bother about Z yet]
      ...
      #local NewX = x+SideSlope*z;
      #local NewZ = vnormalize(vcross(NewX,y));
      translate -x*LogoRight
      Shear_Trans(NewX,y,NewZ)
      translate x*LogoRight
    }

The NewX and NewZ vectors are designed to be perpendicular to each other 
and to the Y vector, so the "shearing" transformation is really a 
combination of scaling in what once was the X axis (to compensate for 
the additional depth) followed by a rotation about the Y axis. The prism 
thickness is designed to match edge cylinders of radius "EdgeRadius", 
and the NewZ vector is designed to preserve that thickness; "SideSlope" 
determines how much "depth" the logo will have; in this case, the sides 
will be comparatively "flat" (with an angle of about 27 degrees); a 
value of 1.0 would give you 45 degrees sides. "LogoRight" would be 
whatever point you'd want to keep at Z=0: This might be the edge of the 
front face, the centerline of the sides, or the outer edge of the sides, 
though I guess using the front face edge would be easiest.

Similarly, the top side would be defined as:

    prism {
      linear_spline
      -EdgeRadius, EdgeRadius,
      ...
      [number of points goes here, followed by desired
      X and Y coordinates; don't bother about Z yet]
      ...
      #local NewY = y+SideSlope*z;
      #local NewZ = vnormalize(vcross(x,NewY));
      translate -y*LogoTop
      Shear_Trans(x,NewY,NewZ);
      translate y*LogoTop
    }

Left and bottom would work likewise, except that you'd use 
"-SideSlope*z" instead of "+SideSlope*z".

The front face will not need any transformation I guess, except maybe 
translation to the desired Z coordinate.


Post a reply to this message

From: Jovian Ghost
Subject: Re: Newbie needs help with first project
Date: 10 Oct 2009 21:15:01
Message: <web.4ad1312e6c73c7c683b0b960@news.povray.org>
Thanks for the replies everyone!

I think that using spheres for corners and cylinders for edges is actually a
good idea, and probably the easiest for me to do. I do believe I may be
overstepping my bounds a bit.

But I also wanted to try my second idea (actually the link in my second post)
which is making a spline, then putting spheres that follow that spline. Then
drawing a cylinder from the top spline to the bottom.

That will work, but unfortunately I can't get my cubic spline to look right, and
for some crazy reason, POV-Ray only allows Bezier curves for prisms, and not for
anything else???

Is there an easier way I can model my cubic spline, rather than trial-by-error?
I tried exporting a spline from Inkscape but unfortunately that only does Bezier
curves.


Post a reply to this message

From: Chris B
Subject: Re: Newbie needs help with first project
Date: 11 Oct 2009 03:35:01
Message: <4ad18aa5@news.povray.org>
"Jovian Ghost" <nomail@nomail> wrote in message 
news:web.4ad1312e6c73c7c683b0b960@news.povray.org...
> Thanks for the replies everyone!
>
> I think that using spheres for corners and cylinders for edges is actually 
> a
> good idea, and probably the easiest for me to do. I do believe I may be
> overstepping my bounds a bit.
>
> But I also wanted to try my second idea (actually the link in my second 
> post)
> which is making a spline, then putting spheres that follow that spline. 
> Then
> drawing a cylinder from the top spline to the bottom.
>
> That will work, but unfortunately I can't get my cubic spline to look 
> right, and
> for some crazy reason, POV-Ray only allows Bezier curves for prisms, and 
> not for
> anything else???
>
> Is there an easier way I can model my cubic spline, rather than 
> trial-by-error?
> I tried exporting a spline from Inkscape but unfortunately that only does 
> Bezier
> curves.
>

There is an easy way: There are spline editors available that can directly 
generate cubic splines (e.g. Spilin, which is a small utily application for 
drawing POV-Ray and VRML splines. See 
http://news.povray.org/povray.binaries.utilities/thread/%3C48cf4dea@news.povray.org%3E/).


You can also do the job with Inkscape. It's a little more complex, but if 
you've already got the shape you want in Inkscape, you might want to give 
this a go:
  o  Use the 'edit points' selector in Inkscape to select your shape
  o  Ctrl-A to select all points
  o  Add sufficient intermediary points to the curve so that it won't matter 
what form of spline you eventually use, it'll follow the same path anyway
  o  Save as a POV-Ray prism object
  o  Extract the locations of the points, ignoring the control points

Inkscape writes out the bezier spline with 4 coordinates per line. The outer 
two points are the control points and the inner two points are points on the 
curve. Fortunately it aligns them nicely, making it mind-numbingly easy to 
select columns of data. If you open the file in an editor that supports 
columnar editing you can simply pick out the middle two columns to use, or 
pick out the outer two columns to delete.

In the POV-Ray Windows editor you can use the mouse with Ctrl-Shift to 
select columns of data:
  o  Select the first column of control points and hit delete.
  o  Select that last column of control points and hit delete.
  o  Delete the comma following the last point
  o  Change the spline type to linear
  o  Update the number of control points (halve it)
Hey presto you've got a linear spline that follows your curve and that you 
can easily redefine as a spline function. You can achieve similar results 
using less points by using a cubic spline, but then you'll need to deploy a 
bit of mental effort to add the necessary control points at the start and 
end of the spline.

Note that, when selecting large blocks of data in columns using POV-Ray you 
can click at the start point then use the mouse with the scroll bar to bring 
the end-point into view so that you can Ctrl-Shift-LeftMouseClick it. This 
method of scrolling avoids moving the current position of the caret in the 
text, whereas scrolling using the keyboard moves it, making the whole 
experience less satisfying  :-)

Hope that helps,

Regards,
Chris B.


Post a reply to this message

From: Jovian Ghost
Subject: Re: Newbie needs help with first project
Date: 11 Oct 2009 22:00:01
Message: <web.4ad28cda6c73c7c683b0b960@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:
> "Jovian Ghost" <nomail@nomail> wrote in message
> news:web.4ad1312e6c73c7c683b0b960@news.povray.org...
> > Thanks for the replies everyone!
> >
> > I think that using spheres for corners and cylinders for edges is actually
> > a
> > good idea, and probably the easiest for me to do. I do believe I may be
> > overstepping my bounds a bit.
> >
> > But I also wanted to try my second idea (actually the link in my second
> > post)
> > which is making a spline, then putting spheres that follow that spline.
> > Then
> > drawing a cylinder from the top spline to the bottom.
> >
> > That will work, but unfortunately I can't get my cubic spline to look
> > right, and
> > for some crazy reason, POV-Ray only allows Bezier curves for prisms, and
> > not for
> > anything else???
> >
> > Is there an easier way I can model my cubic spline, rather than
> > trial-by-error?
> > I tried exporting a spline from Inkscape but unfortunately that only does
> > Bezier
> > curves.
> >
>
> There is an easy way: There are spline editors available that can directly
> generate cubic splines (e.g. Spilin, which is a small utily application for
> drawing POV-Ray and VRML splines. See
>
http://news.povray.org/povray.binaries.utilities/thread/%3C48cf4dea@news.povray.org%3E/).
>
>
> You can also do the job with Inkscape. It's a little more complex, but if
> you've already got the shape you want in Inkscape, you might want to give
> this a go:
>   o  Use the 'edit points' selector in Inkscape to select your shape
>   o  Ctrl-A to select all points
>   o  Add sufficient intermediary points to the curve so that it won't matter
> what form of spline you eventually use, it'll follow the same path anyway
>   o  Save as a POV-Ray prism object
>   o  Extract the locations of the points, ignoring the control points
>
> Inkscape writes out the bezier spline with 4 coordinates per line. The outer
> two points are the control points and the inner two points are points on the
> curve. Fortunately it aligns them nicely, making it mind-numbingly easy to
> select columns of data. If you open the file in an editor that supports
> columnar editing you can simply pick out the middle two columns to use, or
> pick out the outer two columns to delete.
>
> In the POV-Ray Windows editor you can use the mouse with Ctrl-Shift to
> select columns of data:
>   o  Select the first column of control points and hit delete.
>   o  Select that last column of control points and hit delete.
>   o  Delete the comma following the last point
>   o  Change the spline type to linear
>   o  Update the number of control points (halve it)
> Hey presto you've got a linear spline that follows your curve and that you
> can easily redefine as a spline function. You can achieve similar results
> using less points by using a cubic spline, but then you'll need to deploy a
> bit of mental effort to add the necessary control points at the start and
> end of the spline.
>
> Note that, when selecting large blocks of data in columns using POV-Ray you
> can click at the start point then use the mouse with the scroll bar to bring
> the end-point into view so that you can Ctrl-Shift-LeftMouseClick it. This
> method of scrolling avoids moving the current position of the caret in the
> text, whereas scrolling using the keyboard moves it, making the whole
> experience less satisfying  :-)
>
> Hope that helps,
>
> Regards,
> Chris B.

Thanks Chris B!
Unfortunately I'm running the Linux version of POV-Ray, so I can't use Spilin; a
quick Google reveals it's a Windows app.

In my understand is correct, your Inkscape method describes creating a curved
line with a lot of straight lines.
I would prefer to use curved splines if I can.


Post a reply to this message

From: Chris B
Subject: Re: Newbie needs help with first project
Date: 12 Oct 2009 03:21:28
Message: <4ad2d8f8$1@news.povray.org>
"Jovian Ghost" <nomail@nomail> wrote in message 
news:web.4ad28cda6c73c7c683b0b960@news.povray.org...
> "Chris B" <nom### [at] nomailcom> wrote:
>> You can achieve similar results
>> using less points by using a cubic spline, but then you'll need to deploy 
>> a
>> bit of mental effort to add the necessary control points at the start and
>> end of the spline.
>
> In my understand is correct, your Inkscape method describes creating a 
> curved
> line with a lot of straight lines.
> I would prefer to use curved splines if I can.
>

You can certainly use a curved spline with this method (cubic, quadratic or 
natural when defining a spline function). Using a curved spline should mean 
you can define a smooth curve using fewer points than with the liear spline 
type, though you will still need enough additional points to avoid the sort 
of kinks that you mentioned earlier.

Using a curved spline will mean that, once you've got the spline across into 
POV-Ray, you'll need to define a few control points at the start and end by 
hand so that the end of the spline with join smoothly onto the start of the 
spline.

Regards,
Chris B.


Post a reply to this message

From: Jim Charter
Subject: Re: Newbie needs help with first project
Date: 12 Oct 2009 14:42:11
Message: <4ad37883$1@news.povray.org>
Jovian Ghost wrote:

> So I started experimenting, trying to recreate the profile I want using a cubic
> spline, with no success. I seem to end up having kinks in the spline no matter
> what I try.
> 
As far as I know the ONYL way to do this (define a bezier spline) is 
with a set of early macros written by Chris Colefax and put into an 
include file called spline.inc

The macros are very powerful allowing you to use control points for each 
point on the sline.


Also as far as I know no one ever duplicated or modernized his work 
(which surprises me)

It resided on a geocities site and I note that there is an effort to 
preserve early POV contributions which resided there even as we speak. 
The thread is in p.general

I do have a copy of those (very useful) macros if you cannot get it any 
other way.


Post a reply to this message

From: William Pokorny
Subject: Re: Newbie needs help with first project
Date: 12 Oct 2009 20:25:01
Message: <web.4ad3c7926c73c7ca43ab4450@news.povray.org>
I too am running Linux. I just ran Spilin, of which I knew not (thanks Chris),
under wine and it appears to run fine should you want to give Spilin a go that
way.

"Jovian Ghost" <nomail@nomail> wrote:
> Unfortunately I'm running the Linux version of POV-Ray, so I can't use Spilin; a
> quick Google reveals it's a Windows app.
>
> In my understand is correct, your Inkscape method describes creating a curved
> line with a lot of straight lines.
> I would prefer to use curved splines if I can.


Post a reply to this message

From: Jovian Ghost
Subject: Re: Newbie needs help with first project
Date: 12 Oct 2009 22:45:00
Message: <web.4ad3e96a6c73c7c683b0b960@news.povray.org>
"William Pokorny" <pokorny_epix_net> wrote:
> I too am running Linux. I just ran Spilin, of which I knew not (thanks Chris),
> under wine and it appears to run fine should you want to give Spilin a go that
> way.
>
> "Jovian Ghost" <nomail@nomail> wrote:
> > Unfortunately I'm running the Linux version of POV-Ray, so I can't use Spilin; a
> > quick Google reveals it's a Windows app.
> >
> > In my understand is correct, your Inkscape method describes creating a curved
> > line with a lot of straight lines.
> > I would prefer to use curved splines if I can.

Thanks for everyone's replies!
I'm experimenting with different methods right now actually, and may not go with
the splines method in the end. But good to know that Spilin runs under WINE,
thanks William. :)


Post a reply to this message

From: John
Subject: Re: Newbie needs help with first project
Date: 3 Jan 2010 15:35:00
Message: <web.4b40fe666c73c7c7671684c0@news.povray.org>
Jim Charter <jrc### [at] msncom> wrote:
> Jovian Ghost wrote:
> It resided on a geocities site and I note that there is an effort to
> preserve early POV contributions which resided there even as we speak.
> The thread is in p.general
>
> I do have a copy of those (very useful) macros if you cannot get it any
> other way.

Hi Jim.

I hit the same problem, and after looking around for some time, I did find a
copy of spline.inc, but, as yet, I couldn't find any documentation. I'd
appreciate any leads!

Happy 2010!

John


Post a reply to this message

From: Jim Charter
Subject: Re: Newbie needs help with first project
Date: 3 Jan 2010 23:29:41
Message: <4b416eb5$1@news.povray.org>
John wrote:
> Jim Charter <jrc### [at] msncom> wrote:
>> Jovian Ghost wrote:
>> It resided on a geocities site and I note that there is an effort to
>> preserve early POV contributions which resided there even as we speak.
>> The thread is in p.general
>>
>> I do have a copy of those (very useful) macros if you cannot get it any
>> other way.
> 
> Hi Jim.
> 
> I hit the same problem, and after looking around for some time, I did find a
> copy of spline.inc, but, as yet, I couldn't find any documentation. I'd
> appreciate any leads!
> 
> Happy 2010!
> 
> John
> 
> 
> 
Hmmmm Shame, yes there was some nice documentation online in html.  I 
didn't copy it.  I have only the Quickref file.


Post a reply to this message

<<< Previous 3 Messages Goto Initial 10 Messages

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