POV-Ray : Newsgroups : povray.newusers : shapes and colors Server Time
31 Oct 2024 14:09:49 EDT (-0400)
  shapes and colors (Message 1 to 8 of 8)  
From: Thanu
Subject: shapes and colors
Date: 30 Nov 2007 02:15:00
Message: <web.474fb83b21492ecb4ac3566b0@news.povray.org>
Is there a way to fill a shape with one color and give the shape's outer line a
different color?

ex: I need to have a blue color box with its lines(which show the edges of the
shape surfaces) in red color.


Post a reply to this message

From: Tim Attwood
Subject: Re: shapes and colors
Date: 30 Nov 2007 03:42:46
Message: <474fcd06$1@news.povray.org>
> Is there a way to fill a shape with one color and give the shape's outer 
> line a
> different color?
>
> ex: I need to have a blue color box with its lines(which show the edges of 
> the
> shape surfaces) in red color.

You can get by with using the object pattern to color the
edges differently.
Or you can do this with find-edges as a post-process with
a paint program for more complicated scenes.

#include "shapes.inc"

#macro outlined_box(a b os c1 c2)
   box{a,b pigment{object{Wire_Box_Union(a-os,b+os,os) c1 c2}}}
#end

union {
   outlined_box(<-0.5,-0.5,-0.5>,<0.5,0.5,0.5>,0.1,Red,Green)
   rotate 45*y
   rotate 45*x
}


Post a reply to this message

From: JetRacer
Subject: Re: shapes and colors
Date: 1 Dec 2007 15:50:00
Message: <web.4751c82ae3788ac5278fa6d50@news.povray.org>
"Thanu" <nomail@nomail> wrote:
> Is there a way to fill a shape with one color and give the shape's outer line a
> different color?
>
> ex: I need to have a blue color box with its lines(which show the edges of the
> shape surfaces) in red color.

You mean an outline or a wireframe?

A wireframe is best made using cylinders. The clever way is to defign the
cylinder thickness as:

Thickness*VDist(CameraLocation, ObjectLocation)/image_height

Thickness should be replaced with your radius value in pixels. Note that
"image_height" is a built-in Pov-Ray function (don't replace it with a number).
This is obviusly not fool-proof. Using cones (individually calculated ends
radius) would fix most problems asociated with closeups and wide angle cameras.

If you want an outline in Pov-Ray then it's simply not humanly possible and you
better go with the image processor option as stated above. The clever way to do
that is to make a copy of the original scene and modify it so all outlined
object(s) are presented as white with ambient 1 diffuse 0 and everything not
outlined as black. Use RGB component colors instead of white to support
overlapping objects (so you don't have to play around with multiple files, just
copy from the channels).

Hint: in my book "not humanly possible" includes a scheme to use object pattern
with a rotated box and transparency presented on a polygon square. Which
probably won't work in practic either :(

If edge detect doesn't play nice then you may want to try blur and levels then
eliminate the "bleeding in" by re-introducing the original as a screen layer
(aka "additive").


Post a reply to this message

From: Leroy
Subject: Re: shapes and colors
Date: 2 Dec 2007 22:43:26
Message: <47537B18.6040906@joplin.com>
Thanu wrote:
> Is there a way to fill a shape with one color and give the shape's outer line a
> different color?
> 
> ex: I need to have a blue color box with its lines(which show the edges of the
> shape surfaces) in red color.
> 

The others have give you good advice. But, how about a simple way.

box{-1,1 pigment{boxed color_map{[.1 Red][.1 Blue]}scale 1.01}}

  or have I missed the boat?


Post a reply to this message

From: Tim Attwood
Subject: Re: shapes and colors
Date: 2 Dec 2007 23:06:21
Message: <475380bd$1@news.povray.org>
> The others have give you good advice. But, how about a simple way.
>
> box{-1,1 pigment{boxed color_map{[.1 Red][.1 Blue]}scale 1.01}}
>
>  or have I missed the boat?

Your example is red on the whole surface of the box.
Other sized boxes will have at most two sides that
have a blue field with red outline using that pigment.


Post a reply to this message

From: Alain
Subject: Re: shapes and colors
Date: 3 Dec 2007 09:22:54
Message: <4754113e$1@news.povray.org>
Leroy nous apporta ses lumieres en ce 2007/12/02 22:42:
> Thanu wrote:
>> Is there a way to fill a shape with one color and give the shape's 
>> outer line a
>> different color?
>>
>> ex: I need to have a blue color box with its lines(which show the 
>> edges of the
>> shape surfaces) in red color.
>>
> 
> The others have give you good advice. But, how about a simple way.
> 
> box{-1,1 pigment{boxed color_map{[.1 Red][.1 Blue]}scale 1.01}}
> 
>  or have I missed the boat?
> 
It will only work for an almost square superellipsoid, and the lines will be 
rounded.
In the case of a box, all faces are at the same distance from the reference 
planes, and the boxed pattern behave the same. The result: all the faces receive 
a constant plain colour.

-- 
Alain
-------------------------------------------------
You know you've been raytracing too long when you have ever said "I don't need 
no steenking modellers!!!"
Stephan Ahonen


Post a reply to this message

From: Leroy
Subject: Re: shapes and colors
Date: 3 Dec 2007 23:34:27
Message: <4754D88B.20308@joplin.com>
Your both right, I wasn't thinking! :( I didn't even test it.
I'd been using the box pattern of a two dimension surface.
It don't expand to 3d object that easily.

Leroy wrote:
> Thanu wrote:
> 
>> Is there a way to fill a shape with one color and give the shape's 
>> outer line a
>> different color?
>>
>> ex: I need to have a blue color box with its lines(which show the 
>> edges of the
>> shape surfaces) in red color.
>>
> 
> The others have give you good advice. But, how about a simple way.
> 
> box{-1,1 pigment{boxed color_map{[.1 Red][.1 Blue]}scale 1.01}}
> 
>  or have I missed the boat?
>


Post a reply to this message

From: Leroy
Subject: Re: shapes and colors
Date: 4 Dec 2007 00:00:19
Message: <4754DE9C.30403@joplin.com>
Leroy wrote:
> Your both right, I wasn't thinking! :( I didn't even test it.
> I'd been using the box pattern on a two dimension surface.
> It don't expand to 3d object that easily.

Try this I didn't write it I want to say Warp did but can't be sure

#declare Pig=pigment{boxed color_map{[.1 Red][.1 Blue]}scale<.9,.9,1.5>}

#declare Pyramid = function { abs(x) < y & abs(z) < y };

#declare CubePattern =
   function
   { Pyramid(x, -z, y)*1/6+
     Pyramid(y, x, z)*2/6+
     Pyramid(x, z, y)*3/6+
     Pyramid(y, -x, z)*4/6+
     Pyramid(x, -y, z)*5/6
   };
#declare ThePigment =
   pigment
   { function { CubePattern(x, y, z) }
     pigment_map
     { [0/6 Pig rotate x*90] //top
       [1/6 Pig]              //front
       [2/6 Pig rotate -y*90]//left
       [3/6 Pig rotate -y*180]//back
       [4/6 Pig rotate y*90] //right
       [5/6 Pig rotate -x*90] //bottom
     }
   };

box{-1,1 pigment{ThePigment}}

You could replace the pigment statment with 6 different image_map 
pigments if ya like.

Have fun!


Post a reply to this message

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