POV-Ray : Newsgroups : povray.binaries.images : Suggestions needed : Re: Suggestions needed Server Time
2 Nov 2024 18:48:51 EDT (-0400)
  Re: Suggestions needed  
From: Kenneth
Date: 27 Apr 2010 04:50:00
Message: <web.4bd6a2b55bb1be65ae92d9930@news.povray.org>
"Dave Blandston" <nomail@nomail> wrote:

> Currently I'm working on a CSG model of an Mk 2 hand grenade. So far the top
> part is finished except for the spoon. I'm having a hard time figuring out how
> to construct the actual body of the grenade, though. Does anybody have any
> suggestions?

Would a triangle-mesh object made with POV's HF_Sphere macro qualify as 'SDL'?

Here's a basic idea, some code I came up with (and an image.) It's one way to do
it; there are probably others. Just add a camera and some lights. The code's not
perfect by any means, but it does create that 'pineapple' look. BTW, I could
have used 'pattern' rather than 'pigment' to generate the functions (to do away
with the .gray step)--but the two functions need to be combined anyway, before
being used in the macro. (It accepts only one.)

There's still a problem with the model that I haven't yet been able to solve:
Where the vertical and horizontal indent lines meet, there's a deeper indent at
each intersection. (Or rather, the non-overlapping parts of the lines are raised
farther upward than the intersections.) They *should* all be at the same depth.
Seems there's an odd 'bias' somewhere--probably a result of the pigment values I
used. I just *know* there's a way around this little conundrum. (I may have
solved it years ago, but I can't remember how; I'll have to look back over some
of my old code.)

There are two things that you should definitely play around with, to see the
interesting effect: The HF's resolution, and adding/not adding 'smooth' to it.
The lower the resolution, the more 'slanted' the pineapple chunks become. (It's
a consequence of the rez not being high enough to actually reproduce the
indents' pigment functions.) In this case, it's quite useful!

Ken
--------
#include "shapes.inc"

sky_sphere{pigment{color rgb .7*<.8,.9,1>}}

plane{y,0 pigment{color rgb .8}}

#declare vertical_pigment_function =
function{
 pigment{
  gradient x scale .090
  color_map{
   [0.0 rgb 1]
   [0.75 rgb 1]
   [0.75 rgb 0]
   [1.0 rgb 0]
   }
  warp{spherical orientation y dist_exp 0}
  }
 }

#declare horizontal_pigment_function =
function{
 pigment{
  gradient y scale .10
  color_map{
   [0.0 rgb 1]
   [0.8 rgb 1]
   [0.8 rgb 0]
   [1.0 rgb 0]
   }
  warp{spherical orientation z dist_exp 0}
  }
 }

#declare final_function =
function{
vertical_pigment_function(x,y,z).gray*.5
+ horizontal_pigment_function(x,y,z).gray*.5
        }

// Just to show what the values represent...
//HF_Sphere(
//     Function,
//       UseUVheight,
//         UseUVtexture,
//           Res,
//             Smooth,
//               FileName,
//                 Center,
//                   Radius,
//                     Depth)

object{
HF_Sphere(final_function,0,0,<110,110>,0,"",0,1,.13)
 pigment{color rgb <.5,1,.5>}
 //double_illuminate
 scale <1,1.4,1>
 rotate -5*y
 translate 1.5*y
 }


Post a reply to this message

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