POV-Ray : Newsgroups : povray.text.scene-files : Bevelled text macro Server Time
1 Nov 2024 09:23:13 EDT (-0400)
  Bevelled text macro (Message 1 to 5 of 5)  
From: Chris Huff
Subject: Bevelled text macro
Date: 20 Dec 2000 16:56:31
Message: <chrishuff-CF42D9.16573920122000@news.povray.org>
This version is slightly more complete than the version posted in 
povray.text.scene-files.

#macro ShearTrans(A, B, C)
    matrix <    A.x, A.y, A.z,
                B.x, B.y, B.z,
                C.x, C.y, C.z,
                0, 0, 0>
#end
#macro BevelText(Font, String, Cuts, BevelAng, BevelDepth, Depth, Offset)
    #local BBox = text {ttf Font, String Depth, Offset}
    union {
        text {ttf Font, String Depth-BevelDepth, Offset}
        intersection {
            #local J=0;
            #while(J<Cuts)
                #local A = 2*pi*J/(Cuts);
                #local CA = cos(radians(BevelAng));
                #local SA = sin(radians(BevelAng));
                text {ttf Font, String BevelDepth, Offset
                    translate -z*(BevelDepth+J*0.0001)
                    ShearTrans(x, y, < cos(A)*SA, sin(A)*SA, CA>/CA)
                }
                #local J=J+1;
            #end
        }
        translate z*BevelDepth
        bounded_by {box {min_extent(BBox), max_extent(BBox)}}
    }
#end

BevelText(Font, String, Cuts, BevelAng, BevelDepth, Depth, Offset)
Font: the name of the font file.
String: the text of the text object.
Cuts: the number of intersections to use to bevel the edges, more is 
better, but slower. You can use any positive number, but multiples of 4 
work well.
BevelAng: the angle of the bevel.
BevelDepth: the distance the bevel extends front-to-back.
Depth: the total front-to-back thickness of the final object.
Offset: the offset vector of the text object. Using an offset along the 
z-axis won't work, but other offsets should be fine.

Note that this macro doesn't work well with sharp corners, though using 
more cuts will reduce the problems.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Dave Blandston
Subject: Re: Bevelled text macro
Date: 24 Dec 2000 12:37:12
Message: <3a463448@news.povray.org>
"Chris Huff" <chr### [at] maccom> wrote in message
news:chrishuff-CF42D9.16573920122000@news.povray.org...
> This version is slightly more complete than the version posted in
> povray.text.scene-files.

With a slight modification, this macro works with any object, not just
text... Excellent macro, Chris!

Regards,
Dave


Post a reply to this message

From: Chris Huff
Subject: Re: Bevelled text macro
Date: 24 Dec 2000 14:17:59
Message: <chrishuff-C90F05.14191224122000@news.povray.org>
In article <3a463448@news.povray.org>, "Dave Blandston" 
<gra### [at] earthlinknet> wrote:

> With a slight modification, this macro works with any object, not just
> text... Excellent macro, Chris!

Well, depends on what you mean by "bevelling" for those other 
objects...a bevelled box would require very different calculations than 
a bevelled cylinder , and there are far more efficient ways of doing 
those objects than shearing and CSG'ing a bunch of pieces(and how do you 
bevel the edges of a sphere or torus?). Also, your object needs to be 
aligned so that the part being bevelled is up against a plane and no 
other parts are on the other side or within the bevelling depth of that 
plane. This is what kept me from writing a general "BevelObject()" macro.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Dave Blandston
Subject: Re: Bevelled text macro
Date: 24 Dec 2000 20:04:10
Message: <3a469d0a@news.povray.org>
"Chris Huff" <chr### [at] maccom> wrote in message
news:chrishuff-C90F05.14191224122000@news.povray.org...
> Also, your object needs to be
> aligned so that the part being bevelled is up against a plane and no
> other parts are on the other side or within the bevelling depth of that
> plane. This is what kept me from writing a general "BevelObject()" macro.

Ummm... yeah, that's what I meant - I used the macro to bevel a frame around
some text, and it works very well. I'll put up another picture in the images
group to illustrate.

-Dave


Post a reply to this message

From: Chris Huff
Subject: Re: Bevelled text macro
Date: 24 Dec 2000 21:41:42
Message: <chrishuff-CBA501.21425724122000@news.povray.org>
In article <3a469d0a@news.povray.org>, "Dave Blandston" 
<gra### [at] earthlinknet> wrote:

> Ummm... yeah, that's what I meant - I used the macro to bevel a frame 
> around some text, and it works very well. I'll put up another picture 
> in the images group to illustrate.

I see...I was thinking in more 3D terms, where a bevelled cylinder would 
be a short cylinder and two capping cones, and a bevelled box would have 
bevels on all 12 edges. For stuff aligned on a plane, like this, it will 
work fine.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

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