HELP POV: disc has wrong color (different to cylinder and mesh)

2 views
Skip to first unread message

Lars C. Hassing

unread,
May 20, 1998, 3:00:00 AM5/20/98
to

The color of the disc is different than the colors of the triangles and the
cylinder.
It can't be the matrix introducing an error - can it ?
I'm using POVRAY for Windows 3.01.
Best regards from Denmark
Lars Hassing

#default { texture { pigment { rgb <1,0.9,0.2> } finish { ambient 0.4 } } }
background { color rgb <0.3,0.8,1.0>}

#declare quarterdisc = disc {
<0,0,0>, <0,1,0>, 1
//clipped_by { box { <0,-0.01,0>, <1,0.01,1> } }
}
#declare quartercyli = cylinder {
<0,-0.001,0>, <0,0.001,0>, 1
clipped_by { box { <0,-0.01,-1>, <1,0.01,0> } }
}

union {
mesh {
triangle { <40,32,-10>, <40,20,-10>, <40,20,-30> }
triangle { <40,20,-30>, <40,32,-30>, <40,32,-10> }
}
object { quarterdisc matrix <0,-20,0,1,0,0,0,0,-20,41,20,-10> }
object { quartercyli matrix <0,-20,0,1,0,0,0,0,-20,40,20,-10> }
}

camera {
location <70,0,-50>
sky -y
right -4/3*x
look_at <40,20,-10>
}
light_source { <50,20,-40> color rgb <1,1,1> }


Nieminen Mika

unread,
May 21, 1998, 3:00:00 AM5/21/98
to

Lars C. Hassing <l...@cci.dk> wrote:
: The color of the disc is different than the colors of the triangles and the
: cylinder.

This is because of the shading. If you comment out the light source and
set the default ambient to 1, then they will have the same color.

--
- Warp. -

Lars C. Hassing

unread,
May 26, 1998, 3:00:00 AM5/26/98
to

Nieminen Mika <wa...@assari.cc.tut.fi> wrote in article
<6k1did$n41$5...@baker.cc.tut.fi>...

But why is the shading different for the disc and the cylinder ?
The cylinder is very short and should look like the disc.
The shading of the cylinder and the triangles look as if
they were cut of the same piece,
but the shading of the disc is way different - although the same
transformation is applied to both the disc and the cylinder.
Why aren't the thin cylinder and the disc interchangable ?
I was going to use the disc for my scene because it seemed the logical
choice,
but do I really have to use a short cylinder in stead
in order to have the same shading as the triangles ?
/Lars

POV source (slightly modified):

#default { texture { pigment { rgb <1,0.9,0.2> } finish { ambient 0.4 } } }
background { color rgb <0.3,0.8,1.0>}

#declare quarterdisc = disc {
<0,0,0>, <0,1,0>, 1

clipped_by { box { <0,-0.01,0>, <1,0.01,1> } }
}
#declare quartercyli = cylinder {
<0,-0.001,0>, <0,0.001,0>, 1
clipped_by { box { <0,-0.01,-1>, <1,0.01,0> } }
}

union {
mesh {
triangle { <40,32,-10>, <40,20,-10>, <40,20,-30> }
triangle { <40,20,-30>, <40,32,-30>, <40,32,-10> }
}

object { quarterdisc matrix <0,-20,0,1,0,0,0,0,-20,40,20,-10> }
object { quartercyli matrix <0,-20,0,1,0,0,0,0,-20,40,20,-10> }
}

camera {
location <70,0,-50>
sky -y
right -4/3*x
look_at <40,20,-10>
}

light_source { <50,0,-40> color rgb <1,1,1> }


Vahur Krouverk

unread,
May 26, 1998, 3:00:00 AM5/26/98
to

Hi!

Lars C. Hassing wrote:

> But why is the shading different for the disc and the cylinder ?

I got interested by this problem and tried out by myself. At first I thought,
that there is something to do with disc. Povray manual states, that
" The disc is infinitely thin, it has no thickness. If you want a disc with
true thickness you should use a very short cylinder."
But this seemed not to be the case, for when I replaced transformation matrix
with rotation, scale and translate (hopefully correctly ;-), then all seemed to
be OK. May-be there is bug in matrix handling and it should be reported to
PovRay team? When I get time, then I look at source code and try to figure out,
what's going wrong with transformation.
Anyway, if You use following code, then it works. This seems to be example of
practice, as it works, but nobody knows, why (well, at least I don't know).

> #default { texture { pigment { rgb <1,0.9,0.2> } finish { ambient 0.4 } } }
> background { color rgb <0.3,0.8,1.0>}
>
> #declare quarterdisc = disc {
> <0,0,0>, <0,1,0>, 1
> clipped_by { box { <0,-0.01,0>, <1,0.01,1> } }
> }
> #declare quartercyli = cylinder {
> <0,-0.001,0>, <0,0.001,0>, 1
> clipped_by { box { <0,-0.01,-1>, <1,0.01,0> } }
> }
>
> union {
> mesh {
> triangle { <40,32,-10>, <40,20,-10>, <40,20,-30> }
> triangle { <40,20,-30>, <40,32,-30>, <40,32,-10> }
> }
> object { quarterdisc matrix <0,-20,0,1,0,0,0,0,-20,40,20,-10> }
> object { quartercyli matrix <0,-20,0,1,0,0,0,0,-20,40,20,-10> }
>

replace last 2 lines with object { quarterdisc rotate z*90 scale <1, -20,
-20> translate <40,20,-10>}
object { quartercyli rotate z*90 scale <1, -20, -20> translate <40,20,-10>}

Vahur Krouverk

unread,
May 30, 1998, 3:00:00 AM5/30/98
to


Vahur Krouverk wrote:

> But this seemed not to be the case, for when I replaced transformation matrix
> with rotation, scale and translate (hopefully correctly ;-), then all seemed to
> be OK. May-be there is bug in matrix handling and it should be reported to
> PovRay team? When I get time, then I look at source code and try to figure out,
> what's going wrong with transformation.

Well, I looked to PovRay code and as it appears, there is indeed bug in disc
implementation. To be more specific, matrix transformation for disc does not modify
disc's normal vector and therefore it gets coloured differently.I fixed source code
to test it and it seems to work (disc gets coloured same way, as cylinder). Is this
bug known and has anybody reported about this bug to PovRay team?
More generally, is there somewhere list of known (and/or reported/fixed) bugs?
May-be PovRay site should include page for this?

Reply all
Reply to author
Forward
0 new messages