POV-Ray : Newsgroups : povray.newusers : Newbie needs help with first project Server Time
31 Oct 2024 06:00:11 EDT (-0400)
  Newbie needs help with first project (Message 1 to 10 of 13)  
Goto Latest 10 Messages Next 3 Messages >>>
From: Jovian Ghost
Subject: Newbie needs help with first project
Date: 7 Oct 2009 16:15:00
Message: <web.4accf4c32148fdf42a2ae5f70@news.povray.org>
Hello all,

First-time POV-Ray user here. I've been reading up and experiementing, and
decide I want to do something.

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

Ok so, I've decided probably the best approach is to break it up until multiple
pieces. The center square will be one piece, the crossbar another, and the left
and right angled tips will be two more.

Well I'm finding it's not as easy I thought.

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.

I'm sorry if my description is not very accurate, I can't really describe what I
mean.

Here's some sample code. (There's probably a MUCH easier way of creating the
bezier but at the moment I'm very new and am just starting to get a grasp on
things.)

#include "colors.inc"

#local CAM_POS = <0, 0, -20>;
#local LIGHT_POS = <10, 10, -25>;

camera
{
    location CAM_POS
    look_at <0, 0, 0>
}

light_source
{
    LIGHT_POS
    rgb <1, 1, 1>
}

#local SIZE = 1;

prism
{
    conic_sweep
    bezier_spline
    0.8, 1, 48
    // lower right
    <0, -SIZE>, <0.1*SIZE, -SIZE>, <0.7*SIZE, -SIZE>, <0.8*SIZE, -SIZE>,
    <0.8*SIZE, -SIZE>, <SIZE, -SIZE>, <SIZE, -SIZE>, <SIZE, -0.8*SIZE>,
    <SIZE, -0.8*SIZE>, <SIZE, -0.7*SIZE>, <SIZE, -0.1*SIZE>, <SIZE, 0>,
    // upper right
    <SIZE, 0>, <SIZE, 0.1*SIZE>, <SIZE, 0.7*SIZE>, <SIZE, 0.8*SIZE>,
    <SIZE, 0.8*SIZE>, <SIZE, SIZE>, <SIZE, SIZE>, <0.8*SIZE, SIZE>,
    <0.8*SIZE, SIZE>, <0.7*SIZE, SIZE>, <0.1*SIZE, SIZE>, <0, SIZE>,
    // upper left
    <0, SIZE>, <-0.1*SIZE, SIZE>, <-0.7*SIZE, SIZE>, <-0.8*SIZE, SIZE>,
    <-0.8*SIZE, SIZE>, <-SIZE, SIZE>, <-SIZE, SIZE>, <-SIZE, 0.8*SIZE>,
    <-SIZE, 0.8*SIZE>, <-SIZE, 0.7*SIZE>, <-SIZE, 0.1*SIZE>, <-SIZE, 0>,
    // lower left
    <-SIZE, 0>, <-SIZE, -0.1*SIZE>, <-SIZE, -0.7*SIZE>, <-SIZE, -0.8*SIZE>,
    <-SIZE, -0.8*SIZE>, <-SIZE, -SIZE>, <-SIZE, -SIZE>, <-0.8*SIZE, -SIZE>,
    <-0.8*SIZE, -SIZE>, <-0.7*SIZE, -SIZE>, <-0.1*SIZE, -SIZE>, <0, -SIZE>
    pigment { color Yellow }
    scale <10, 10, 10>
    rotate <90, 0, 0>
}


Post a reply to this message

From: Jovian Ghost
Subject: Re: Newbie needs help with first project
Date: 7 Oct 2009 23:20:01
Message: <web.4acd59d36c73c7c2a2ae5f70@news.povray.org>
After doing some reading and stumbling across this thread

http://news.povray.org/povray.general/thread/%3C4a85a542@news.povray.org%3E/

this seems like exactly what I'd like to do.
Unfortunately I am unable to define a bezier spline using #declare. It seems I
can only specify linear, quadratic or cubic/natural.

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.

With a bezier spline it was easy; I just opened up Inkscape, plotted my profile,
and exported to a .pov file. But Inkscape seems to only work with beziers, as
oppose to cubic splines.

Does anyone have any advice?


Post a reply to this message

From: Leroy Whetstone
Subject: Re: Newbie needs help with first project
Date: 8 Oct 2009 01:54:18
Message: <4ACD7DB7.9070106@joplin.com>
http://leroywhetstone.s5.com/

Jovian Ghost wrote:
> Hello all,
> 
> First-time POV-Ray user here. I've been reading up and experiementing, and
> decide I want to do something.
> 

Welcome to wonderful world of POV!

> 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
> 
> Ok so, I've decided probably the best approach is to break it up until multiple
> pieces. The center square will be one piece, the crossbar another, and the left
> and right angled tips will be two more.
> 

Good Idea!


> Well I'm finding it's not as easy I thought.
> 

Been there!

> 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.
> 
> I'm sorry if my description is not very accurate, I can't really describe what I
> mean.
> 

I don't know what others may say, but I understand ya!

> Here's some sample code. (There's probably a MUCH easier way of creating the
> bezier but at the moment I'm very new and am just starting to get a grasp on
> things.)
> 

  If this is your truly first 'real project' I'd go a lot simpler than 
using prizms. There was a lot of different ways to round one but I 
haven't seen one yet that I like. I would make a wire frame out of 
spheres and cylenders then fill in the sides with triangles.

Have Fun!


Post a reply to this message

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

Goto Latest 10 Messages Next 3 Messages >>>

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