|
|
Wow, that's a clever trick :)
Is it possible to rig up a function to use several slope maps (one on each axis)
to get the surface normal? That way it could work on non-isosurfaces.
Something like:
(x-x0)*slope_x(x,y,z) + (y-y0)*slope_y(x,y,z) + (z-z0)*slope_z(x,y,z)
Would that work?
I'd try it myself only it's getting kinda late...
--
Tek
http://www.evilsuperbrain.com
"Tor Olav Kristensen" <tor### [at] hotmailcom> wrote in message
news:web.3edf86e32428076b417814a0@news.povray.org...
>
> Some minutes ago I posted an image to povray.binaries.images.
> Here's the source code for that image.
>
> Tor Olav
>
>
> // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
> // Copyright 2003 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 "functions.inc" // For f_r() and f_torus
> #include "textures.inc"
> #include "glass.inc"
>
> // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
> // Macro to build "Angle Of Incidence" functions
>
> #macro AOI_Function(Fn, p0)
>
> #local x0 = p0.x;
> #local y0 = p0.y;
> #local z0 = p0.z;
> #local h = 1e-4;
> #local h2 = h*2;
>
> #local Temp0Fn =
> function(GradX, GradY, GradZ, DirX, DirY, DirZ, Div) {
> abs(GradX*DirX + GradY*DirY + GradZ*DirZ)/Div
> }
> #local Temp1Fn =
> function(GradX, GradY, GradZ, DirX, DirY, DirZ) {
> Temp0Fn(
> GradX, GradY, GradZ,
> DirX, DirY, DirZ,
> f_r(GradX, GradY, GradZ)*f_r(DirX, DirY, DirZ)
> )
> }
>
> function {
> Temp1Fn(
> (Fn(x + h, y, z) - Fn(x - h, y, z))/h2,
> (Fn(x, y + h, z) - Fn(x, y - h, z))/h2,
> (Fn(x, y, z + h) - Fn(x, y, z - h))/h2,
> x - x0,
> y - y0,
> z - z0
> )
> }
>
> #end // macro AOI_Function
>
> // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
>
> #declare pCameraLocation = <0.0, 3.4, -5.1>;
> #declare pCameraLookAt = <0.0, -2.6, 0.0>;
>
> camera {
> location pCameraLocation
> look_at pCameraLookAt
> angle 100
> }
>
> light_source {
> <-4, 2, -1>*10
> color rgb <1, 1, 1>
> }
>
> sky_sphere {
> pigment {
> gradient y
> turbulence 0.1
> color_map {
> [ 0.0 color rgb <1.5, 1.5, 1.5> ]
> [ 0.4 color rgb <0.0, 0.0, 0.5> ]
> [ 0.6 color rgb <0.0, 0.0, 0.5> ]
> [ 1.0 color rgb <1.5, 1.5, 1.5> ]
> }
> }
> }
>
> // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
> // Isosurface with "Angle Of Incidence" controlled texture
>
> #declare Rmaj = 4;
> #declare Rmin = 1;
>
> #declare TorusFn = function { f_torus(x, y, z, Rmaj, Rmin) }
>
> #declare GlassMaterial =
> material {
> texture {
> AOI_Function(TorusFn, pCameraLocation)
> texture_map {
> [ 0 Orange_Glass ]
> [ 1 Vicks_Bottle_Glass ]
> }
> }
> interior { I_Glass }
> }
>
> /*
> #declare SimpleMaterial =
> material {
> texture {
> AOI_Function(TorusFn, pCameraLocation)
> texture_map {
> [ 0.0 pigment { color rgbt <1.5, 0.0, 0.0, 0.0> } ]
> [ 1.0 pigment { color rgbt <0.0, 1.5, 0.0, 0.0> } ]
> }
> }
> }
> */
>
> #declare pMin = -<Rmaj + Rmin, Rmin, Rmaj + Rmin>;
> #declare pMax = <Rmaj + Rmin, Rmin, Rmaj + Rmin>;
>
> isosurface {
> function { TorusFn(x, y, z) }
> contained_by { box { pMin, pMax } }
> material { GlassMaterial }
> // material { SimpleMaterial }
> }
>
> // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
>
>
Post a reply to this message
|
|