POV-Ray : Newsgroups : povray.newusers : Heighfields -are they meshes or 'just' textures? : Re: Heighfields -are they meshes or 'just' textures? Server Time
5 Nov 2024 01:22:54 EST (-0500)
  Re: Heighfields -are they meshes or 'just' textures?  
From: Christopher James Huff
Date: 14 Aug 2002 12:52:44
Message: <chrishuff-4F0BA7.11410914082002@netplex.aussie.org>
In article <web.3d5a53a1e9a1db2d2f4bd1e30@news.povray.org>,
 "krus" <nomail@nomail> wrote:

> >>Marc thats sound VERY interesting! -But i'm not sure if i understand *s*
> Certently i do NOT understand the 'function' keyword in the macro.
> This is what i got:
> 
> could you show me what 'Function' could/should be. I've tried whith
> x=1, 1*x, 0, x^1, ..all because i do not want the image to change
> I get a parse-error with all the abowe
> ....also the four '????' do not work ;)

Hmm, that's...not even close. Never used macros before?
You don't need the #macro...#end in the macro call, they are only used 
to define the macro. And you aren't supposed to use it in a 
height_field, the macro generates a new mesh primitive.

These macros are well documented in the manual, and there are examples 
in scenes/incdemo/shapes.pov. You would use something like:

#declare HF_Fn =
function {
    pigment {
        image_map {sys "textAdv.bmp" interpolate 2}
        rotate x*90
    }
}

object {
    HF_Square(function {HF_Fn(x, y, z).gray}, false, false, <100, 100>, 
true, "myMapMesh", < 0, 0, 0>, < 1, 1, 1>)
    pigment {White}
    translate <-.5, -.5, -.5>
    scale <17, 1.975, 17>
}

HF_Fn is a pigment function, it gives the color of a pigment at a point. 
The ".gray" in the function given to the macro turns it into a float 
value useable as a height. The rotation by x*90 is necessary because the 
image_map is in the xy plane and you need it in the xz plane.
You specified a mesh resolution of 1*1, which obviously won't work...I 
used 100*100, you should use something close to the size of your image 
file, though you could reduce it for lower-quality meshes. You specified 
"smooth" in your height field, so I assumed you wanted a smooth height 
field from the macro and set that option to true. And specifying "100" 
for both corners of the box containing the height field won't work, I 
specified < 0, 0, 0> and < 1, 1, 1>, like the built-in height_field 
shape.
And note that "myMapMesh" won't be affected by the texture and 
translations you do to the object. You could adjust the pigment given to 
HF_Fn and the size given to the height field macro to generate a height 
field of the desired size instead, for texturing you would have to 
manually edit the generated file, but I think the conversion program 
will ignore it anyway.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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