POV-Ray : Newsgroups : povray.general : Problem with pigment_map Server Time
5 Nov 2024 07:15:25 EST (-0500)
  Problem with pigment_map (Message 1 to 8 of 8)  
From: Yadgar
Subject: Problem with pigment_map
Date: 22 Jul 2007 04:45:02
Message: <web.46a318d48aa1d48566bd28430@news.povray.org>
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


Post a reply to this message

From: Jaime Vives Piqueres
Subject: Re: Problem with pigment_map
Date: 22 Jul 2007 05:32:42
Message: <46a3243a$1@news.povray.org>
Yadgar wrote:
> I'm currently trying to build a gradient y texture to generate a 16 bit
> heightfield from an isosurface terrain. 

   Curious: I'm just doing the opposite... ;)

>           pigment  // here the error occurs
> 
> Everytime I try to start my small test scene, I get the error message "Parse
> Error: expected "[", pigment found instead". Why?

   I think you need to get ride of the pigment{} wrapper, IIRC.

   Happy landscaping!

--
Jaime


Post a reply to this message

From: Mike Williams
Subject: Re: Problem with pigment_map
Date: 22 Jul 2007 05:44:25
Message: <alb1mDAxbyoGFwj5@econym.demon.co.uk>
Wasn't it Yadgar who wrote:
>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:

I think there's a slight typo in the documentation. Where it says

   each PIGMENT_BODY is anything which can be inside a pigment{...} 
   statement. The pigment keyword and {} braces need not be specified. 

I think it possibly should say

   each PIGMENT_BODY is anything which can be inside a pigment{...} 
   statement. The pigment keyword and {} braces must not be specified. 

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Problem with pigment_map
Date: 22 Jul 2007 06:02:32
Message: <46a32b38$1@news.povray.org>
> I'm currently trying to build a gradient y texture to generate a 16 bit
> heightfield from an isosurface terrain.

I confess I don't really understand what you are doing. Are you
trying to simulate the freaky TGA red/green 16-bit hack? Why not
just apply gradient y to the isosurface and output a 16-bit PNG
using +FN16 or Bit_Per_Color = 16?


Post a reply to this message

From: Alain
Subject: Re: Problem with pigment_map
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

From: Jacquier Marc
Subject: Re: Problem with pigment_map
Date: 22 Jul 2007 12:50:10
Message: <46a38ac2$1@news.povray.org>

46a32b38$1@news.povray.org...
>
> I confess I don't really understand what you are doing. Are you
> trying to simulate the freaky TGA red/green 16-bit hack? Why not
> just apply gradient y to the isosurface and output a 16-bit PNG
> using +FN16 or Bit_Per_Color = 16?

TGA  red/green is actually a 24bits image, your trick couldn't work

Marc


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Problem with pigment_map
Date: 22 Jul 2007 13:08:30
Message: <46a38f0e$1@news.povray.org>
Jacquier Marc wrote:

> TGA  red/green is actually a 24bits image, your trick couldn't work

Yes, but the blue channel is unused when using a TGA height_field,
while a PNG can store the 16-bit in a single channel. But of course
Alain was right in pointing out that hf_gray_16 is the way to go as
it also forces gray output. Not sure what happens when you create a
height_field based on a PNG file with three channels of 16 bit each.


Post a reply to this message

From: Penelope20k
Subject: Re: Problem with pigment_map
Date: 23 Jul 2007 03:40:38
Message: <46a45b76$1@news.povray.org>
in a pigment_map ..don t use pigment statement ..just write your gradient
and color map ...
in a texture_map   don't use texture statement etc....








web.46a318d48aa1d48566bd28430@news.povray.org...
> 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
>
>


Post a reply to this message

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