POV-Ray : Newsgroups : povray.general : How are pixels colored off in POV? Server Time
31 Oct 2024 16:17:42 EDT (-0400)
  How are pixels colored off in POV? (Message 1 to 3 of 3)  
From: Meenal
Subject: How are pixels colored off in POV?
Date: 9 Jun 2005 20:40:02
Message: <web.42a8e0a772645079199eef0@news.povray.org>
Say I create a box in POV. Then I rotate this box about the x-axis by 63
degrees and the y axis by 72 degrees and then render the image. The
coordinates of the box will no longer be integers. So how will the pixels
in the rendered image be colored off? The box will project onto parts of
some pixels. So if the box projects onto half or more of the pixel, it will
be colored off, and if it projects onto less than half of a pixel it will
not be colored off? Is that how it works?

Meenal


Post a reply to this message

From: Zeger Knaepen
Subject: Re: How are pixels colored off in POV?
Date: 9 Jun 2005 21:04:40
Message: <42a8e728$1@news.povray.org>
"Meenal" <mee### [at] studentumassedu> wrote in message
news:web.42a8e0a772645079199eef0@news.povray.org...
>
>
> Say I create a box in POV. Then I rotate this box about the x-axis by 63
> degrees and the y axis by 72 degrees and then render the image. The
> coordinates of the box will no longer be integers. So how will the pixels
> in the rendered image be colored off? The box will project onto parts of
> some pixels. So if the box projects onto half or more of the pixel, it will
> be colored off, and if it projects onto less than half of a pixel it will
> not be colored off? Is that how it works?
>
> Meenal

I get the feeling that you don't really understand how raytracing works.
POV-Ray shoots a ray from the camera location for every pixel.  That ray will
hit zero or more objects, but since it's an infinitely thin ray, it can not ever
half-hit an object.
The problem is, as you say, that an arbitray object does not "project" exactly
onto integer pixels, so you will get artifacts called aliasing.  To minimize
those artifacts, you can ask POV-Ray to shoot more than 1 ray per pixel and the
average result of all those rays will be the color of the pixel.

cu!
--
camera{location-z*3}#macro G(b,e)b+(e-b)*(C/50)#end#macro L(b,e,k,l)#local C=0
;#while(C<50)sphere{G(b,e),.1pigment{rgb G(k,l)}finish{ambient 1}}#local C=C+1
;#end#end L(y-x,y,x,x+y)L(y,-x-y,x+y,y)L(-x-y,-y,y,y+z)L(-y,y,y+z,x+y)L(0,x+y,
<.5,1,.5>,x)L(0,x-y,<.5,1,.5>,x)                 // ZK http://www.povplace.com


Post a reply to this message

From: Slime
Subject: Re: How are pixels colored off in POV?
Date: 9 Jun 2005 23:05:47
Message: <42a9038b$1@news.povray.org>
> I get the feeling that you don't really understand how raytracing works.
> POV-Ray shoots a ray from the camera location for every pixel.  That ray
will
> hit zero or more objects, but since it's an infinitely thin ray, it can
not ever
> half-hit an object.


I'd just like to reiterate this in a little more detail. You seem to believe
that POV-Ray takes the objects in your scene and projects them onto the
image one at a time. However, what actually happens is that for each *pixel*
in the scene, a "ray" is shot into the scene, and it is determined what
object the ray collides with. If there is no object in that direction, the
background color is used; otherwise, lighting on the object surface is
calculated and the resulting color is used. The pixel is then assigned that
color.

Since the rays are shot through the centers of pixels, a pixel will be
"colored off" if the object "projects" through the center of that pixel. (It
would be possible to have a complicated object that filled an entire pixel
but had a small hole right at the center of the pixel; then the pixel would
not be colored by the object.)

As you've noticed, this causes jagged edges ("aliasing"), and as others have
said, this problem can be reduced with "anti-aliasing". For more information
on anti-aliasing, see
http://www.povray.org/documentation/view/3.6.1/223/#s02_01_02_08_04 ; the
settings shown there can be typed into the command line textbox at the top
of the POV-Ray for Windows editor.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

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