POV-Ray : Newsgroups : povray.newusers : Bobby hat : Re: Bobby hat Server Time
29 Jul 2024 02:21:43 EDT (-0400)
  Re: Bobby hat  
From: Tek
Date: 13 Nov 2006 10:11:48
Message: <45588b34$1@news.povray.org>
I'm not sure I understand what that's supposed to do, but I'll have a go at 
fixing it. I think the ranges of your numbers are wrong, is this more the 
effect you were after?

height_field  {
  function  100, 100 {
  // pattern { waves scale .1 }
  .5+.5*cos(2*pi*ndist(x*2-1,y*2-1))
  }
  pigment { DarkOrchid }
  translate -.5
  scale <2, .5, 2>
  }

What I've done is change x & y to (x*2-1,y*2-1), so they go from -1 to 1 
(heightfields use 0 to 1) and change the output so it's between 0 and 1 
(.5+.5*cos), your original function was outputting values between 0 and 2 
(1+cos) so when it went above 1 it wrapped round to zero again, hence a 
sharp change.

Hope that helps :)
-- 
Tek
http://evilsuperbrain.com

"Kari Ojala" <kar### [at] ikifi> wrote in message 
news:Xns9878BC4562324kariojalaikifi@203.29.75.35...
>
> I'm trying to do the bobby hat -thing and my functions give extraneous
> sharp edges. The following script  has commented out the kind of thing I'm
> looking for (made with a pattern) and the problematic line uncommented.
>
>
> #include "colors.inc"
>
> global_settings {assumed_gamma 2.4 }
>
> plane {
>  y, -1.8
>  pigment { checker DarkTan DarkOliveGreen }
>  }
>
> light_source { <5, 14, -8> color White }
>
> camera {
>  location <0, 0, -4>
>  look_at 0 angle 46
>  rotate x*7 rotate y*6 }
>
> #declare ndist = function (x,y) {
>  sqrt(pow(x,2)+pow(y,2))/sqrt(2)
>  }
>
> height_field  {
>  function  100, 100 {
>  // pattern { waves scale .1 }
>  1+cos(2*pi*ndist(x,y))
>  }
>  pigment { DarkOrchid }
>  translate -.5
>  scale <2, .5, 2>
>  }
>
>


Post a reply to this message

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