POV-Ray : Newsgroups : povray.newusers : Transparent body creates "hole" in my picture Server Time
13 May 2024 23:51:52 EDT (-0400)
  Transparent body creates "hole" in my picture (Message 1 to 4 of 4)  
From: JolanYD
Subject: Transparent body creates "hole" in my picture
Date: 8 Sep 2012 16:30:00
Message: <web.504ba9f656a1714d5adc078b0@news.povray.org>
Hello everyone!

I'm trying to build two cylinders a bit transparent on top of each other (one
blue and the other red). Inside theses cylinders, there is a circular arrow
(again one blue and the other red). I want the red one to be fully transparent
(at the beginning, because the final goal is to make an animation, in which this
red arrow will become not transparent).
On the rendered picture, we can see a kind of "hole" in the red cylinder that is
unwanted. It's like if a part of the red arrow make trouble while rendering and
the transparency of the red cylinder is not uniform.

Here is the code:

#include "colors.inc"
#include "glass.inc"
#include "textures.inc"


#declare epaisseurBL = 6;
#declare epaisseurIL = 6;
#declare epaisseurTL = 16;
#declare linethk =0.1;

#declare camy=145;
#declare camz=170;
#declare offsettxt=50;

#declare vuex= atan2(camy,camz)*180/pi;
#declare vuey= atan2(camz,offsettxt)*180/pi;

camera {
  location<0,0,0>
  look_at <0,0,-1>
  rotate<-2,0,0>
  translate <-18,(epaisseurBL+epaisseurIL+epaisseurTL)/2, 200>
  rotate <-vuex,0,0>
  angle 30
}


global_settings
{
  max_trace_level 9


}

background { color White}
light_source {
    <0, 10, 30>
    color White
    fade_distance 60
    fade_power 2
shadowless

  }
  light_source {
    <0, 10, 30>
    color White
    fade_distance 60
    fade_power 2
shadowless
  }

light_source {
    <20, 10, 0>
    color White
    fade_distance 60
    fade_power 2
shadowless

  }
  light_source {
    <20, 10, 0>
    color White
    fade_distance 60
    fade_power 2
shadowless
  }

light_source {
    <0, 50, 0>
    color White
    fade_distance 60
    fade_power 2
shadowless

 }
  // vert <0.2,1,0>
#declare couleur1 = Blue;
#declare amb = 0.4;
#declare couleur2 = Red;
#declare transmission = 0;
#declare trans1 = 0;
#declare trans2 = 0;
#declare dif = 0.3;
#declare ref = 0;
#declare ang = 70;

#declare refcyl = 0;

#declare epaisseurBL = 10;
#declare epaisseurIL = 4;
#declare epaisseurTL = 10;

#declare FlecheCirculaire = merge{
  difference{

  cylinder {
    <0, -1, 0>,     // Center of one end
    <0, 1, 0>,     // Center of other end
    25            // Radius

  }
  merge{
    cylinder {
      <0, -3, 0>,     // Center of one end
      <0, 3, 0>,     // Center of other end
      20            // Radius

    }
    prism {
      linear_spline
      -2, // sweep the following shape from here ...
      2, // ... up through here
      3, // the number of points making up the shape ...
      < 0, 0>, // point#1 (control point... not on curve)
      <  tan(ang/2*pi/180)*50,50>, // point#2  ... THIS POINT ...
      < - tan(ang/2*pi/180)*50, 50> // point#3

    }
  }

}
prism {
    linear_spline
    -1, // sweep the following shape from here ...
    1, // ... up through here
    3, // the number of points making up the shape ...
    < -4, 0>, // point#1 (control point... not on curve)
    < 4,0>, // point#2  ... THIS POINT ...
    < 0,7> // point#3

    rotate<0,90-ang/2,0>
    translate<-sin(ang/2*pi/180)*22.5,0,cos(ang/2*pi/180)*22.5>
}
cylinder {
      <0, -1, 0>,     // Center of one end
      <0, 1, 0>,     // Center of other end
      2            // Radius

}
}



#declare MTJ =
    merge {
      object { FlecheCirculaire
        scale <0.8,0.65,0.8>
        texture {
        pigment{color couleur1 transmit transmission}
        finish { ambient amb diffuse dif reflection ref }
        }
        translate <trans1,0,0>
        translate <0,epaisseurBL/2,0>
      }

      object { FlecheCirculaire
        scale <0.8,0.65,0.8>
        texture {
        pigment{color couleur2 transmit transmission+1}
        finish { ambient amb diffuse dif reflection ref }
        }
        translate <trans2,0,0>
        translate <0,epaisseurBL+epaisseurIL+epaisseurTL/2,0>
      }
    }
object { MTJ scale <1,1,1>}


//Blue layer

#declare layer1=

cylinder {
      <0, 0, 0>,     // Center of one end
      <0,epaisseurBL, 0>,     // Center of other end
      30            // Radius
      texture {
        pigment{color couleur1 transmit 0.7}
        finish { ambient amb diffuse dif reflection ref }
      }
}



//Insulator layer
#declare layer2=
cylinder {
      <0, epaisseurBL, 0>,     // Center of one end
      <0, epaisseurBL+epaisseurIL, 0>,     // Center of other end
      30            // Radius
      texture {
        pigment{color White transmit 1}
        finish { ambient amb diffuse dif reflection ref }
      }
}



//Red layer

#declare layer3=
cylinder {
      <0, epaisseurBL+epaisseurIL, 0>,     // Center of one end
      <0, epaisseurBL+epaisseurIL+epaisseurTL, 0>,     // Center of other end
      30            // Radius
      texture {
        pigment{color couleur2 transmit 0.7}
        finish { ambient amb diffuse dif reflection ref }
      }
}

object{layer1}
object{layer2}
object{layer3}






If you want to see the red arrow, change the transmit parameter line 159.
I use those rendering parameter in my .ini file:

Width=1024
Height=768
Antialias=On
Sampling_Method=2
Antialias_Threshold=0.01
Antialias_Depth=4


I tried to change the max_trace_level up to 50, increase the Antialias Depth
until 7 and Antialias_Threshold down to 0.001 without success.

I use the 3.6 version of POV-ray.

If you have any idea to solve this problem tell me!

JO


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Transparent body creates "hole" in my picture
Date: 9 Sep 2012 14:41:21
Message: <504ce2d1$1@news.povray.org>
JolanYD wrote:

> On the rendered picture, we can see a kind of "hole" in the red cylinder that is
> unwanted. 

If you are referring to the black bar, it goes away when increasing
max_trace_level to 11. Also note that your stacked cylinders have
coincident surfaces which causes some graininess, add 0.001 to the
y value of the first point in cylinders layer2 and layer3.


Post a reply to this message

From: Alain
Subject: Re: Transparent body creates "hole" in my picture
Date: 9 Sep 2012 14:56:30
Message: <504ce65e$1@news.povray.org>

> Hello everyone!
>
> I'm trying to build two cylinders a bit transparent on top of each other (one
> blue and the other red). Inside theses cylinders, there is a circular arrow
> (again one blue and the other red). I want the red one to be fully transparent
> (at the beginning, because the final goal is to make an animation, in which this
> red arrow will become not transparent).
> On the rendered picture, we can see a kind of "hole" in the red cylinder that is
> unwanted. It's like if a part of the red arrow make trouble while rendering and
> the transparency of the red cylinder is not uniform.
>
> Here is the code:
>
> #include "colors.inc"
Don't include those as you don't use the textures they define.
> //#include "glass.inc"
> //#include "textures.inc"
>
>
> #declare epaisseurBL = 6;
> #declare epaisseurIL = 6;
> #declare epaisseurTL = 16;
> #declare linethk =0.1;
>
> #declare camy=145;
> #declare camz=170;
> #declare offsettxt=50;
>
> #declare vuex= atan2(camy,camz)*180/pi;
> #declare vuey= atan2(camz,offsettxt)*180/pi;
>
> camera {
>    location<0,0,0>
>    look_at <0,0,-1>
>    rotate<-2,0,0>
>    translate <-18,(epaisseurBL+epaisseurIL+epaisseurTL)/2, 200>
>    rotate <-vuex,0,0>
>    angle 30
> }
>
>
> global_settings
> {
>    max_trace_level 9
>
>
> }
>
> background { color White}
> light_source {
>      <0, 10, 30>
>      color White
>      fade_distance 60
>      fade_power 2
> shadowless
>
>    }
>    light_source {
>      <0, 10, 30>
>      color White
>      fade_distance 60
>      fade_power 2
> shadowless
>    }
>
> light_source {
>      <20, 10, 0>
>      color White
>      fade_distance 60
>      fade_power 2
> shadowless
>
>    }
>    light_source {
>      <20, 10, 0>
>      color White
>      fade_distance 60
>      fade_power 2
> shadowless
>    }
>
> light_source {
>      <0, 50, 0>
>      color White
>      fade_distance 60
>      fade_power 2
> shadowless
>
>   }
>    // vert <0.2,1,0>
> #declare couleur1 = Blue;
> #declare amb = 0.4;
> #declare couleur2 = Red;
> #declare transmission = 0;
> #declare trans1 = 0;
> #declare trans2 = 0;
> #declare dif = 0.3;
> #declare ref = 0;
> #declare ang = 70;
>
> #declare refcyl = 0;
>
> #declare epaisseurBL = 10;
> #declare epaisseurIL = 4;
> #declare epaisseurTL = 10;
>
> #declare FlecheCirculaire = merge{
>    difference{
>
>    cylinder {
>      <0, -1, 0>,     // Center of one end
>      <0, 1, 0>,     // Center of other end
>      25            // Radius
>
>    }
Useless merge
>    //merge{
>      cylinder {
>        <0, -3, 0>,     // Center of one end
>        <0, 3, 0>,     // Center of other end
>        20            // Radius
>
>      }
>      prism {
>        linear_spline
>        -2, // sweep the following shape from here ...
>        2, // ... up through here
>        3, // the number of points making up the shape ...
>        < 0, 0>, // point#1
>        <  tan(ang/2*pi/180)*50,50>, // point#2
>        < - tan(ang/2*pi/180)*50, 50> // point#3
>
>      }
>    //}
>
> }
> prism {
>      linear_spline
>      -1, // sweep the following shape from here ...
>      1, // ... up through here
>      3, // the number of points making up the shape ...
>      < -4, 0>, // point#1
>      < 4,0>, // point#2
>      < 0,7> // point#3
>
>      rotate<0,90-ang/2,0>
>      translate<-sin(ang/2*pi/180)*22.5,0,cos(ang/2*pi/180)*22.5>
> }
> cylinder {
>        <0, -1, 0>,     // Center of one end
>        <0, 1, 0>,     // Center of other end
>        2            // Radius
>
> }
> }
>
>
>
> #declare MTJ =
>      merge {
>        object { FlecheCirculaire
>          scale <0.8,0.65,0.8>
>          texture {
>          pigment{color couleur1 transmit transmission}
>          finish { ambient amb diffuse dif reflection ref }
>          }
>          translate <trans1,0,0>
>          translate <0,epaisseurBL/2,0>
>        }
>
>        object { FlecheCirculaire
>          scale <0.8,0.65,0.8>
>          texture {
>          pigment{color couleur2 transmit transmission+1}
Change this line like this:
pigment{color couleur2 transmit 1 -transmission}
Otherwise, you get a transmission value larger than 1 whitch gives 
strange results.

>          finish { ambient amb diffuse dif reflection ref }
>          }
>          translate <trans2,0,0>
>          translate <0,epaisseurBL+epaisseurIL+epaisseurTL/2,0>
>        }
>      }
> object { MTJ scale <1,1,1>}
>
>
> //Blue layer
>
> #declare layer1=
>
> cylinder {
>        <0, 0, 0>,     // Center of one end
>        <0,epaisseurBL, 0>,     // Center of other end
>        30            // Radius
>        texture {
>          pigment{color couleur1 transmit 0.7}
>          finish { ambient amb diffuse dif reflection ref }
>        }
> }
>
>
>
> //Insulator layer
> #declare layer2=
Changes to prevent coincident surfaces...
> cylinder {
>        <0, epaisseurBL, 0>,     // Center of one end
<0, epaisseurBL+0.00001, 0>,
>        <0, epaisseurBL+epaisseurIL, 0>,     // Center of other end
<0, epaisseurBL+epaisseurIL-0.00001, 0>,
>        30            // Radius
>        texture {
>          pigment{color White transmit 1}
>          finish { ambient amb diffuse dif reflection ref }
>        }
> }
>
>
>
> //Red layer
>
> #declare layer3=
> cylinder {
>        <0, epaisseurBL+epaisseurIL, 0>,     // Center of one end
>        <0, epaisseurBL+epaisseurIL+epaisseurTL, 0>,     // Center of other end
>        30            // Radius
>        texture {
>          pigment{color couleur2 transmit 0.7}
>          finish { ambient amb diffuse dif reflection ref }
>        }
> }
>
Your problem is here.
> object{layer1}
> object{layer2}
> object{layer3}
>
You have coincident surfaces.
Redefine your layer objects so that they never overlap and have a very 
small gap between them.
Another solution would be to translate layer 1 slightly up and layer3 
slightly down.

>
>
>
>
>
> If you want to see the red arrow, change the transmit parameter line 159.
> I use those rendering parameter in my .ini file:
>
> Width=1024
> Height=768
> Antialias=On
> Sampling_Method=2
> Antialias_Threshold=0.01
> Antialias_Depth=4
>
>
> I tried to change the max_trace_level up to 50, increase the Antialias Depth
> until 7 and Antialias_Threshold down to 0.001 without success.
>
> I use the 3.6 version of POV-ray.
>
> If you have any idea to solve this problem tell me!
>
> JO
>
>
>
>
>
>


Post a reply to this message

From: JolanYD
Subject: Re: Transparent body creates "hole" in my picture
Date: 11 Sep 2012 07:30:00
Message: <web.504f200259d73b265adc078b0@news.povray.org>
Alain <kua### [at] videotronca> wrote:

> > Hello everyone!
> >
> > I'm trying to build two cylinders a bit transparent on top of each other (one
> > blue and the other red). Inside theses cylinders, there is a circular arrow
> > (again one blue and the other red). I want the red one to be fully transparent
> > (at the beginning, because the final goal is to make an animation, in which this
> > red arrow will become not transparent).
> > On the rendered picture, we can see a kind of "hole" in the red cylinder that is
> > unwanted. It's like if a part of the red arrow make trouble while rendering and
> > the transparency of the red cylinder is not uniform.
> >
> > Here is the code:
> >
> > #include "colors.inc"
> Don't include those as you don't use the textures they define.
> > //#include "glass.inc"
> > //#include "textures.inc"
> >
> >
> > #declare epaisseurBL = 6;
> > #declare epaisseurIL = 6;
> > #declare epaisseurTL = 16;
> > #declare linethk =0.1;
> >
> > #declare camy=145;
> > #declare camz=170;
> > #declare offsettxt=50;
> >
> > #declare vuex= atan2(camy,camz)*180/pi;
> > #declare vuey= atan2(camz,offsettxt)*180/pi;
> >
> > camera {
> >    location<0,0,0>
> >    look_at <0,0,-1>
> >    rotate<-2,0,0>
> >    translate <-18,(epaisseurBL+epaisseurIL+epaisseurTL)/2, 200>
> >    rotate <-vuex,0,0>
> >    angle 30
> > }
> >
> >
> > global_settings
> > {
> >    max_trace_level 9
> >
> >
> > }
> >
> > background { color White}
> > light_source {
> >      <0, 10, 30>
> >      color White
> >      fade_distance 60
> >      fade_power 2
> > shadowless
> >
> >    }
> >    light_source {
> >      <0, 10, 30>
> >      color White
> >      fade_distance 60
> >      fade_power 2
> > shadowless
> >    }
> >
> > light_source {
> >      <20, 10, 0>
> >      color White
> >      fade_distance 60
> >      fade_power 2
> > shadowless
> >
> >    }
> >    light_source {
> >      <20, 10, 0>
> >      color White
> >      fade_distance 60
> >      fade_power 2
> > shadowless
> >    }
> >
> > light_source {
> >      <0, 50, 0>
> >      color White
> >      fade_distance 60
> >      fade_power 2
> > shadowless
> >
> >   }
> >    // vert <0.2,1,0>
> > #declare couleur1 = Blue;
> > #declare amb = 0.4;
> > #declare couleur2 = Red;
> > #declare transmission = 0;
> > #declare trans1 = 0;
> > #declare trans2 = 0;
> > #declare dif = 0.3;
> > #declare ref = 0;
> > #declare ang = 70;
> >
> > #declare refcyl = 0;
> >
> > #declare epaisseurBL = 10;
> > #declare epaisseurIL = 4;
> > #declare epaisseurTL = 10;
> >
> > #declare FlecheCirculaire = merge{
> >    difference{
> >
> >    cylinder {
> >      <0, -1, 0>,     // Center of one end
> >      <0, 1, 0>,     // Center of other end
> >      25            // Radius
> >
> >    }
> Useless merge
> >    //merge{
> >      cylinder {
> >        <0, -3, 0>,     // Center of one end
> >        <0, 3, 0>,     // Center of other end
> >        20            // Radius
> >
> >      }
> >      prism {
> >        linear_spline
> >        -2, // sweep the following shape from here ...
> >        2, // ... up through here
> >        3, // the number of points making up the shape ...
> >        < 0, 0>, // point#1
> >        <  tan(ang/2*pi/180)*50,50>, // point#2
> >        < - tan(ang/2*pi/180)*50, 50> // point#3
> >
> >      }
> >    //}
> >
> > }
> > prism {
> >      linear_spline
> >      -1, // sweep the following shape from here ...
> >      1, // ... up through here
> >      3, // the number of points making up the shape ...
> >      < -4, 0>, // point#1
> >      < 4,0>, // point#2
> >      < 0,7> // point#3
> >
> >      rotate<0,90-ang/2,0>
> >      translate<-sin(ang/2*pi/180)*22.5,0,cos(ang/2*pi/180)*22.5>
> > }
> > cylinder {
> >        <0, -1, 0>,     // Center of one end
> >        <0, 1, 0>,     // Center of other end
> >        2            // Radius
> >
> > }
> > }
> >
> >
> >
> > #declare MTJ =
> >      merge {
> >        object { FlecheCirculaire
> >          scale <0.8,0.65,0.8>
> >          texture {
> >          pigment{color couleur1 transmit transmission}
> >          finish { ambient amb diffuse dif reflection ref }
> >          }
> >          translate <trans1,0,0>
> >          translate <0,epaisseurBL/2,0>
> >        }
> >
> >        object { FlecheCirculaire
> >          scale <0.8,0.65,0.8>
> >          texture {
> >          pigment{color couleur2 transmit transmission+1}
> Change this line like this:
> pigment{color couleur2 transmit 1 -transmission}
> Otherwise, you get a transmission value larger than 1 whitch gives
> strange results.
>
> >          finish { ambient amb diffuse dif reflection ref }
> >          }
> >          translate <trans2,0,0>
> >          translate <0,epaisseurBL+epaisseurIL+epaisseurTL/2,0>
> >        }
> >      }
> > object { MTJ scale <1,1,1>}
> >
> >
> > //Blue layer
> >
> > #declare layer1=
> >
> > cylinder {
> >        <0, 0, 0>,     // Center of one end
> >        <0,epaisseurBL, 0>,     // Center of other end
> >        30            // Radius
> >        texture {
> >          pigment{color couleur1 transmit 0.7}
> >          finish { ambient amb diffuse dif reflection ref }
> >        }
> > }
> >
> >
> >
> > //Insulator layer
> > #declare layer2=
> Changes to prevent coincident surfaces...
> > cylinder {
> >        <0, epaisseurBL, 0>,     // Center of one end
> <0, epaisseurBL+0.00001, 0>,
> >        <0, epaisseurBL+epaisseurIL, 0>,     // Center of other end
> <0, epaisseurBL+epaisseurIL-0.00001, 0>,
> >        30            // Radius
> >        texture {
> >          pigment{color White transmit 1}
> >          finish { ambient amb diffuse dif reflection ref }
> >        }
> > }
> >
> >
> >
> > //Red layer
> >
> > #declare layer3=
> > cylinder {
> >        <0, epaisseurBL+epaisseurIL, 0>,     // Center of one end
> >        <0, epaisseurBL+epaisseurIL+epaisseurTL, 0>,     // Center of other end
> >        30            // Radius
> >        texture {
> >          pigment{color couleur2 transmit 0.7}
> >          finish { ambient amb diffuse dif reflection ref }
> >        }
> > }
> >
> Your problem is here.
> > object{layer1}
> > object{layer2}
> > object{layer3}
> >
> You have coincident surfaces.
> Redefine your layer objects so that they never overlap and have a very
> small gap between them.
> Another solution would be to translate layer 1 slightly up and layer3
> slightly down.
>
> >
> >
> >
> >
> >
> > If you want to see the red arrow, change the transmit parameter line 159.
> > I use those rendering parameter in my .ini file:
> >
> > Width=1024
> > Height=768
> > Antialias=On
> > Sampling_Method=2
> > Antialias_Threshold=0.01
> > Antialias_Depth=4
> >
> >
> > I tried to change the max_trace_level up to 50, increase the Antialias Depth
> > until 7 and Antialias_Threshold down to 0.001 without success.
> >
> > I use the 3.6 version of POV-ray.
> >
> > If you have any idea to solve this problem tell me!
> >
> > JO
> >
> >
> >
> >
> >
> >

Hello,

thanks for your reply. I've corrected my code with your advices and it works
well! I already know a bit about this coincident surface problem but I forgot to
check it on my code, and that was the problem! Thanks a lot!

Regards,

Yvan


Post a reply to this message

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