POV-Ray : Newsgroups : povray.text.scene-files : Source code for "Iso-Cubism" Server Time
5 Jul 2024 10:28:34 EDT (-0400)
  Source code for "Iso-Cubism" (Message 1 to 2 of 2)  
From: Tor Olav Kristensen
Subject: Source code for "Iso-Cubism"
Date: 22 Jan 2001 20:53:41
Message: <3A6CE3E9.6604706A@online.no>
I have been asked for the source code for the "Iso-Cubism" image 
that I posted 26. November 2000 to povray.binaries.images.

news://news.povray.org/3A21093C.4D45881A%40online.no


So here it is. (Requires MegaPOV)

-- 
Best regards,

Tor Olav


// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Copyright 2000 by Tor Olav Kristensen
// mailto:tor### [at] hotmailcom
// http://www.crosswinds.net/~tok/tokrays.html
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#version unofficial MegaPov 0.5;

#include "colors.inc"

global_settings { ambient_light color White }

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

$ Xspacing = 4;
$ Yspacing = 4;
$ Zspacing = 4;

$ Xnr = 40;
$ Ynr = 40;
$ Znr = 40;

$ XmodFunction = function { x % Xspacing - if(x, 1, -1)*Xspacing/2 } 
$ YmodFunction = function { y % Yspacing - if(y, 1, -1)*Yspacing/2 } 
$ ZmodFunction = function { z % Zspacing - if(z, 1, -1)*Zspacing/2 } 
//$ XdivFunction = function { x - XmodFunction(x, y, z) } 
//$ YdivFunction = function { y - YmodFunction(x, y, z) }
//$ ZdivFunction = function { z - ZmodFunction(x, y, z) } 

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

$ E = 6;
$ AA = 0.2;

$ F = 10;
$ BB = 0.6;

$ Thr = 1/10^5;

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

$ Xbars =
function { 
  (YmodFunction(x, y, z)^E + ZmodFunction(x, y, z)^E)^(1/E) - AA
}


$ Ybars =
function {
  (XmodFunction(x, y, z)^E + ZmodFunction(x, y, z)^E)^(1/E) - AA
}


$ Zbars =
function {
  (XmodFunction(x, y, z)^E + YmodFunction(x, y, z)^E)^(1/E) - AA
}


$ Cubes =
function {
  (
    XmodFunction(x, y, z)^F
   +YmodFunction(x, y, z)^F
   +ZmodFunction(x, y, z)^F
  )^(1/F) - BB 
}


$ Grid =
isosurface {
  function {
     1
    +Thr
    -Thr^Xbars(x ,y ,z)
    -Thr^Ybars(x ,y ,z)
    -Thr^Zbars(x ,y ,z)
    -Thr^Cubes(x ,y ,z)
    -(0.5 - noise3d(10*x, 10*y, 10*z))/4
  }
  max_gradient 15
  method 2
  contained_by {
    box {
      -<Xnr, Ynr, Znr>*<Xspacing, Yspacing, Zspacing>,
       <Xnr, Ynr, Znr>*<Xspacing, Yspacing, Zspacing>
    }
  }
}


object {
  Grid
  pigment { color White }
  no_shadow
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

light_source {
  10*<-3, 2, 2>
  color White + Blue
  fade_distance 40
  fade_power 10
}

$ RR = seed(314);

$ Cnt = 0;
#while (Cnt < 20)
  light_source {
    25*(<1, 1, 1>/2 - <rand(RR), rand(RR), rand(RR)>) + 12*<1, 0, 1>
    color Red
    fade_distance 3
    fade_power 5
  }
  $ Cnt = Cnt + 1;
#end // while

camera {
  location <Xspacing, Yspacing, Zspacing>*<-1.0, 0.9, -1.3>
  look_at  <Xspacing, Yspacing, Zspacing>*<-0.2, 0.5, -0.5>
  angle 80
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Source code for "Iso-Cubism"
Date: 26 May 2002 07:31:10
Message: <3CF0C6B8.2C438A65@hotmail.com>
Tor Olav Kristensen wrote:
> 
> I have been asked for the source code for the "Iso-Cubism" image
> that I posted 26. November 2000 to povray.binaries.images.
> 
> news://news.povray.org/3A21093C.4D45881A%40online.no
> 
> So here it is. (Requires MegaPOV)
>...

And below is a version for POV-Ray v3.5.
(It also contains some minor optimizations.)


Tor Olav


// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Copyright 2002 by Tor Olav Kristensen
// Email: t o r _ o l a v _ k [ a t ] h o t m a i l . c o m
// http://hjem.sol.no/t-o-k/povray
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#version 3.5;

#include "colors.inc"

global_settings { ambient_light color White }

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#declare Xspc = 4;
#declare Yspc = 4;
#declare Zspc = 4;

#declare HalfXspc = Xspc/2;
#declare HalfYspc = Yspc/2;
#declare HalfZspc = Zspc/2;

#declare XFn =
  function(x) { mod(x, Xspc) - select(x, -HalfXspc, 0, HalfXspc) }

#declare YFn =
  function(y) { mod(y, Yspc) - select(y, -HalfYspc, 0, HalfYspc) }

#declare ZFn =
  function(z) { mod(z, Zspc) - select(z, -HalfZspc, 0, HalfZspc) }

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#declare E = 6;
#declare AA = 0.2;

#declare F = 10;
#declare BB = 0.6;

#declare XbarsFn =
  function { (           YFn(y)^E + ZFn(z)^E)^(1/E) - AA }

#declare YbarsFn =
  function { (XFn(x)^E            + ZFn(z)^E)^(1/E) - AA }

#declare ZbarsFn =
  function { (XFn(x)^E + YFn(y)^E           )^(1/E) - AA }

#declare CubesFn =
  function { (XFn(x)^F + YFn(y)^F + ZFn(z)^F)^(1/F) - BB }

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#declare Thr = 1E-5;

#declare Xnr = 40;
#declare Ynr = 40;
#declare Znr = 40;

isosurface {
  function {
     1
    +Thr
    -Thr^XbarsFn(x ,y ,z)
    -Thr^YbarsFn(x ,y ,z)
    -Thr^ZbarsFn(x ,y ,z)
    -Thr^CubesFn(x ,y ,z)
    -(0.5 - f_noise3d(10*x, 10*y, 10*z))/4
  }
  max_gradient 15 // Can probably be lowered some
//  accuracy 1E-5
  contained_by {
    box {
      -<Xnr, Ynr, Znr>*<Xspc, Yspc, Zspc>,
       <Xnr, Ynr, Znr>*<Xspc, Yspc, Zspc>
    }
  }
  pigment { color White }
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

light_source {
  10*<-3, 2, 2>
  color White + Blue
  fade_distance 40
  fade_power 10
  shadowless
}

#declare RR = seed(314);

#declare Cnt = 0;
#while (Cnt < 20)
  light_source {
    25*(<1, 1, 1>/2 - <rand(RR), rand(RR), rand(RR)>) + 12*<1, 0, 1>
    color Red
    fade_distance 3
    fade_power 5
  }
  #declare Cnt = Cnt + 1;
#end // while

camera {
  location <Xspc, Yspc, Zspc>*<-1.0, 0.9, -1.3>
  look_at  <Xspc, Yspc, Zspc>*<-0.2, 0.5, -0.5>
  angle 80
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7


Post a reply to this message

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