POV-Ray : Newsgroups : povray.binaries.animations : Ship decelerating... : Re: Ship decelerating... Server Time
18 Jul 2024 18:31:25 EDT (-0400)
  Re: Ship decelerating...  
From: Rarius
Date: 29 Apr 2004 15:27:54
Message: <4091573a@news.povray.org>
> > Most of the detailing is CSG but the panelling seen as the lights play
> > across the hull are a function based pattern I designed.
>
> VERY nice!
>
> I'm going to assume the function would look best on (fairly) flat disk's,
> correct?

Yes, but there is no reason that the code couldn't be extended to 3D...

Here is the code used to produce the attached picture. By moving the light
sources (not included in this source) you'll see different areas of the
texture catch the light...

I've commented the code slightly to explain what the rnd() and
RadialPanels() functions are doing.

#local tDull=
texture
{
 pigment{colour rgb<.70, .70, .70>}
 finish{phong .125 phong_size 5}
}

#local tShiny=
texture
{
 pigment{colour rgb<.75, .75, .75>}
 finish{phong .875 phong_size 20}
}

//Produce a pseudo-random number based on two parameters.
//It must return the same number each time the same numbers are applied.
#local rnd=function(x, y)
{
 mod(sin(x*5007)+sin(y*673), 919)
}

//Functional pattern.
//Uses rnd() function
//Passes angle and distance from Z axis as parameters.

#local RadialPanels=function(x, y, a, b)
{
 rnd(int(atan2(x, y)/(2*pi)*a)/a, int(sqrt((x*x)+(y*y))*b)/b)
}

#local tHull=
texture
{
 function{RadialPanels(x/12, y/12, 12+(int(sqrt((x*x)+(y*y))/4)*12), 10)}
 texture_map
 {
  [0.0 tDull]
  [1.0 tShiny]
 }
 scale 4
}

cylinder
{
 -z, z, 100
 texture{tHull}
}


Post a reply to this message


Attachments:
Download 'default.jpg' (17 KB)

Preview of image 'default.jpg'
default.jpg


 

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