POV-Ray : Newsgroups : povray.general : Transparency problem with rolled up plane : Re: Transparency problem with rolled up plane Server Time
30 Jul 2024 02:19:32 EDT (-0400)
  Re: Transparency problem with rolled up plane  
From: Peter Hertel
Date: 21 Jan 2010 10:50:00
Message: <web.4b58767da634737459cfaddb0@news.povray.org>
"Tubemaker" <nomail@nomail> wrote:
> I've a transparency problem with a rolled up plane, which I created by lots of
> very narrow boxes:

I like triangles :-)
As a proof of concept, I threw together a quick example. Please excuse the crude
coding and stupid variable names. Also, it's not a closed mesh, so interior will
not work properly. And some/all of the triangles may be inside out, so making
smooth triangles may need some work.
Enjoy!

-Peter


camera{
        location <5,15,-15> look_at y*3
}

light_source{<5,15,-15>1}

#local Start_Point = 5; // Loop starts on this x-axis and goes towards zero.
#local Thickness = 0.5; // Thickness of the loops
#local SPC = 0.005; // Space between triangles, decrease for more detail (and/or
use smooth triangles)
#local H = y*5; // Height
#local Safety_Measure = 0.001; // For avoiding coincident surfaces
#local Number_Of_Loops = 2; // Increase for more loops

union{ // White loop

#local X = 0;
#while (X<Number_Of_Loops+1) // One more white than blue loop

#local X2 = X+SPC;

        #local P1 = vrotate(<Start_Point          -   X*Thickness*2,0,0>,y*
X*360);
        #local P2 = vrotate(<Start_Point
-(X2)*Thickness*2,0,0>,y*(X2)*360);
        #local P3 = vrotate(<Start_Point-Thickness- (X)*Thickness*2,0,0>,y*
X*360);
        #local P4 =
vrotate(<Start_Point-Thickness-(X2)*Thickness*2,0,0>,y*(X2)*360);

        triangle{P1  ,P2  ,P3  } // Bottom
        triangle{P2  ,P4  ,P3  }
        triangle{P1+H,P2+H,P3+H} // Top
        triangle{P2+H,P4+H,P3+H}
        triangle{P1  ,P1+H,P2  } // Outer
        triangle{P1+H,P2  ,P2+H}
        triangle{P3  ,P3+H,P4  } // Inner
        triangle{P3+H,P4  ,P4+H}

#local X = X+SPC;
#end

pigment {rgb 1 transmit 0.7}
}

union{ // Blue Loop

#local X = 0;
#while (X<Number_Of_Loops)

#local X2 = X+SPC;

        #local P1 = vrotate(<Start_Point-Thickness  -Safety_Measure-
X*Thickness*2,0,0>,y*   X*360);
        #local P2 = vrotate(<Start_Point-Thickness
-Safety_Measure-(X2)*Thickness*2,0,0>,y*(X2)*360);
        #local P3 = vrotate(<Start_Point-Thickness*2+Safety_Measure-
(X)*Thickness*2,0,0>,y*   X*360);
        #local P4 =
vrotate(<Start_Point-Thickness*2+Safety_Measure-(X2)*Thickness*2,0,0>,y*(X2)*360);

        triangle{P1  ,P2  ,P3  } // Bottom
        triangle{P2  ,P4  ,P3  }
        triangle{P1+H,P2+H,P3+H} // Top
        triangle{P2+H,P4+H,P3+H}
        triangle{P1  ,P1+H,P2  } // Outer
        triangle{P1+H,P2  ,P2+H}
        triangle{P3  ,P3+H,P4  } // Inner
        triangle{P3+H,P4  ,P4+H}

#local X = X+SPC;
#end

pigment {rgb z transmit 0.6}
}


Post a reply to this message

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