POV-Ray : Newsgroups : povray.advanced-users : Height-field (dis)orientation : Height-field (dis)orientation Server Time
28 Jul 2024 18:26:21 EDT (-0400)
  Height-field (dis)orientation  
From: David Wallace
Date: 21 Jul 2004 15:28:44
Message: <40fec3ec@news.povray.org>
I am trying to place a relatively flat object on a heightfield using the
following macros:

#declare Ground = height_field {
 png "lakeb.png"
 smooth
 translate <-.5,-.5,-.5>
 texture { texGnd }
 scale <1e4, 160, 1e4>
}

#macro trnGnd( ob, ang, px, py, alt)
 rotate y*ang
 #local nrm = <0,0,0>;
 #local ps = trace( ob, <px, 1e5, py>, -y, nrm);
 #if (vlength(nrm)>.1)
  Reorient(y,nrm)
 #end
 translate ps+nrm*alt
#end

// Coral is a parametric snake surface
object { Coral scale 1.0 trnGnd(Ground, -96, 216, -910, 0.45) }

The snake is rather long but lies relatively flat on a plane.  When I try to
orient the snake so that is is level to the local surface, it fails
miserably.  Some of it is above the surface and some is below.  What am I
doing wrong?


Post a reply to this message

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