POV-Ray : Newsgroups : povray.pov4.discussion.general : Feature Request: Parallax Mapping : Re: Feature Request: Parallax Mapping Server Time
25 Feb 2024 08:01:28 EST (-0500)
  Re: Feature Request: Parallax Mapping  
From: Zeger Knaepen
Date: 28 Aug 2009 12:08:42
Message: <4a98010a$1@news.povray.org>
"Chambers" <Ben### [at] gmailcom> wrote in message 
news:4a97976f@news.povray.org...
> Doesn't Megapov have an angle of incidence pattern that could prove useful 
> for this?

I've seen parallax mapping in MegaPOV, should still be online somewhere...

can't find it, but I still had it on my harddisk.  Apparantly it's just 
plain old POV-ray:
--- START CODE ---
#declare camPos=<.5,.15,-.1>*15;
camera {
 location camPos
 look_at <0,0,0>
}
light_source {<500,500,-500> rgb 1}

#declare Colour=function{pigment {
 checker rgb .5 rgb 1
 scale .5
 }}
#declare Height=
function {
 pigment {
  granite scale 5
 }
}
plane {
 #declare planeY = 0;
 y, planeY

 #declare camHeightAbovePlane = camPos.y - planeY;
 #declare bumpDepth = .5;
 #declare q = 1/(1 + bumpDepth/max(camHeightAbovePlane,.001));

 #declare camPosX = camPos.x; #declare camPosY = camPos.y; #declare camPosZ 
=
camPos.z;

 pigment {
  average
  pigment_map {
   [1
    function {
     Colour( camPosX + (x-camPosX)*(Height(x,0,z).x*(1-q) + q), 0, camPosZ +
  (z-camPosZ)*(Height(x,0,z).x*(1-q) + q) ).x
    }
    color_map {[0 red 0][1 red 3]}
   ]
   [1
    function {
     Colour( camPosX + (x-camPosX)*(Height(x,0,z).x*(1-q) + q), 0, camPosZ +
  (z-camPosZ)*(Height(x,0,z).x*(1-q) + q) ).y
    }
    color_map {[0 blue 0][1 blue 3]}
   ]
   [1
    function {
     Colour( camPosX + (x-camPosX)*(Height(x,0,z).x*(1-q) + q), 0, camPosZ +
  (z-camPosZ)*(Height(x,0,z).x*(1-q) + q) ).z
    }
    color_map {[0 green 0][1 green 3]}
   ]
  }
 }
 normal {
    function {
     Height( camPosX + (x-camPosX)*(Height(x,0,z).x*(1-q) + q), 0, camPosZ +
  (z-camPosZ)*(Height(x,0,z).x*(1-q) + q) ).x
    } -2

 }
 finish { ambient 0 diffuse 1 }
}
--- END CODE ---

I have no idea who wrote it.

cu!
-- 
#macro G(b,e)b+(e-b)*C/50#end#macro _(b,e,k,l)#local C=0;#while(C<50)
sphere{G(b,e)+3*z.1pigment{rgb G(k,l)}finish{ambient 1}}#local C=C+1;
#end#end _(y-x,y,x,x+y)_(y,-x-y,x+y,y)_(-x-y,-y,y,y+z)_(-y,y,y+z,x+y)
_(0x+y.5+y/2x)_(0x-y.5+y/2x)            // ZK http://www.povplace.com


Post a reply to this message

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