POV-Ray : Newsgroups : povray.general : Problem with pigment_map : Re: Problem with pigment_map Server Time
31 Jul 2024 08:27:08 EDT (-0400)
  Re: Problem with pigment_map  
From: Alain
Date: 22 Jul 2007 11:29:32
Message: <46a377dc@news.povray.org>
Yadgar nous apporta ses lumieres en ce 2007/07/22 04:44:
> High!
> 
> I'm currently trying to build a gradient y texture to generate a 16 bit
> heightfield from an isosurface terrain. Here's the code:
> 
> #declare HF16 =
> texture
> {
>   pigment
>   {
>     gradient y
>     pigment_map
>     {
>       #declare a=0;
>       #while (a<127)
>         [a/256
>           pigment  // here the error occurs
>           {
>             gradient y
>             color_map
>             {
>               [0 rgb <a/255, 0, 0>]
>               [1 rgb <a/255, 1, 0>]
>             }
>             scale 1/256
>           }
>         ]
>         [(a+1)/256
>           pigment
>           {
>             gradient y
>             color_map
>             {
>               [0 rgb <a/255, 0, 0>]
>               [1 rgb <a/255, 1, 0>]
>             }
>             scale 1/256
>           }
>         ]
>         #declare a=a+1;
>       #end
>     }
>   }
>   finish { ambient 1 diffuse 0 }
> }
> 
> Everytime I try to start my small test scene, I get the error message "Parse
> Error: expected "[", pigment found instead". Why?
> 
> See you on www.khyberspace.de !
> 
> Yadgar
> 
> 
This look like a case of "Why do simple when you can do overly complicated"

The normal way to do it is to add hf_gray_16 in the global_settings{...} block:

global_settings{hf_gray_16}

Then, you set a simple white to black gradient for your object:

texture{pigment{gradient y scale YourOnjectThickness}finish{ambient 1 diffuse 0}}

Adjust the scaling acording to your object thickness.

Lastly, set your output format to TGA:

Add +ft to the command line.

It will show in black and white in the preview. The output file will be black, 
red and green: general hight as red component, high resolution, small scale, 
hight as green.

-- 
Alain
-------------------------------------------------
Why do psychics have to ask you for your name?


Post a reply to this message

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