POV-Ray : Newsgroups : povray.newusers : Make part of an object transparent : Re: Make part of an object transparent Server Time
2 Jun 2024 14:35:53 EDT (-0400)
  Re: Make part of an object transparent  
From: Stephen
Date: 7 Nov 2012 16:07:13
Message: <509acd81$1@news.povray.org>
On 07/11/2012 7:41 PM, Encore wrote:
> Thanks Steve I really appreciate it. But put animation aside (I'll try and deal
> with this later on), how can I make a fixed part of this object invisible? I
> mean a way is to make a difference as you are saying,

Okay, I did make an attempt and the code is below. But be aware that I 
use a modeller (Bishop3d) and the code is not good Pov-Ray code. (I have 
to put single objects in a union to get the desired effect. Nor is it 
optimised. (machine written code sucks ;-) )

> another is to trace and
> return a transparent value for a specific part of an edge. Do you have any code
> for achieving this in a static state like the one I'm dealing with here?

This I would say is more of a general or advanced topic.

#version 3.6;

background { colour rgb <0.000,0.000,0.000> }

// 
****************************************************************************
// referenced scene items and forced visible scene items declaration begin
// 
****************************************************************************

#declare Default_Texture0 =
texture {
    pigment {
       colour rgbft <1.000,0.000,1.000,0.000,0.000>
    }

    finish {
       ambient     rgb <1.000,1.000,1.000>
       brilliance  1.000
       crand       0.000
       diffuse     0.600
       metallic    0.000
       phong       0.000
       phong_size  40.000
       specular    0.000
       roughness   0.050
    }

}

#default{ texture{ Default_Texture0 } }

#declare Shadow_Clouds_Top =
pigment {
    colour rgbft <0.196,0.600,0.800,0.000,0.000>
}

#declare Shadow_Clouds_Bot =
pigment {
    bozo
    colour_map {
       [0.000 rgbft <0.850,0.850,0.850,0.000,0.000>]
       [0.100 rgbft <0.750,0.750,0.750,0.000,0.000>]
       [0.500 rgbft <1.000,1.000,1.000,0.000,1.000>]
    }

    rotate    <0.0,0.0,90.000>
    rotate    <180.000,0.0,0.0>
    scale     <0.200,1.200,1.200>
    rotate    <-180.000,0.000,-90.000>
    rotate    <0.000,355.000,0.000>
    translate <0.000,-0.150,-0.000>
    turbulence <0.650,0.650,0.650>
    octaves 6
    lambda 2.000
    omega 0.700
}

#declare Shadow_Clouds_Mid =
pigment {
    bozo
    colour_map {
       [0.000 rgbft <0.850,0.850,0.850,0.000,0.000>]
       [0.100 rgbft <0.750,0.750,0.750,0.000,0.000>]
       [0.500 rgbft <1.000,1.000,1.000,0.000,1.000>]
    }

    rotate    <0.0,0.0,90.000>
    rotate    <180.000,0.0,0.0>
    scale     <0.200,1.200,1.200>
    rotate    <-180.000,0.000,-90.000>
    rotate    <0.000,355.000,0.000>
    turbulence <0.650,0.650,0.650>
    octaves 6
    lambda 2.000
    omega 0.700
}

#declare Blue_White_Tiles1 =
texture {
    checker
    texture {
       pigment {
          colour rgbft <1.000,1.000,1.000,0.000,0.000>
       }

       normal {
          agate, 0.100
          agate_turb 0.500
       }

       finish {
          ambient     rgb <0.100,0.100,0.100>
          brilliance  1.000
          crand       0.000
          diffuse     0.600
          metallic    0.000
          phong       0.000
          phong_size  40.000
          specular    0.000
          roughness   0.249
          reflection {
             rgb <0.100,0.100,0.100>, rgb <0.000,0.000,0.000>
             fresnel   0
             falloff   0.000
             exponent  1.000
             metallic  0.000
          }
       }

    }

    texture {
       pigment {
          colour rgbft <0.000,0.502,1.000,0.000,0.000>
       }

       normal {
          agate, 0.100
          agate_turb 0.500
       }

       finish {
          ambient     rgb <0.100,0.100,0.100>
          brilliance  1.000
          crand       0.000
          diffuse     0.600
          metallic    0.000
          phong       0.000
          phong_size  40.000
          specular    0.000
          roughness   0.249
          reflection {
             rgb <0.100,0.100,0.100>, rgb <0.000,0.000,0.000>
             fresnel   0
             falloff   0.000
             exponent  1.000
             metallic  0.000
          }
       }

    }

    rotate    <0.0,0.0,180.000>
    rotate    <-90.000,0.0,0.0>
    scale     <-300.000,-300.000,-1000.000>
    rotate    <90.000,0.000,-180.000>
    rotate    <0.000,-180.000,0.000>
    scale     <0.010,0.010,0.010>
}

#declare Maple =
material{
    texture {
       #declare BISHOP3D_TEMPORARY_IDENTIFIER =
          texture {
             pigment {
                wood
                colour_map {
                   [0.000 rgbft <0.796,0.796,0.384,0.000,0.000>]
                   [0.133 rgbft <0.706,0.518,0.235,0.000,0.000>]
                   [0.230 rgbft <0.796,0.796,0.384,0.000,0.000>]
                   [0.336 rgbft <0.706,0.518,0.235,0.000,0.000>]
                   [0.442 rgbft <0.796,0.796,0.384,0.000,0.000>]
                   [0.549 rgbft <0.706,0.518,0.235,0.000,0.000>]
                   [0.646 rgbft <0.796,0.796,0.384,0.000,0.000>]
                   [0.743 rgbft <0.706,0.518,0.235,0.000,0.000>]
                   [0.850 rgbft <0.796,0.796,0.384,0.000,0.000>]
                   [0.947 rgbft <0.706,0.518,0.235,0.000,0.000>]
                   [1.000 rgbft <0.796,0.796,0.384,0.000,0.000>]
                }

                frequency 1.000
                phase 0.000
                ramp_wave
                noise_generator 1
                rotate    <0.0,0.0,180.000>
                scale     <2.000,2.000,15.000>
                rotate    <0.000,0.000,-180.000>
                rotate    <0.000,0.000,90.000>
                translate <-8.000,80.000,0.000>
                turbulence <0.100,0.100,0.100>
                octaves 6
                lambda 2.000
                omega 0.500
             }

             finish {
                ambient     rgb <0.200,0.200,0.200>
                brilliance  1.000
                crand       0.000
                diffuse     0.800
                metallic    0.000
                phong       0.000
                phong_size  40.000
                specular    0.000
                roughness   0.050
             }

          }
          texture {
             pigment {
                bozo
                colour_map {
                   [0.000 rgbft <1.000,1.000,0.439,1.000,0.000>]
                   [0.008 rgbft <1.000,1.000,0.439,1.000,0.000>]
                   [0.508 rgbft <1.000,1.000,0.439,0.400,0.000>]
                   [1.000 rgbft <1.000,1.000,0.439,1.000,0.000>]
                }

                rotate    <0.0,0.0,180.000>
                scale     <1.500,1.500,0.375>
                rotate    <0.000,0.000,-180.000>
                rotate    <0.000,0.000,90.000>
             }

             finish {
                ambient     rgb <0.200,0.200,0.200>
                brilliance  1.000
                crand       0.000
                diffuse     0.800
                metallic    0.000
                phong       0.000
                phong_size  40.000
                specular    0.000
                roughness   0.050
             }

          }
       ;// the semicolon is necessary or POV-Ray will not figure out 
that the declarations has ended
       BISHOP3D_TEMPORARY_IDENTIFIER
    }

}

#declare Camera0 =
camera {
    perspective
    location <18.112,45.490,-94.622>
    up y
    right 1.333*x
    angle 33.000
    sky <-0.061,0.944,0.325>
    look_at < 0.334, 11.721, -0.011 >
}  // end Camera0

#declare Box5 =
box {
    < -0.5000000, -0.5000000, -0.5000000 >, < 0.5000000, 0.5000000, 
0.5000000 >
    material{ Maple }
    scale     <12.000000,2.000000,2.000000>
}  // end Box5


// 
****************************************************************************
// referenced scene items and forced visible scene items declaration end
// 
****************************************************************************

union {  // Lights
    light_source {  // Shadowless_Light_Source0
       < 0.000000, 0.000000, 0.000000 >, colour rgb <1.000,1.000,1.000>
       fade_power 0.000
       fade_distance 100.000
       media_attenuation off
       media_interaction on
       shadowless
       translate <15.811000,100.000000,-200.977356>
    }  // end Shadowless_Light_Source0

    light_source {  // Light_Source0
       < 0.000000, 0.000000, 0.000000 >, colour rgb <1.000,1.000,1.000>
       fade_power 0.000
       fade_distance 100.000
       media_attenuation off
       media_interaction on
       translate <-24.636320,55.859425,-195.075000>
    }  // end Light_Source0

}  // end Lights

sky_sphere {  // SkySphere1
    pigment{ Shadow_Clouds_Top }
    pigment{ Shadow_Clouds_Mid }
    pigment{ Shadow_Clouds_Bot }

}  // end SkySphere1

plane {  // Plane1
    y , 0
    texture{ Blue_White_Tiles1 }
}  // end Plane1

union {  // Centre_0
    difference {  // CSG12
       union {  // Front0
          union {  // CSG3
             box {  // Box3
                < -0.5000000, -0.5000000, -0.5000000 >, < 0.5000000, 
0.5000000, 0.5000000 >
                material{ Maple }
                scale     <12.000000,2.000000,2.000000>
             }  // end Box3

             rotate    <1.000000,0.000000,90.000000>
             translate <7.000000,0.000000,0.000000>
          }  // end CSG3

          union {  // CSG2
             box {  // Box2
                < -0.5000000, -0.5000000, -0.5000000 >, < 0.5000000, 
0.5000000, 0.5000000 >
                material{ Maple }
                scale     <12.000000,2.000000,2.000000>
             }  // end Box2

             rotate    <1.000000,0.000000,90.000000>
             translate <-7.000000,0.000000,0.000000>
          }  // end CSG2

          union {  // CSG1
             box {  // Box1
                < -0.5000000, -0.5000000, -0.5000000 >, < 0.5000000, 
0.5000000, 0.5000000 >
                material{ Maple }
                scale     <16.000000,2.000000,2.000000>
             }  // end Box1

             translate <0.000000,7.000000,0.000000>
          }  // end CSG1

          union {  // CSG0
             box {  // Box0
                < -0.5000000, -0.5000000, -0.5000000 >, < 0.5000000, 
0.5000000, 0.5000000 >
                material{ Maple }
                scale     <16.000000,2.000000,2.000000>
             }  // end Box0

             translate <0.000000,-7.000000,0.000000>
          }  // end CSG0

          translate <0.000000,0.000000,-7.000000>
       }  // end Front0

       union {  // CSG13
          object {  // Reference0
             Box5
             scale     <1.052000,1.300000,13.719000>
             rotate    <-34.824000,0.000000,90.000000>
             translate <5.262000,1.848000,-7.674000>
          }  // end Reference0

          rotate    <0.000000,-1.223000,0.000000>
          translate <-6.886000,0.000000,7.050000>
       }  // end CSG13

    }  // end CSG12

    union {  // Side1
       union {  // CSG10
          box {  // Box10
             < -0.5000000, -0.5000000, -0.5000000 >, < 0.5000000, 
0.5000000, 0.5000000 >
             material{ Maple }
             scale     <12.000000,2.000000,2.000000>
          }  // end Box10

          rotate    <1.000000,0.000000,90.000000>
          translate <7.000000,0.000000,0.000000>
       }  // end CSG10

       union {  // CSG11
          box {  // Box11
             < -0.5000000, -0.5000000, -0.5000000 >, < 0.5000000, 
0.5000000, 0.5000000 >
             material{ Maple }
             scale     <12.000000,2.000000,2.000000>
          }  // end Box11

          rotate    <1.000000,0.000000,90.000000>
          translate <-7.000000,0.000000,0.000000>
       }  // end CSG11

       rotate    <90.000000,0.000000,0.000000>
       translate <0.000000,7.000000,0.000000>
    }  // end Side1

    union {  // Side0
       union {  // CSG8
          box {  // Box8
             < -0.5000000, -0.5000000, -0.5000000 >, < 0.5000000, 
0.5000000, 0.5000000 >
             material{ Maple }
             scale     <12.000000,2.000000,2.000000>
          }  // end Box8

          rotate    <1.000000,0.000000,90.000000>
          translate <7.000000,0.000000,0.000000>
       }  // end CSG8

       union {  // CSG9
          box {  // Box9
             < -0.5000000, -0.5000000, -0.5000000 >, < 0.5000000, 
0.5000000, 0.5000000 >
             material{ Maple }
             scale     <12.000000,2.000000,2.000000>
          }  // end Box9

          rotate    <1.000000,0.000000,90.000000>
          translate <-7.000000,0.000000,0.000000>
       }  // end CSG9

       rotate    <90.000000,0.000000,0.000000>
       translate <0.000000,-7.000000,0.000000>
    }  // end Side0

    union {  // Back0
       union {  // CSG4
          box {  // Box4
             < -0.5000000, -0.5000000, -0.5000000 >, < 0.5000000, 
0.5000000, 0.5000000 >
             material{ Maple }
             scale     <12.000000,2.000000,2.000000>
          }  // end Box4

          rotate    <1.000000,0.000000,90.000000>
          translate <7.000000,0.000000,0.000000>
       }  // end CSG4

       union {  // CSG5
          object{ Box5 }

          rotate    <1.000000,0.000000,90.000000>
          translate <-7.000000,0.000000,0.000000>
       }  // end CSG5

       union {  // CSG6
          box {  // Box6
             < -0.5000000, -0.5000000, -0.5000000 >, < 0.5000000, 
0.5000000, 0.5000000 >
             material{ Maple }
             scale     <16.000000,2.000000,2.000000>
          }  // end Box6

          translate <0.000000,7.000000,0.000000>
       }  // end CSG6

       union {  // CSG7
          box {  // Box7
             < -0.5000000, -0.5000000, -0.5000000 >, < 0.5000000, 
0.5000000, 0.5000000 >
             material{ Maple }
             scale     <16.000000,2.000000,2.000000>
          }  // end Box7

          translate <0.000000,-7.000000,0.000000>
       }  // end CSG7

       translate <0.000000,0.000000,7.000000>
    }  // end Back0

    rotate    <0.000000,24.200000,0.000000>
    translate <0.000000,8.000000,0.000000>
}  // end Centre_0


camera{ Camera0 }


-- 
Regards
     Stephen


Post a reply to this message

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