POV-Ray : Newsgroups : povray.advanced-users : triangle with smooth trasparency Server Time
27 Dec 2024 23:25:36 EST (-0500)
  triangle with smooth trasparency (Message 1 to 4 of 4)  
From: Gianluca Massaccesi
Subject: triangle with smooth trasparency
Date: 7 Jun 2004 14:05:46
Message: <40c4ae7a@news.povray.org>
Here below there is a sample. It model a square subdivided in 8 triangles.
By assigning a texture in each vertex the trasparency should be smooth. On
the contrary you can see that each trangle has its own value, there is
discontinuity between triangles.

Could you tell me why? In my opinion it is due to the very little dimension
of the triangles. Could it be correct as I cannot increase the dimension of
triangles?

Thank you very much for your help.

**************************

camera {
    location <0,-2,1.5>
     look_at <0,98,1.5>
     up    <0,0,1>
     right -x *1.3333
     angle 20
  }

#declare texture_screen = texture {
   pigment { color rgb<1,1,1> }
   finish { ambient 0 diffuse 2 }
 }
//EndTextures

//screen

#declare dist=25 ;

#declare nAng=6;
#declare Ang=radians(5);
#declare AngMax=nAng*Ang;
#declare lScreen=dist*tan(AngMax) ;

polygon {
        4,
        <lScreen, lScreen>, <-lScreen, lScreen>, <-lScreen, -lScreen>,
<lScreen, -lScreen>
        texture { texture_screen }
        rotate <90,0,0>
        translate <0, dist, 0>
        }

light_source {<0,0,0>,rgb 0.2
spotlight
point_at <0, 100, 0>
radius 80
falloff 80
fade_distance 25
fade_power 2
}

// angH(i)=91,25// angV(j)=88,75
#declare texture_1 = texture { pigment {color rgb 0 transmit 1.5625 }}
#declare texture_2 = texture { pigment {color rgb 0 transmit 1.7656 }}
#declare texture_3 = texture { pigment {color rgb 0 transmit 1.5469 }}
#declare texture_4 = texture { pigment {color rgb 0 transmit 1.3906 }}
#declare texture_5 = texture { pigment {color rgb 0 transmit 1.5469 }}
#declare texture_6 = texture { pigment {color rgb 0 transmit 1.6562 }}
#declare texture_7 = texture { pigment {color rgb 0 transmit 1.4688 }}
#declare texture_8 = texture { pigment {color rgb 0 transmit 1.4688 }}
#declare texture_9 = texture { pigment {color rgb 0 transmit 1.6562 }}
mesh {
   triangle
{<0.0065,0.2999,-0.0065>,<0.0033,0.3,-0.0033>,<0.0065,0.2999,-0.0033>
texture_list { texture_1  texture_2  texture_6 } }
   triangle
{<0.0065,0.2999,-0.0065>,<0.0033,0.2999,-0.0065>,<0.0033,0.3,-0.0033>
texture_list { texture_1  texture_9  texture_2 } }
   triangle
{<0.0065,0.2999,-0.0065>,<0.0065,0.2999,-0.0033>,<0.0098,0.2998,-0.0033>
texture_list { texture_1  texture_6  texture_3 } }
   triangle
{<0.0065,0.2999,-0.0065>,<0.0098,0.2998,-0.0033>,<0.0098,0.2998,-0.0065>
texture_list { texture_1  texture_3  texture_7 } }
   triangle
{<0.0065,0.2999,-0.0065>,<0.0098,0.2998,-0.0065>,<0.0098,0.2997,-0.0098>
texture_list { texture_1  texture_7  texture_4 } }
   triangle
{<0.0065,0.2999,-0.0065>,<0.0098,0.2997,-0.0098>,<0.0065,0.2998,-0.0098>
texture_list { texture_1  texture_4  texture_8 } }
   triangle
{<0.0065,0.2999,-0.0065>,<0.0065,0.2998,-0.0098>,<0.0033,0.2998,-0.0098>
texture_list { texture_1  texture_8  texture_5 } }
   triangle
{<0.0065,0.2999,-0.0065>,<0.0033,0.2998,-0.0098>,<0.0033,0.2999,-0.0065>
texture_list { texture_1  texture_5  texture_9 } }
   }

*********************************************************************


Post a reply to this message

From: Hughes, B 
Subject: Re: triangle with smooth trasparency
Date: 7 Jun 2004 21:45:58
Message: <40c51a56$1@news.povray.org>
"Gianluca Massaccesi" <gia### [at] tinit> wrote in message
news:40c4ae7a@news.povray.org...
> Here below there is a sample. It model a square subdivided in 8 triangles.
> By assigning a texture in each vertex the trasparency should be smooth. On
> the contrary you can see that each trangle has its own value, there is
> discontinuity between triangles.
>
> Could you tell me why? In my opinion it is due to the very little
dimension
> of the triangles. Could it be correct as I cannot increase the dimension
of
> triangles?

I must agree, seems to be the small size making it impossible for the smooth
transition of transparency. Something I wouldn't have known, having not
dealt much with meshes. However, it has become somewhat common knowledge
that POV-Ray objects have limitations at such small units of dimension.

In this instance, it would appear that applied pigments and transparency
(possibly normals too) break down when the triangle side lengths go below
about 0.005. I'm not really sure of that nor to what size degenerate
triangles are reported in the warning messages. Scaling the mesh upward, as
a whole, doesn't help-- that I can find anyway. Again, triangle meshes are
not something I know about specifically, just thinking you might be awaiting
some kind of answer sooner rather than later.

So... you could increase the vector numbers together proportionally and
consider your scene scale to be different.

P.S.

Your transmit values, being larger than 1, are not typical, in the natural
sense, and will artificially brighten the background.

Bob H.


Post a reply to this message

From: Hughes, B 
Subject: addendum or afterthought
Date: 7 Jun 2004 22:01:33
Message: <40c51dfd$1@news.povray.org>
BTW, what I said about POV being limited wasn't in the sense that the
program code is at fault, only that the circumstances involving the
number-crunching has limitations. I mention this once again (has been said
many times in the past) because people often think the program itself has
problems instead of there being a finite realm of usability. I guess you
could say it never was made to rescale internally for coping with numbers
ranging from 10,000,000 down through 0.0000001. I have learned to stay out
of the decimals as much as possible, but it hasn't been easy.
:-)

End of obligatory footnote.

Bob H.


Post a reply to this message

From: Slime
Subject: Re: triangle with smooth trasparency
Date: 8 Jun 2004 00:45:09
Message: <40c54455@news.povray.org>
> I must agree, seems to be the small size making it impossible for the
smooth
> transition of transparency.

After experimenting with the scene a bit, I've discovered that if his mesh
is made just three times as large, then the interpolation is smooth, so I
assume this is definitely a size issue.

But what's interesting is what happens when his mesh is made exactly twice
as large. Here's the code I'm using if you want to see for yourself (read
on, more text after code):

// CODE START

#declare scalar = 2;

#declare texture_1 = texture { pigment {color rgb 0 transmit 0 }}
#declare texture_2 = texture { pigment {color rgb 0 transmit 1 }}
#declare texture_3 = texture { pigment {color rgb 0 transmit .5 }}
#declare texture_4 = texture { pigment {color rgb 0 transmit 1 }}
#declare texture_5 = texture { pigment {color rgb 0 transmit 1 }}
#declare texture_6 = texture { pigment {color rgb 0 transmit .5 }}
#declare texture_7 = texture { pigment {color rgb 0 transmit 0 }}
#declare texture_8 = texture { pigment {color rgb 0 transmit 0 }}
#declare texture_9 = texture { pigment {color rgb 0 transmit 1 }}
#declare obj = mesh {
   triangle
{<scalar*0.0065,scalar*0.2999,-scalar*0.0065>,<scalar*0.0033,scalar*0.3,-sca
lar*0.0033>,<scalar*0.0065,scalar*0.2999,-scalar*0.0033>
texture_list { texture_1  texture_2  texture_6 } }
   triangle
{<scalar*0.0065,scalar*0.2999,-scalar*0.0065>,<scalar*0.0033,scalar*0.2999,-
scalar*0.0065>,<scalar*0.0033,scalar*0.3,-scalar*0.0033>
texture_list { texture_1  texture_9  texture_2 } }
   triangle
{<scalar*0.0065,scalar*0.2999,-scalar*0.0065>,<scalar*0.0065,scalar*0.2999,-
scalar*0.0033>,<scalar*0.0098,scalar*0.2998,-scalar*0.0033>
texture_list { texture_1  texture_6  texture_3 } }
   triangle
{<scalar*0.0065,scalar*0.2999,-scalar*0.0065>,<scalar*0.0098,scalar*0.2998,-
scalar*0.0033>,<scalar*0.0098,scalar*0.2998,-scalar*0.0065>
texture_list { texture_1  texture_3  texture_7 } }
   triangle
{<scalar*0.0065,scalar*0.2999,-scalar*0.0065>,<scalar*0.0098,scalar*0.2998,-
scalar*0.0065>,<scalar*0.0098,scalar*0.2997,-scalar*0.0098>
texture_list { texture_1  texture_7  texture_4 } }
   triangle
{<scalar*0.0065,scalar*0.2999,-scalar*0.0065>,<scalar*0.0098,scalar*0.2997,-
scalar*0.0098>,<scalar*0.0065,scalar*0.2998,-scalar*0.0098>
texture_list { texture_1  texture_4  texture_8 } }
   triangle
{<scalar*0.0065,scalar*0.2999,-scalar*0.0065>,<scalar*0.0065,scalar*0.2998,-
scalar*0.0098>,<scalar*0.0033,scalar*0.2998,-scalar*0.0098>
texture_list { texture_1  texture_8  texture_5 } }
   triangle
{<scalar*0.0065,scalar*0.2999,-scalar*0.0065>,<scalar*0.0033,scalar*0.2998,-
scalar*0.0098>,<scalar*0.0033,scalar*0.2999,-scalar*0.0065>
texture_list { texture_1  texture_5  texture_9 } }
   }

object {obj}
camera {
 location (min_extent(obj) + max_extent(obj))/2 + y*0.01*scalar
 look_at (min_extent(obj) + max_extent(obj))/2
}

background {rgb 1}

// CODE END


Modify the "scalar" value at the top to try different sizes.

When the mesh is this size, the transparency is solid only near the vertices
of the triangles. There's definitely some sort of check somewhere, maybe
against an epsilon value. After looking at the source for a while I can't
pin it down. I'd think it'd be either this line

if (Weight_List[i] < ADC_Bailout)

in lighting.cpp (though this should be fine since the sum of
Weight_List[0..2] at this point should be 1) or these lines

  if(a*a<EPSILON) {
    if(b*b<EPSILON) {
      if(c*c<EPSILON) {

in Calculate_Smooth_T() in triangle.cpp. Even that, though, shouldn't be a
problem, since EPSILON is 1e-10 and we're dealing with values which, when
squared, won't be any smaller than 1e-7 or so.

(As a side note, I'd like to point out that there are a lot of values in
Calculate_Smooth_T which are potentially never used. Their calculations
could probably be moved into the if() blocks to optimize.)

Strange results are also obtained when "scalar" is 1000 or 10000; I'm not
sure what the cause of this is.

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


Post a reply to this message

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