POV-Ray : Newsgroups : povray.advanced-users : Passing a pigment to a heightfield? Server Time
23 Dec 2024 18:10:15 EST (-0500)
  Passing a pigment to a heightfield? (Message 1 to 7 of 7)  
From: SharkD
Subject: Passing a pigment to a heightfield?
Date: 28 Aug 2009 00:30:17
Message: <4a975d59@news.povray.org>
Is there a way to generate a heightfield from a pigment? The heightfield 
object requires an actual image AFAIK.

Thanks!

-Mike


Post a reply to this message

From: Anthony D  Baye
Subject: Re: Passing a pigment to a heightfield?
Date: 28 Aug 2009 00:47:30
Message: <4a976162$1@news.povray.org>
Absolutely

You can turn your pigment into a function

#declare myPigFn =
function {
     pigment { my_pigment ]
     }

and pass it directly to the height field as a function

height_field {
     function HF_Res_X, HF_Res_Z { myPigFn(x,y,z).red * vScale }
     water_level n.n
     }

".red" specifies that the height data follows the intensity of the red 
channel.  Alternatively you may use the blue or green channels or any of 
the direction vectors (x,y,z)

Numerical functions can also be used, but do not require the vector 
component.

remember that height_fields occupy a unit cube from 0,0,0 to 1,1,1.

Regards,

A.D.B.

SharkD wrote:
> Is there a way to generate a heightfield from a pigment? The heightfield 
> object requires an actual image AFAIK.
> 
> Thanks!
> 
> -Mike


Post a reply to this message

From: SharkD
Subject: Re: Passing a pigment to a heightfield?
Date: 28 Aug 2009 01:13:30
Message: <4a97677a$1@news.povray.org>
Anthony D. Baye wrote:
> Absolutely
> 
> You can turn your pigment into a function
> 
> #declare myPigFn =
> function {
>     pigment { my_pigment ]
>     }
> 
> and pass it directly to the height field as a function
> 
> height_field {
>     function HF_Res_X, HF_Res_Z { myPigFn(x,y,z).red * vScale }
>     water_level n.n
>     }
> 
> ".red" specifies that the height data follows the intensity of the red 
> channel.  Alternatively you may use the blue or green channels or any of 
> the direction vectors (x,y,z)
> 
> Numerical functions can also be used, but do not require the vector 
> component.
> 
> remember that height_fields occupy a unit cube from 0,0,0 to 1,1,1.
> 
> Regards,
> 
> A.D.B.

I get the error:

"Parse Error: Expected 'numeric expression', undeclared identifier 
'HF_Res_X' found instead"

-Mike


Post a reply to this message

From: Anthony D  Baye
Subject: Re: Passing a pigment to a heightfield?
Date: 28 Aug 2009 01:28:52
Message: <4a976b14$1@news.povray.org>
HF_Res_X and HF_Res_Y are place holders for variable values.
replace them with a resolution

eg. 256, 256 or 512, 512

A.D.B.


SharkD wrote:
> Anthony D. Baye wrote:
>> Absolutely
>>
>> You can turn your pigment into a function
>>
>> #declare myPigFn =
>> function {
>>     pigment { my_pigment ]
>>     }
>
>> and pass it directly to the height field as a function
>>
>> height_field {
>>     function HF_Res_X, HF_Res_Z { myPigFn(x,y,z).red * vScale }
>>     water_level n.n
>>     }
>>
>> ".red" specifies that the height data follows the intensity of the red 
>> channel.  Alternatively you may use the blue or green channels or any 
>> of the direction vectors (x,y,z)
>>
>> Numerical functions can also be used, but do not require the vector 
>> component.
>>
>> remember that height_fields occupy a unit cube from 0,0,0 to 1,1,1.
>>
>> Regards,
>>
>> A.D.B.
> 
> I get the error:
> 
> "Parse Error: Expected 'numeric expression', undeclared identifier 
> 'HF_Res_X' found instead"
> 
> -Mike


Post a reply to this message

From: clipka
Subject: Re: Passing a pigment to a heightfield?
Date: 28 Aug 2009 02:10:37
Message: <4a9774dd$1@news.povray.org>
Anthony D. Baye schrieb:
> You can turn your pigment into a function
 > ...
> and pass it directly to the height field as a function

Just for info: This actually causes POV-Ray to internally sample a 
bitmap of the specified resolution from the function.


Post a reply to this message

From: SharkD
Subject: Re: Passing a pigment to a heightfield?
Date: 28 Aug 2009 03:00:50
Message: <4a9780a2@news.povray.org>
Anthony D. Baye wrote:
> HF_Res_X and HF_Res_Y are place holders for variable values.
> replace them with a resolution

Resolution of what? *What* are the numbers measuring, exactly?

-Mike


Post a reply to this message

From: Anthony D  Baye
Subject: Re: Passing a pigment to a heightfield?
Date: 28 Aug 2009 03:20:01
Message: <web.4a9784f6e228e4b94b39a3180@news.povray.org>
The resolution of the height field!!  Think of the resolution as a count of
square subdivisions.

The height field is still 1 unit by 1 unit, but that one-square-unit area is
divided into X*Z square subdivisions.  It's no different than using a 512x512
pixel image as your source.

A.D.B.

SharkD <mik### [at] gmailcom> wrote:
> Anthony D. Baye wrote:
> > HF_Res_X and HF_Res_Y are place holders for variable values.
> > replace them with a resolution
>
> Resolution of what? *What* are the numbers measuring, exactly?
>
> -Mike


Post a reply to this message

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