POV-Ray : Newsgroups : povray.advanced-users : iso-round-cylinder - help? Server Time
1 Nov 2024 03:15:03 EDT (-0400)
  iso-round-cylinder - help? (Message 1 to 3 of 3)  
From: Alf Peake
Subject: iso-round-cylinder - help?
Date: 8 Jan 2003 18:56:09
Message: <3e1cba99@news.povray.org>
Has anyone got an answer to my problem please? Maybe just a typo in
the script?
http://www.peake42.freeserve.co.uk/pix2/iso-wood.jpg  12K
An isosurface rounded cylinder with a wood pigment added.

The torus is visible if the pigment proportion added is more than
around 1/500. I'm using random generated pigments, and was trying to
auto-calculate the proportion added according to the contrast of the
pigment.

Alf

--------------------

// Scene extract

camera{ location <1,1,-0.75>
   angle 10
   look_at <0, 0.15, -0.15>
}
light_source{ <-50,80,-50> 1.2 }

#declare TmpWood =
pigment{ wood sine_wave // Simple demo
   pigment_map{[0 rgb 0.7][1 rgb 0.3]}
}
#declare Fn_Pigm =
function{ pigment{ TmpWood } }

// Isosurface rounded_cylinder along z_axis.
#local Len = 0.2; // Cylinder length/2
#local RodR = 0.2; // Cylinder radius
#local Rmin = 0.03; // Rounding radius
#local Rmaj = RodR-Rmin; // For torus
#local Fn_Tmp = function {sqrt(x*x + z*z) }
#local C_Box = <RodR, RodR, Len>; // Contained_by/2

isosurface {
   function{
      min( // Merge 2*torus and 2*cylinders
         Fn_Tmp( sqrt(x*x + y*y) - Rmaj, y, abs(z) - Len+Rmin ) -
Rmin,
         max(  // Long thin cylinder
            abs(z) - Len,
            sqrt(x*x + y*y) - RodR+Rmin
         ),
         max(  // Short fat cylinder
            abs(z) - Len+Rmin,
            sqrt(x*x + y*y) - RodR
         )
      )
      // Low contrast pigment needed 100 divisor
      + Fn_Pigm(x,y,z).gray/100 // Wood pigment
   }
   contained_by { box { -C_Box, C_Box } }
   max_gradient 1.1
   accuracy 0.0005
   pigment{ rgb 0.8 } finish{ diffuse 0.8 }
}


Post a reply to this message

From: Mike Williams
Subject: Re: iso-round-cylinder - help?
Date: 9 Jan 2003 02:01:13
Message: <LqC1lBAe3RH+EwL+@econym.demon.co.uk>
Wasn't it Alf Peake who wrote:
>Has anyone got an answer to my problem please? Maybe just a typo in
>the script?
>http://www.peake42.freeserve.co.uk/pix2/iso-wood.jpg  12K
>An isosurface rounded cylinder with a wood pigment added.
>
>The torus is visible if the pigment proportion added is more than
>around 1/500. I'm using random generated pigments, and was trying to
>auto-calculate the proportion added according to the contrast of the
>pigment.
>
>Alf


What you'd like to happen is for the pigment bit to be applied to the
whole rounded cylinder as if it were a single object. Unfortunately
mathematics doesn't work like that, and it acts as if it gets applied
separately to the three pieces. (Well, actually it acts as if it gets
applied separately to the five primitive functions). You can see what's
happening if you replace 
  " + Fn_Pigm(x,y,z).gray/100 // Wood pigment "
with
  " + 0.005"
and then with a larger number like
  " + 0.02"

I can't see any simple fix, but the effect is decreased if you use
  " + (Fn_Pigm(x,y,z).gray-0.5)/100 // Wood pigment "
and increase the size of the contained_by box accordingly.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Alf Peake
Subject: Re: iso-round-cylinder - help?
Date: 9 Jan 2003 10:03:25
Message: <3e1d8f3d@news.povray.org>
"Mike Williams" <mik### [at] econymdemoncouk> wrote in message
news:LqC1lBAe3RH+EwL+@econym.demon.co.uk...
>
> I can't see any simple fix, but the effect is decreased if you use
>   " + (Fn_Pigm(x,y,z).gray-0.5)/100 // Wood pigment "
> and increase the size of the contained_by box accordingly.

Thanks for the input Mike. I hadn't tried that. Looks like I'll
probably end up restricting the pigment range though, to avoid the
problem.

Alf


Post a reply to this message

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