POV-Ray : Newsgroups : povray.advanced-users : height_field + normal pattern problem.. Server Time
24 Dec 2024 13:02:29 EST (-0500)
  height_field + normal pattern problem.. (Message 1 to 7 of 7)  
From: albe99
Subject: height_field + normal pattern problem..
Date: 1 Apr 2007 19:20:01
Message: <web.46103c1eae6ec0f5bff855340@news.povray.org>
Hello, I'm Alberto from Italy..
I would want to modify an height_field with a normal pattern (granite for
example..) and then generate a new 16 bit grayscale image (png or tga..) to
re-use in other height_field statement..
is possible to do this?

I have written this basic sample:
//------------------------------
#include "colors.inc"

global_settings {
   hf_gray_16 on
}

camera {
   orthographic
   location <0.518756, 1.42622, 0.517175>
   sky <0, 1, 0>
   direction <0, 0, 1>
   right <1, 0, 0>
   up <0, 1, 0>
   look_at <0.518487, 0.464293, 0.493562>
}

height_field {
   png "HFtest01.png"
   scale <1, 0.3, 1>
   rotate <0, 0, 0>
   translate y*0.0870551

   texture {
      normal { granite 0.4 }
      pigment { color rgb <0.32549, 0.32549, 0.32549> }
      finish { ambient 1 }
   }
}
//--------------------------------------
....but render shows me nothing, please can someone help me?

Thanks, Alberto


Post a reply to this message

From: Jim Charter
Subject: Re: height_field + normal pattern problem..
Date: 1 Apr 2007 19:42:25
Message: <46104361$1@news.povray.org>
albe99 wrote:
> Hello, I'm Alberto from Italy..
> I would want to modify an height_field with a normal pattern (granite for
> example..) and then generate a new 16 bit grayscale image (png or tga..) to
> re-use in other height_field statement..
> is possible to do this?
> 
> I have written this basic sample:
> //------------------------------
> #include "colors.inc"
> 
> global_settings {
>    hf_gray_16 on
> }
> 
> camera {
>    orthographic
>    location <0.518756, 1.42622, 0.517175>
>    sky <0, 1, 0>
>    direction <0, 0, 1>
>    right <1, 0, 0>
>    up <0, 1, 0>
>    look_at <0.518487, 0.464293, 0.493562>
> }
> 
> height_field {
>    png "HFtest01.png"
>    scale <1, 0.3, 1>
>    rotate <0, 0, 0>
>    translate y*0.0870551
> 
>    texture {
>       normal { granite 0.4 }
>       pigment { color rgb <0.32549, 0.32549, 0.32549> }
>       finish { ambient 1 }
>    }
> }
> //--------------------------------------
> ....but render shows me nothing, please can someone help me?
> 
> Thanks, Alberto
> 
> 
> 
> 
> 
It is because the use of pure ambient light does not show the relief of 
either the hf or the normal

You need a light_source  and start with the default finish.  You can 
then adjust the light_source, its angle to the hf and the finish diffuse 
and specular parameters to get what you want ambient should be low or zero


Post a reply to this message

From: Christian Froeschlin
Subject: Re: height_field + normal pattern problem..
Date: 1 Apr 2007 20:19:42
Message: <46104c1e$1@news.povray.org>
Jim Charter wrote:

> You need a light_source  and start with the default finish.  You can 
> then adjust the light_source, its angle to the hf and the finish diffuse 
> and specular parameters to get what you want ambient should be low or zero

Even so, the resulting image is probably not suitable for reusing it
as a heightfield in the sense the OP expected, because the darkest areas
are no longer of the lowest height.

So, assuming the original question is about adding detail structure
to a heightfield image, the image should probably not be rendered as
a heightfield at all, but simply a plane with an image_map + normal
pattern (or possibly an image_map layered with a function pigment).


Post a reply to this message

From: Alain
Subject: Re: height_field + normal pattern problem..
Date: 1 Apr 2007 23:02:07
Message: <4610722f@news.povray.org>
albe99 nous apporta ses lumieres en ce 01-04-2007 19:16:
> Hello, I'm Alberto from Italy..
> I would want to modify an height_field with a normal pattern (granite for
> example..) and then generate a new 16 bit grayscale image (png or tga..) to
> re-use in other height_field statement..
> is possible to do this?

> I have written this basic sample:
> //------------------------------
> #include "colors.inc"

> global_settings {
>    hf_gray_16 on
> }

> camera {
>    orthographic
>    location <0.518756, 1.42622, 0.517175>
>    sky <0, 1, 0>
>    direction <0, 0, 1>
>    right <1, 0, 0>
>    up <0, 1, 0>
>    look_at <0.518487, 0.464293, 0.493562>
> }

> height_field {
>    png "HFtest01.png"
>    scale <1, 0.3, 1>
>    rotate <-90, 0, 0>
You look parallel to the Z axis, and the height_field extend along the X-Z plane 
the height been along the Y axis. The rotation is to make it perpendicular to 
the camera.
>    translate y*0.0870551

>    texture {
>       normal { granite 0.4 }
>      // pigment { color rgb <0.32549, 0.32549, 0.32549> }
Change to:
	pigment{gradient z color_map{[0 rgb 1][1 rgb 0]}
>       finish { ambient 1 }
>    }
> }
> //--------------------------------------
> ....but render shows me nothing, please can someone help me?

> Thanks, Alberto


Also, for the normal to show up, you need a light_source. Without a light, you 
can use the average function:
pigment{
	average{
	pigment_map{	[1 pigment{granite 0.4}]
			[1 pigment{gradient z color_map{[0 rgb 1][1 rgb 0]}
			}
		}
	}

-- 
Alain
-------------------------------------------------
Politicians are like diapers, they should be changed often and for the same reason.
	Bob Monkhouse


Post a reply to this message

From: albe99
Subject: Re: height_field + normal pattern problem..
Date: 2 Apr 2007 03:00:01
Message: <web.4610a86feeaef254df6ff5fd0@news.povray.org>
Thank you very much..
but I'm in trouble again..

So, I've changed the scene:
//------------------------------
#include "colors.inc"
#include "functions.inc"

global_settings {
   hf_gray_16 on
}

//camera & height_field parallels to the Z axis
camera {
location <0, 0, -10>
look_at 0
}

height_field {
   png "HFtest01.png"
   scale <10, 3, 10>
   rotate <-90, 0, 0>
   translate y*0.0870551

   texture {
      normal { granite 0.4 }
      pigment{
 average{
 pigment_map { [1 pigment{granite 0.4}]
        [1 pigment{gradient z color_map{[0 rgb 1][1 rgb 0]}
   }
  }
 }
      finish { ambient 1 }
   }
}
//------------------------------------------------

povray stop with this message error:

"Line: 40
File Context (5 lines):
      pigment{
 average{
 normal_map { [1 pigment{granite 0.4}]
       [1 pigment{gradient z color_map{[0 rgb 1][1 rgb 0]}
   }

Parse Error: Average must have map."


Post a reply to this message

From: Alain
Subject: Re: height_field + normal pattern problem..
Date: 2 Apr 2007 13:15:16
Message: <46113a24$1@news.povray.org>
albe99 nous apporta ses lumieres en ce 02-04-2007 02:58:
> Thank you very much..
> but I'm in trouble again..

> So, I've changed the scene:
> //------------------------------
> #include "colors.inc"
> #include "functions.inc"

> global_settings {
>    hf_gray_16 on
> }

> //camera & height_field parallels to the Z axis
> camera {
> location <0, 0, -10>
> look_at 0
> }

> height_field {
>    png "HFtest01.png"
>    scale <10, 3, 10>
>    rotate <-90, 0, 0>
>    translate y*0.0870551

>    texture {
>       normal { granite 0.4 }
>       pigment{
>  average{
>  pigment_map { [1 pigment{granite 0.4}]
>         [1 pigment{gradient z color_map{[0 rgb 1][1 rgb 0]}
>    }
>   }
>  }
>       finish { ambient 1 }
>    }
> }
> //------------------------------------------------

> povray stop with this message error:

> "Line: 40
> File Context (5 lines):
>       pigment{
>  average{
>  normal_map { [1 pigment{granite 0.4}]
>        [1 pigment{gradient z color_map{[0 rgb 1][1 rgb 0]}
>    }

> Parse Error: Average must have map."

My mistake, wrong kind of map. Change to:
pigment{average{
	pigment_map{[1 pigment{granite 0.4}]
		[1 pigment{gradient z color_map{[0 rgb 1][1 rgb 0]}
	}

-- 
Alain
-------------------------------------------------
Fix reason firmly in her seat, and call to her tribunal every fact, every
opinion. Question with boldness even the existence of a God; because, if
there be one, he must more approve of the homage of reason, than that of
blindfolded fear.
Thomas Jefferson


Post a reply to this message

From: albe99
Subject: Re: height_field + normal pattern problem..
Date: 2 Apr 2007 21:45:02
Message: <web.4611b043eeaef254c69d16000@news.povray.org>
Alain <ele### [at] netscapenet> wrote:
>
> My mistake, wrong kind of map. Change to:
> pigment{average{
>  pigment_map{[1 pigment{granite 0.4}]
>   [1 pigment{gradient z color_map{[0 rgb 1][1 rgb 0]}
>  }
>
> --
> Alain
> -------------------------------------------------

thank you so much Alain..
but unfortunately, the Average function generates errors again..

"Line: 30
Parse Warning: Pigment type unspecified or not 1st item.
Line: 30
File Context (5 lines):
      pigment_map {
        [1 pigment
Parse Error: Expected ']', pigment found instead "

however, using a light_source, it seems to work quite well:
//---------------------------------------------------

global_settings {
   hf_gray_16 on
}

light_source {
   <0.516914, 0.509426, -1.47921>, rgb <1, 1, 1>
}

camera {
   orthographic
   location <0.51681, 0.50948, -1.40625>
   sky <0, 1, 0>
   direction <0, 0, 1>
   right <1, 0, 0>
   up <0, 1, 0>
   look_at <0.51854, 0.50676, -0.43528>
}

height_field {
   png "prova2.png"
   scale <1, 0.4, 1>
   rotate x*-90
   translate x*0.0153893

   texture {
      normal { granite 0.4 }
       pigment {
         gradient z
         color_map {
            [0 rgb 1]
            [1 rgb 0]
             }
          }
      finish { ambient .5 }
   }
}
//------------------------------------------
the render produces a good image reusable in an height_field statement..

Alberto.


Post a reply to this message

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