POV-Ray : Newsgroups : povray.bugreports : polygon rendered incorrectly Server Time
21 Nov 2024 13:19:03 EST (-0500)
  polygon rendered incorrectly (Message 1 to 4 of 4)  
From: MidiPlay
Subject: polygon rendered incorrectly
Date: 6 Sep 2015 16:55:00
Message: <web.55eca5fb4523f5f1d6117b550@news.povray.org>
I have 2 polygons, they're 200 units apart and they're identical apart from 1
vertex being moved 1 unit.  They're displayed with different colours.  Why?  I'm
using version 3.7.0.msvc10-sse2.win32.

#version 3.5;
#include "colors.inc"
global_settings { assumed_gamma 1.0 }
background { rgb 0.0500 }
light_source { <0, +10000, 0> rgb 1 }
#declare Pigment1 = texture { pigment { color rgb < 1 , 0 , 0 > } }
#declare Pigment2 = texture { pigment { color rgb < 0 , 1 , 0 > } }
polygon
{
    11,
    < 192 , 0 , -126 >
    < 152 , 0 ,   23 >
    < 145 , 0 ,   53 >
    < 124 , 0 ,   77 >
    <  96 , 0 ,   88 >
    <  65 , 0 ,   84 >
    <  50 , 0 ,   79 >
    <  50 , 0 ,  126 >
    < 200 , 0 ,  126 >
    < 200 , 0 , -126 >
    < 192 , 0 , -126 >
    texture { Pigment1 } interior_texture { Pigment2 }
}
polygon
{
    11,
    < 392 , 0 , -126 >
    < 353 , 0 ,   23 >
    < 345 , 0 ,   53 >
    < 324 , 0 ,   77 >
    < 296 , 0 ,   88 >
    < 265 , 0 ,   84 >
    < 250 , 0 ,   79 >
    < 250 , 0 ,  126 >
    < 400 , 0 ,  126 >
    < 400 , 0 , -126 >
    < 392 , 0 , -126 >
    texture { Pigment1 } interior_texture { Pigment2 }
}
plane
{
    y, -0.1
    pigment
    {
        checker rgbf <0.6,0.6,0.6, 1.0>, rgbf <1,1,1, 0.6>
    }
    scale 100
}
camera
{
    location < 200 , 8000 , 0 >
    right 1.778 * x
    angle 6.5000
    look_at < 200 , 0 , 0 >
}


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: polygon rendered incorrectly
Date: 6 Sep 2015 17:15:00
Message: <web.55ecab73b62fe087b09a9f90@news.povray.org>
"MidiPlay" <ast### [at] yahoocouk> wrote:
> I have 2 polygons, they're 200 units apart and they're identical apart from 1
> vertex being moved 1 unit.  They're displayed with different colours.  Why?  I'm
> using version 3.7.0.msvc10-sse2.win32.
>
> #version 3.5;
> #include "colors.inc"
> global_settings { assumed_gamma 1.0 }
> background { rgb 0.0500 }
> light_source { <0, +10000, 0> rgb 1 }
> #declare Pigment1 = texture { pigment { color rgb < 1 , 0 , 0 > } }
> #declare Pigment2 = texture { pigment { color rgb < 0 , 1 , 0 > } }
> polygon
> {
>     11,
>     < 192 , 0 , -126 >
>     < 152 , 0 ,   23 >
>     < 145 , 0 ,   53 >
>     < 124 , 0 ,   77 >
>     <  96 , 0 ,   88 >
>     <  65 , 0 ,   84 >
>     <  50 , 0 ,   79 >
>     <  50 , 0 ,  126 >
>     < 200 , 0 ,  126 >
>     < 200 , 0 , -126 >
>     < 192 , 0 , -126 >
>     texture { Pigment1 } interior_texture { Pigment2 }
> }
> polygon
> {
>     11,
>     < 392 , 0 , -126 >
>     < 353 , 0 ,   23 >
>     < 345 , 0 ,   53 >
>     < 324 , 0 ,   77 >
>     < 296 , 0 ,   88 >
>     < 265 , 0 ,   84 >
>     < 250 , 0 ,   79 >
>     < 250 , 0 ,  126 >
>     < 400 , 0 ,  126 >
>     < 400 , 0 , -126 >
>     < 392 , 0 , -126 >
>     texture { Pigment1 } interior_texture { Pigment2 }
> }
> plane
> {
>     y, -0.1
>     pigment
>     {
>         checker rgbf <0.6,0.6,0.6, 1.0>, rgbf <1,1,1, 0.6>
>     }
>     scale 100
> }
> camera
> {
>     location < 200 , 8000 , 0 >
>     right 1.778 * x
>     angle 6.5000
>     look_at < 200 , 0 , 0 >
> }

The surface normal points the other way. A polygon has no real "inside" and at
the end of the day, "interior_texture" does nothing else but look at the sign of
the surface normal because in objects with a volume, it is properly defined (in
POV-Ray anyway) in a consistent way. As there is no way to set the surface
normal
of polygons in POV, you might want to try reversing the order of points to
invert the surface normal.

Either way, it is not a bug.


Post a reply to this message

From: Chris Hills
Subject: Re: polygon rendered incorrectly
Date: 13 Oct 2015 16:52:14
Message: <561d6efe@news.povray.org>
"Thorsten Froehlich" <nomail@nomail> wrote in message 
news:web.55ecab73b62fe087b09a9f90@news.povray.org...
> "MidiPlay" <ast### [at] yahoocouk> wrote:
>> I have 2 polygons, they're 200 units apart and they're identical apart 
>> from 1
>> vertex being moved 1 unit.  They're displayed with different colours. 
>> Why?  I'm
>> using version 3.7.0.msvc10-sse2.win32.
>>
>> #version 3.5;
>> #include "colors.inc"
>> global_settings { assumed_gamma 1.0 }
>> background { rgb 0.0500 }
>> light_source { <0, +10000, 0> rgb 1 }
>> #declare Pigment1 = texture { pigment { color rgb < 1 , 0 , 0 > } }
>> #declare Pigment2 = texture { pigment { color rgb < 0 , 1 , 0 > } }
>> polygon
>> {
>>     11,
>>     < 192 , 0 , -126 >
>>     < 152 , 0 ,   23 >
>>     < 145 , 0 ,   53 >
>>     < 124 , 0 ,   77 >
>>     <  96 , 0 ,   88 >
>>     <  65 , 0 ,   84 >
>>     <  50 , 0 ,   79 >
>>     <  50 , 0 ,  126 >
>>     < 200 , 0 ,  126 >
>>     < 200 , 0 , -126 >
>>     < 192 , 0 , -126 >
>>     texture { Pigment1 } interior_texture { Pigment2 }
>> }
>> polygon
>> {
>>     11,
>>     < 392 , 0 , -126 >
>>     < 353 , 0 ,   23 >
>>     < 345 , 0 ,   53 >
>>     < 324 , 0 ,   77 >
>>     < 296 , 0 ,   88 >
>>     < 265 , 0 ,   84 >
>>     < 250 , 0 ,   79 >
>>     < 250 , 0 ,  126 >
>>     < 400 , 0 ,  126 >
>>     < 400 , 0 , -126 >
>>     < 392 , 0 , -126 >
>>     texture { Pigment1 } interior_texture { Pigment2 }
>> }
>> plane
>> {
>>     y, -0.1
>>     pigment
>>     {
>>         checker rgbf <0.6,0.6,0.6, 1.0>, rgbf <1,1,1, 0.6>
>>     }
>>     scale 100
>> }
>> camera
>> {
>>     location < 200 , 8000 , 0 >
>>     right 1.778 * x
>>     angle 6.5000
>>     look_at < 200 , 0 , 0 >
>> }
>
> The surface normal points the other way. A polygon has no real "inside" 
> and at
> the end of the day, "interior_texture" does nothing else but look at the 
> sign of
> the surface normal because in objects with a volume, it is properly 
> defined (in
> POV-Ray anyway) in a consistent way. As there is no way to set the surface
> normal
> of polygons in POV, you might want to try reversing the order of points to
> invert the surface normal.
>
> Either way, it is not a bug.

Is it possible to tell, from the vertices of the polygon, which way the 
surface normal points?


Post a reply to this message

From: Le Forgeron
Subject: Re: polygon rendered incorrectly
Date: 14 Oct 2015 12:26:28
Message: <561e8234$1@news.povray.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Le 13/10/2015 22:51, Chris Hills a écrit :
> "Thorsten Froehlich" <nomail@nomail> wrote in message 
> news:web.55ecab73b62fe087b09a9f90@news.povray.org...
>> "MidiPlay" <ast### [at] yahoocouk> wrote:
>>> I have 2 polygons, they're 200 units apart and they're
>>> identical apart from 1 vertex being moved 1 unit.  They're
>>> displayed with different colours. Why?  I'm using version
>>> 3.7.0.msvc10-sse2.win32.
>>> 
>>> #version 3.5; #include "colors.inc" global_settings {
>>> assumed_gamma 1.0 } background { rgb 0.0500 } light_source {
>>> <0, +10000, 0> rgb 1 } #declare Pigment1 = texture { pigment {
>>> color rgb < 1 , 0 , 0 > } } #declare Pigment2 = texture {
>>> pigment { color rgb < 0 , 1 , 0 > } } polygon { 11, < 192 , 0 ,
>>> -126 > < 152 , 0 ,   23 > < 145 , 0 ,   53 > < 124 , 0 ,   77
>>> > <  96 , 0 ,   88 > <  65 , 0 ,   84 > <  50 , 0 ,   79 > <
>>> 50 , 0 ,  126 > < 200 , 0 ,  126 > < 200 , 0 , -126 > < 192 , 0
>>> , -126 > texture { Pigment1 } interior_texture { Pigment2 } } 
>>> polygon { 11, < 392 , 0 , -126 > < 353 , 0 ,   23 > < 345 , 0 ,
>>> 53 > < 324 , 0 ,   77 > < 296 , 0 ,   88 > < 265 , 0 ,   84 > <
>>> 250 , 0 ,   79 > < 250 , 0 ,  126 > < 400 , 0 ,  126 > < 400 ,
>>> 0 , -126 > < 392 , 0 , -126 > texture { Pigment1 }
>>> interior_texture { Pigment2 } } plane { y, -0.1 pigment { 
>>> checker rgbf <0.6,0.6,0.6, 1.0>, rgbf <1,1,1, 0.6> } scale 100 
>>> } camera { location < 200 , 8000 , 0 > right 1.778 * x angle
>>> 6.5000 look_at < 200 , 0 , 0 > }
>> 
>> The surface normal points the other way. A polygon has no real
>> "inside" and at the end of the day, "interior_texture" does
>> nothing else but look at the sign of the surface normal because
>> in objects with a volume, it is properly defined (in POV-Ray
>> anyway) in a consistent way. As there is no way to set the
>> surface normal of polygons in POV, you might want to try
>> reversing the order of points to invert the surface normal.
>> 
>> Either way, it is not a bug.
> 
> Is it possible to tell, from the vertices of the polygon, which way
> the surface normal points?

polygon in povray are not oriented (per their specification), so the
prediction without looking exactly at the code is at best random.
(and code might change).
The default normal is +z, the first two not-too-small segments
(actually, for points of polygon P1,P2,P3... the not-too-small P2-P1
and P3-P1... which are not co-linear) are used to compute a
transformation from 3D to a fixed 2D plane (as well as a local vector
base, the third vector being the normal). At the end +z got applied
the inverse transformation (for normal) and voila.

So much to state: it is possible to build pathological cases for which
a clockwise or trigonometric ordering might not always provide the
same normal.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iJwEAQEIAAYFAlYegjMACgkQhKAm8mTpkW0IAAP+PzDa6eVU3aBOOl9IHlDg4Or7
BWH2g9AhP30Q+gWMw5i3sRpoeANx6fJEsWeqWH0h8npiOOe7V7QklkCrbXVc7cjf
YlFApzZdDtbyanqdoXCZ6pp7MHujHl1p6jr5W5HQvVrAWwUjydOvOZZGN5joGagF
vuantUnsBZGALRc2Bpk=
=eu/o
-----END PGP SIGNATURE-----


Post a reply to this message

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