POV-Ray : Newsgroups : povray.general : deformed box : Re: deformed box Server Time
30 Jul 2024 22:20:13 EDT (-0400)
  Re: deformed box  
From: Maxime Marrow
Date: 31 Mar 2008 10:27:47
Message: <47f102f3@news.povray.org>
RafaƂ Maj wrote:
> Hello,
> 
> does anyone have some quick working code to create like
> box { -1000, +1000 }
> but deformed a bit?
> 
> Perhaps a mesh, or set of 6 highfields with function() making the "texture".
> 
> Camera will be placed inside the box btw.
> 
> In general, it is aimed to represent a simple living room.

#include "functions.inc"
global_settings { max_trace_level 20 }

background{1}

camera {
    location  2
    look_at   0
}

#local p = 2;
#local k = 0.6;

#local s = function { abs(abs(x + y) + abs(x - y) + z + z) + abs(abs(x + 
y) + abs(x - y) - z - z) - 4 }

#local d1 = function { x + k*f_noise3d(p*x, p*y, p*z) }
#local d2 = function { y + k*f_noise3d(100 + p*x, 100 + p*y, 100 + p*z) }
#local d3 = function { z + k*f_noise3d(200 + p*x, 200 + p*y, 200 + p*z) }

isosurface{
  function { s(d1(x, y, z), d2(x, y, z), d3(x, y, z)) }
  contained_by { box{ -1.1, 1.1 } }
  max_gradient 7

  pigment{rgb 0.7} finish{reflection{0, 1} diffuse 1 ambient 0}
}

This scene renders for about 22 seconds on my computer in 640x480 
resolution without anti-aliasing, which is pretty quick for me. If you 
want lower/higher bumps adjust k. If you want more/less bumps adjust p.

Maxime


Post a reply to this message

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