POV-Ray : Newsgroups : povray.general : Why the dark triangle? Server Time
31 Jul 2024 12:17:12 EDT (-0400)
  Why the dark triangle? (Message 7 to 16 of 16)  
<<< Previous 6 Messages Goto Initial 10 Messages
From: Warp
Subject: Re: Why the dark triangle?
Date: 11 Aug 2007 03:52:10
Message: <46bd6aa9@news.povray.org>
Tim Attwood <tim### [at] comcastnet> wrote:
> OK, first things first. Your normals in your smooth_triangle
> are not normalized unit lengths, they should be unit length.

  Says who?

  Smooth triangles can have normals of any length. It doesn't matter what
their length is. (AFAIK povray normalizes them internally when it parses
the smooth triangle.)

> Secondly, the normal of your smooth_triangle points away from
> the camera when it's not rotated. We're looking at the "inside",
> the curve cups instead of bulging, it's supposed to be darker in
> cupped spots at some angles. The normals should all point
> outward on an object.

  Why can't a triangle "cup in"? It can be part of a concave surface.
Not all surfaces are convex.

> Third, your normals are all tilted in the same directions, in other
> words, the normals are conveying that this triangle is part
> of a "wrinkle" area, besides just being cupped.
> The normal of a flat triangle ABC can be figured as
> vcross(A-C,B-C). The normal of a point on a smoothed
> section (not on a seam) of a mesh made of smooth_triangles
> should be the average normal of the adjacent triangles.

  "Should be"? Calculating the average of the normal vectors of adjacent
triangles is just one algorithm for automatically smoothing a mesh. It's
in no way the only "correct" way of doing it. It's just one way.
  There's no requirement nor reason for limiting vertex normals to be
the average of the triangle normals of adjacent triangles. The vertex
normals can be calculated in other ways too, for alternative lighting.

-- 
                                                          - Warp


Post a reply to this message

From: Warp
Subject: Re: Why the dark triangle?
Date: 11 Aug 2007 03:54:01
Message: <46bd6b19@news.povray.org>
Shay <shay@s.s> wrote:
> Possibly, but double_illuminate does not correct the problem.

  How about "no_shadow"?

-- 
                                                          - Warp


Post a reply to this message

From: Grassblade
Subject: Re: Why the dark triangle?
Date: 11 Aug 2007 06:25:00
Message: <web.46bd8dc6877f21f6364ceeb90@news.povray.org>
Shay <shay@s.s> wrote:
> camera { location <0,0,-2> look_at <0,0,0> }
> background { rgb <1, 1, 1> }
> light_source { <0,0,-25> rgb 10 shadowless}
>
> #local Ob1 = smooth_triangle {
> <-0.1, 0.5, 0.0>, <0.0, 0.1, 1.0>,
> < 0.1, 0.5, 0.1>, <0.0, 0.1, 1.0>,
> < 0.0, 0.6, 0.0>, <0.0,-0.1, 1.0>
> pigment { rgb <1,0,0> }}
>
> #local c0 = 0; #while ( c0 <= 264 )
>  object { Ob1 rotate <c0/4.0, -c0, 0.0> }
> #local c0 = c0 + 33; #end
>
> Shows several light and one dark triangle on latest Linux version. This
> is just a minimal scene to show the effect; Entire areas of my full
> scene are turning black this way.
>
>  -Shay
I get one dark triangle on Windows version too. If you reduce the light's
rgb to 3 or less you'll see a number of other triangles turning dark. On
the other hand if you shoot it up to 100, the triangle that is currently
dark will have only a small dark zone near one vertex. Moving the light
elsewhere causes other triangles to go dark, so the "problem" is evidently
due to interaction between the light source and smooth triangle normals.
I'm pretty sure everything is working as intended.


Post a reply to this message

From: Tim Attwood
Subject: Re: Why the dark triangle?
Date: 11 Aug 2007 07:06:17
Message: <46bd9829$1@news.povray.org>
> Thank you, but none of this makes a difference. The same thing can
> happen with every normal set to <0,0,-1> ( a flat triangle ). Take a
> look at my "high school math" post in p.b.i and you will see that there
> are shadows which aren't.

A normal of <0,0,-1>  is not flat in this instance, since the
triangle is at a different angle.  It's not enough that the
three normals be the same, they need to match the triangle too.

That said, even a flat triangle will show up dark at some angles,
it's supposed to be that way. The fact that you are using a bright
light increases the falloff of the shading so that many of the triangles
are saturated, and the shaded ones are dark by comparison.


Post a reply to this message

From: Tim Attwood
Subject: Re: Why the dark triangle?
Date: 11 Aug 2007 07:47:42
Message: <46bda1de@news.povray.org>
>  Says who?
>
>  Smooth triangles can have normals of any length. It doesn't matter what
> their length is. (AFAIK povray normalizes them internally when it parses
> the smooth triangle.)

Well, it makes it hard to average them if they are all different
lengths. I guess if you can visualize it better with other numbers
and are doing it by hand it isn't a big deal.

>> Secondly, the normal of your smooth_triangle points away from
>> the camera when it's not rotated. We're looking at the "inside",
>> the curve cups instead of bulging, it's supposed to be darker in
>> cupped spots at some angles. The normals should all point
>> outward on an object.
>
>  Why can't a triangle "cup in"? It can be part of a concave surface.
> Not all surfaces are convex.

There's nothing wrong with it "cupping in", it just makes it
darker at some angles. In the right context that's good.

>> Third, your normals are all tilted in the same directions, in other
>> words, the normals are conveying that this triangle is part
>> of a "wrinkle" area, besides just being cupped.
>> The normal of a flat triangle ABC can be figured as
>> vcross(A-C,B-C). The normal of a point on a smoothed
>> section (not on a seam) of a mesh made of smooth_triangles
>> should be the average normal of the adjacent triangles.
>
>  "Should be"? Calculating the average of the normal vectors of adjacent
> triangles is just one algorithm for automatically smoothing a mesh. It's
> in no way the only "correct" way of doing it. It's just one way.
>  There's no requirement nor reason for limiting vertex normals to be
> the average of the triangle normals of adjacent triangles. The vertex
> normals can be calculated in other ways too, for alternative lighting.

Sure, you can make smooth triangles behave similar to a normal
statement in a texture if you want. Or make crisp edges where you
want them. But however you are doing it, if some triangles have
flipped normals, or are cupped, or wrinkled by much, then at
some angles they'll be dark. The sample triangle was cupped by
about 10 degrees and wrinkled by about 30 degrees.

In general, the cure for bad looking smooth_triangles is to
use more triangles, especially where there are sharp bends.


Post a reply to this message

From: Warp
Subject: Re: Why the dark triangle?
Date: 11 Aug 2007 07:58:52
Message: <46bda47c@news.povray.org>
Tim Attwood <tim### [at] comcastnet> wrote:
> >  Smooth triangles can have normals of any length. It doesn't matter what
> > their length is. (AFAIK povray normalizes them internally when it parses
> > the smooth triangle.)

> Well, it makes it hard to average them if they are all different
> lengths.

  Average them? What average are you talking about?

-- 
                                                          - Warp


Post a reply to this message

From: Tim Attwood
Subject: Re: Why the dark triangle?
Date: 11 Aug 2007 08:02:42
Message: <46bda562@news.povray.org>
> Take a look at my "high school math" post in p.b.i and you will see that 
> there
> are shadows which aren't.

Yeah, I saw that, nice model BTW.

Some of the normals must be flipped?
The dark ones are all near the back.


Post a reply to this message

From: Tim Attwood
Subject: Re: Why the dark triangle?
Date: 11 Aug 2007 08:20:11
Message: <46bda97b$1@news.povray.org>
>> >  Smooth triangles can have normals of any length. It doesn't matter 
>> > what
>> > their length is. (AFAIK povray normalizes them internally when it 
>> > parses
>> > the smooth triangle.)
>
>> Well, it makes it hard to average them if they are all different
>> lengths.
>
>  Average them? What average are you talking about?

Dunno, the numbers would usually come from the faces,
and that's different numbers, doesn't matter much in POV.
It just seems wrong to me to call any vector a normal,
a normal is a direction, so the magnitude doesn't matter,
and hence it should be unit length.  I guess that's just
aethetics though.


Post a reply to this message

From: Warp
Subject: Re: Why the dark triangle?
Date: 11 Aug 2007 10:28:19
Message: <46bdc783@news.povray.org>
Tim Attwood <tim### [at] comcastnet> wrote:
> a normal is a direction, so the magnitude doesn't matter,
> and hence it should be unit length.

  That's a contradictory sentence.

-- 
                                                          - Warp


Post a reply to this message

From: Tim Attwood
Subject: Re: Why the dark triangle?
Date: 11 Aug 2007 19:50:19
Message: <46be4b3b$1@news.povray.org>
>> a normal is a direction, so the magnitude doesn't matter,
>> and hence it should be unit length.
>
>  That's a contradictory sentence.
I guess I should be clearer.

A normal could be expressed as two angles, but
is expressed as an x,y,z vector in POV.  Since vectors
have both length and direction properties, but
normals only need a direction property, one popular
aesthetic is to use unit length vectors to represent normals.

In particular about the dark triangles, if the "wrinkled"
normals are all biased in a certain direction, then when
a triangle is near the "edge" then the supplied normals
may point away from the camera, while the actual
true normal of the triangle is still pointing in the camera
direction. You see the front of the triangle from the
camera, but the normal says you are looking at the
rear of the triangle, and shades dark accordingly.


Post a reply to this message

<<< Previous 6 Messages Goto Initial 10 Messages

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