POV-Ray : Newsgroups : povray.general : Need help generating a cylindrical solid : Re: Need help generating a cylindrical solid Server Time
29 Jul 2024 06:20:53 EDT (-0400)
  Re: Need help generating a cylindrical solid  
From: Chaanakya
Date: 29 Aug 2012 11:45:01
Message: <web.503e384751bfcea0b62e53d00@news.povray.org>
Christian Froeschlin <chr### [at] chrfrde> wrote:
> Chaanakya wrote:
>
> > Looks like I spoke too quickly :P  I found yet another problem :(  Using this
> > method, I can only generate 'layers', so to speak, on the back part of the
> > resulting curved slab (the part that curves away from the viewer).  How do I
> > generate layers throughout the solid?
>
> if you flip your z-plane the same cutting metod should work on the side
> facing the viewer? Alternatively rotating the back part by 180 degrees
> about the y axis gives you the corresponding object due to symmetry.
>
> Of course you might wish to step back and rethink why you are doing
> this. If you simply wish to change the texture depending on position a
> gradient or cylindrical pattern with color_map would be much better.

So the reason I'm doing this is because POV-Ray doesn't support a gradient in
the index of refraction (which is perfectly fine).  I would like to essentially
have a gradient from the center extending outwards.  It shouldn't be hard, but
apparently it's not very easy for me to visualize or something, because it's
just not working.  What I need is a way to create the exact same object, but
from shells (using difference and so forth).  The concept works perfectly well,
but in practice....

If a color map can change the index of refraction, I'm all for it.  But somehow,
I don't think a color map can vary the index of refraction (please correct me if
I'm wrong).  That's why I actually need to 'assemble' the object as opposed to
using a superficial method of coloring.

Now what I'm trying to figure out is why the object won't assemble the way I
assumed it would when I used the following code:

#version 3.6;
#include "colors.inc"

global_settings {
  assumed_gamma 1.0
  ambient_light White
  max_trace_level 256
}

camera {
  location <0,3,3>
  look_at <0,0,0>
}

light_source {
  <100,100,0>
  color White
}

// plane {
//   y, -10
//   pigment { hexagon Green, White, Blue }
// }

// box {
//   -0.5, 0.5
//   pigment { checker Red, Blue }
// }

#declare curved_1 =
  difference {
    cylinder { <-1,0,0>,<1,0,0>,1.5 }
    cylinder { <-1.00003,0,0>,<1.00003,0,0>,1 }
    plane { z,0.9 }
    plane { y,-0.1 }
    plane { -y,-0.1 }
    plane { x,-0.1 }
    plane { -x,-0.1 }
    // rotate <0,90,0>
    // rotate <90,0,0>
  }

#declare curved_2 =
  difference {
    cylinder { <-1,0,0>,<1,0,0>,1.5 }
    cylinder { <-1.00003,0,0>,<1.00003,0,0>,1 }
    plane { z,0.8 }
    plane { y,-0.2 }
    plane { -y,-0.2 }
    plane { x,-0.2 }
    plane { -x,-0.2 }
    // rotate <0,90,0>
    // rotate <90,0,0>
  }

#declare curved_3 =
  difference {
    cylinder { <-1,0,0>,<1,0,0>,1.5 }
    cylinder { <-1.00003,0,0>,<1.00003,0,0>,1 }
    plane { z,0.7 }
    plane { y,-0.3 }
    plane { -y,-0.3 }
    plane { x,-0.3 }
    plane { -x,-0.3 }
    // rotate <0,90,0>
    // rotate <90,0,0>
  }

#declare curved_4 =
  difference {
    cylinder { <-1,0,0>,<1,0,0>,1.5 }
    cylinder { <-1.00003,0,0>,<1.00003,0,0>,1 }
    plane { z,0.6 }
    plane { y,-0.4 }
    plane { -y,-0.4 }
    plane { x,-0.4 }
    plane { -x,-0.4 }
    // rotate <0,90,0>
    // rotate <90,0,0>
  }

object { curved_1 pigment { color Blue } }

difference {
  object { curved_2 }
  object { curved_1 scale 1.000001 }
  pigment {
    color Red
  }
}

difference {
  object { curved_3 }
  object { curved_2 scale 1.00001 }
  pigment {
    color Green
  }
}

difference {
  object { curved_4 }
  object { curved_3 scale 1.00001 }
  pigment {
    color Yellow
  }
}

As opposed to the different colors being shown throughout the object, I am only
seeing the different 'shells' on one side of the object, which is quite weird.
As far as I can see, from this code, it should be 'building up' the object with
different colored shells.  I stress again that the final objective is not
colors, but indices of refraction.  I'm just using colors right now because it's
easy to see the different layers.

Thanks in advance!

- Chaanakya


Post a reply to this message

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