| 
  | 
I have tried to write the code below in order to show
how one can both add and subtract "blobbed" components
to a iso-surface.
Please try this at home...
- and tell me what you think of it.
Oded proposed to use a sigmoid for "blobbing" of
iso-surfaces in his post 22. Oct. 2001
"iso-surface polyhedra":
http://news.povray.org/povray.binaries.images/18586/
news://news.povray.org/3bace06b%40news.povray.org
(My method also uses a kind of sigmoid function)
Also see this thread (by me 1. Oct. 2001):
"How to transform and blob together iso-shapes in v3.5":
http://news.povray.org/povray.general/18830/
news://news.povray.org/3BB8D35B.BB527254%40hotmail.com
Tor Olav
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Copyright 2001 by Tor Olav Kristensen
// Email: tor### [at] hotmail com
// http://www.crosswinds.net/~tok
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
#version 3.5;
#include "colors.inc"
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Function needed for the "iso-blobbing"
#declare SquashFn =
function(Fn, S) { select(S, -1, 1)*(1/(1 + exp(-abs(S)*Fn)) - 1) }
// Fn is the function for the shape to be "blobbed"
// A negative S-value "subtracts" the shape
// A positive S-value "adds" the shape
// The magnitude of S is the "blobbing" strength
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Simple iso-surface example
#declare CylRad = 3;
#declare SphRad1 = 10;
#declare SphRad2 = 8;
#declare XcylFn = function { sqrt(y^2 + z^2) - CylRad }
#declare YcylFn = function { sqrt(x^2 + z^2) - CylRad }
#declare ZcylFn = function { sqrt(x^2 + y^2) - CylRad }
#declare Sphere1Fn = function { sqrt(x^2 + y^2 + z^2) - SphRad1 }
#declare Sphere2Fn = function { sqrt(x^2 + y^2 + z^2) - SphRad2 }
isosurface {
  function {
    SquashFn(Sphere1Fn(x, y, z), 3) // Add "outer" sphere
   +SquashFn(XcylFn(x, y, z), -10)  // Subtract X-cylinder
   +SquashFn(YcylFn(x, y, z), 2)    // Add Y-cylinder
   +SquashFn(ZcylFn(x, y, z), -3)   // Subtract Z-cylinder
   +SquashFn(Sphere2Fn(x, y, z), 1) // Add "inner" sphere
  }
  max_gradient 4
  threshold -0.5 // Value to use for this kind of blobbing
  contained_by { sphere { <0, 0, 0>, SphRad1 + 6 } }
  pigment { color Blue + White }
}                                     
// Add an "ordinary" Z-cylinder
cylinder {
  -16*z, 16*z, CylRad
  pigment { color Yellow + White }
}
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
background { color (Blue + Cyan)/4 }
light_source {
  <-2, 3, -2>*100
  color White
  shadowless
}
camera {
  location <-1.8, 0, -1>*20
  look_at <0, 0, 0>
}
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
 
 Post a reply to this message 
 | 
  | 
 | 
  | 
this looks really useful ...
but I assume, it won't blob correctly, when using, the inside()-function or
any other, with a strange gradient ...
or am I completely wrong ?
it would just be useful, to blob text-objects and other ones ...
--
Jan Walzer <jan### [at] lzer net>
 
 Post a reply to this message 
 | 
  | 
 | 
  | 
Jan Walzer wrote:
> 
> this looks really useful ...
> but I assume, it won't blob correctly, when using, the inside()-function or
> any other, with a strange gradient ...
> 
> or am I completely wrong ?
> it would just be useful, to blob text-objects and other ones ...
No, unfortunately I think you are completely right.
But Chris Huff once mentioned that there is a 
proximity pattern available in a MegaPOV version
(IIRC).
I have not checked yet what possibilities there
are with this pattern. - If it can return some
kind of distance from an arbitrary point to a
given object, then it might be useful.
Tor Olav
 
 Post a reply to this message 
 | 
  |