POV-Ray : Newsgroups : povray.general : Heightfields from textures? Server Time
6 Nov 2024 18:25:19 EST (-0500)
  Heightfields from textures? (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From: Jon Berndt
Subject: Heightfields from textures?
Date: 26 Apr 2004 20:03:43
Message: <408da35f$1@news.povray.org>
[I've been using POV-Ray for years on and off, but I still consider myself a
sort of newbie]

I have used heightfields with a provided bitmap, but I often found that they
didn't quite work for me, at least the way I was using them.  I wanted to
make a landscape (terrain) that was rolling hills, but that exhibited detail
even when viewed up close.  I have some ideas how to do this, but the most
important aspect of this for me to get started is to know, first, if POV-Ray
can essentially model heightfields algorithmically rather than from
(potentially limited) bitmaps. I am guessing that there might be a way to
generate a heightfield that is based on a texture, perhaps?

Referrals to a FAQ or web page or section in the help file is fine,

TIA,

Jon


Post a reply to this message

From: Hughes, B 
Subject: Re: Heightfields from textures?
Date: 27 Apr 2004 00:04:15
Message: <408ddbbf$1@news.povray.org>
"Jon Berndt" <jsb### [at] hal-pcdotorg> wrote in message
news:408da35f$1@news.povray.org...
> I am guessing that there might be a way to
> generate a heightfield that is based on a texture, perhaps?

You're in luck. In the documentation, see the second example under section
6.7.11.16  Function Image.

My own example then, using function patterns, below.

Bob H.

/* lumpy HF by combining function patterns */

#local F_Pbozo=
function {
 pattern {
  bozo
  turbulence 0.5
  scale 0.1
 }
}

#local F_Pbumps=
function {
 pattern {
  bumps
  turbulence 0.5
  scale 0.1
 }
}

height_field {
 function 500,500 {
  pattern {
   function {
    (F_Pbozo(x,y,z)*1.4)
    *
    (F_Pbumps(x,y,z)*0.9)
   }
  }
 }
 smooth
 pigment {gradient y}
 translate -0.5
 scale <10,1,10>
}


Post a reply to this message

From: Mike Williams
Subject: Re: Heightfields from textures?
Date: 27 Apr 2004 15:31:00
Message: <I3E+TDAh0hjAFwwD@econym.demon.co.uk>
Wasn't it Jon Berndt who wrote:
>[I've been using POV-Ray for years on and off, but I still consider myself a
>sort of newbie]
>
>I have used heightfields with a provided bitmap, but I often found that they
>didn't quite work for me, at least the way I was using them.  I wanted to
>make a landscape (terrain) that was rolling hills, but that exhibited detail
>even when viewed up close.  I have some ideas how to do this, but the most
>important aspect of this for me to get started is to know, first, if POV-Ray
>can essentially model heightfields algorithmically rather than from
>(potentially limited) bitmaps. I am guessing that there might be a way to
>generate a heightfield that is based on a texture, perhaps?

There's more than one way to do it. One way is to generate a
height_field based on a pattern function

#declare P1=function{pattern{leopard turbulence 0.3 scale 0.2/4}}
#declare P2=function{pattern{leopard turbulence 0.3 scale 0.5/4}}
height_field{function 300,300{P1(x,y,z)*0.3+P2(x,y,z)}
  translate <-0.5,0,-0.5>
  scale <4,0.7,4>
  . . . 

and the other way is to use an isosurface

#declare P1=function{pattern{leopard turbulence 0.3 scale 0.2}}
#declare P2=function{pattern{leopard turbulence 0.3 scale 0.5}}
isosurface {function { y - P1(x,0,z)*0.3 - P2(x,0,z)*1.0}
  . . .

The significant differences are:-

1. The height field renders much faster

2. The isosurface has as much resolution as the scene requires, when you
come in for a close up you get the details automatically. You have to
specify an appropriate resolution for the height_field. When you're
doing a close up view you'll need to replace "function 300,300" with
larger numbers.

3. The height field uses more memory, since the whole function image is
calculated once and stored in memory. If you're doing an extreme closeup
you might need to set the size of the function image to be very large,
and therefore need quite a lot of memory.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Mike Williams
Subject: Re: Heightfields from textures?
Date: 30 Apr 2004 13:05:25
Message: <T364zAAFvhkAFwqG@econym.demon.co.uk>
Wasn't it Jon Berndt who wrote:
>[I've been using POV-Ray for years on and off, but I still consider myself a
>sort of newbie]
>
>I have used heightfields with a provided bitmap, but I often found that they
>didn't quite work for me, at least the way I was using them.  I wanted to
>make a landscape (terrain) that was rolling hills, but that exhibited detail
>even when viewed up close.  I have some ideas how to do this, but the most
>important aspect of this for me to get started is to know, first, if POV-Ray
>can essentially model heightfields algorithmically rather than from
>(potentially limited) bitmaps. I am guessing that there might be a way to
>generate a heightfield that is based on a texture, perhaps?
>
>Referrals to a FAQ or web page or section in the help file is fine,

I've now worked out how to generate the same landscape using
height_field code and isosurface code. This makes it possible to develop
a landscape using the fast height_field code, then produce a final
render using the slow isosurface code.

I'll be posting the details and example code to my isosurface tutorial
later tonight. The "Mountains4.pov" scene in the source ZIP file
switches from height_field to isosurface rendering by #declaring HF to
be true or false.

<http://www.econym.demon.co.uk/patterns.htm#hf>

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Jon Berndt
Subject: Re: Heightfields from textures?
Date: 1 May 2004 13:01:28
Message: <4093d7e8$1@news.povray.org>
> I'll be posting the details and example code to my isosurface tutorial
> later tonight. The "Mountains4.pov" scene in the source ZIP file
> switches from height_field to isosurface rendering by #declaring HF to
> be true or false.
>
> <http://www.econym.demon.co.uk/patterns.htm#hf>

Mike:

The above link didn't work - is it still pending? I did notice that I could
reach your main site. [ you need to step back from the camera a little ways
... ;-) ]

Jon


Post a reply to this message

From: Mike Williams
Subject: Re: Heightfields from textures?
Date: 1 May 2004 13:59:39
Message: <vI9HMBAbT+kAFwet@econym.demon.co.uk>
Wasn't it Jon Berndt who wrote:
>> I'll be posting the details and example code to my isosurface tutorial
>> later tonight. The "Mountains4.pov" scene in the source ZIP file
>> switches from height_field to isosurface rendering by #declaring HF to
>> be true or false.
>>
>> <http://www.econym.demon.co.uk/patterns.htm#hf>
>
>Mike:
>
>The above link didn't work - is it still pending? I did notice that I could
>reach your main site. [ you need to step back from the camera a little ways
>... ;-) ]

Oops. That should have been

<http://www.econym.demon.co.uk/isotut/patterns.htm#hf>

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Thomas de Groot
Subject: Re: Heightfields from textures?
Date: 2 May 2004 03:17:09
Message: <4094a075@news.povray.org>
"Mike Williams" <nos### [at] econymdemoncouk> schreef in bericht
news:vI9HMBAbT+kAF### [at] econymdemoncouk...
> Oops. That should have been
>
> <http://www.econym.demon.co.uk/isotut/patterns.htm#hf>
>
Thank you very much indeed, Mike!
This is very useful.

Thomas


Post a reply to this message

From: Thomas de Groot
Subject: Re: Heightfields from textures?
Date: 7 May 2004 08:40:09
Message: <409b83a9@news.povray.org>
Now consider the code Isosurface/Heightfield:
#if (HF)
  height_field{function 300,300{P(x,0,y)}
    translate <-0.5,0,-0.5>
    scale <4,0.75,4>
    pigment{G}
  }
#else
  isosurface {
    function { y - P(x,0,1-z)}
    open
    max_gradient 7
    contained_by{box{<0,0,0>,<1,1,1>}}
    translate <-0.5,0,-0.5>
    scale <4,0.75,4>
    pigment {G}
  }
#end

It is possible, for later use, to increase the isosurface by increasing the
bounding box. If I want to test this larger object with a heightfield
because my landscape is larger than the unit HF (not considering the scale
of course), how should I do that? Is that possible at all?

Thomas


Post a reply to this message

From: "Jérôme M. Berger"
Subject: Re: Heightfields from textures?
Date: 7 May 2004 13:48:10
Message: <409bcbda@news.povray.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

	You can do it like this, I think (untested):

#declare SIZE = 2.0;
#if (HF)
~  height_field{function 300,300{P(x*SIZE,0,y*SIZE)}
~    translate <-0.5,0,-0.5>
~    scale <4,0.75,4>*SIZE
~    pigment{G}
~  }
#else
~  isosurface {
~    function { y - P(x,0,1-z)}
~    open
~    max_gradient 7
~    contained_by{box{<0,0,0>,<1,1,1>*SIZE}}
~    translate <-0.5,0,-0.5>
~    scale <4,0.75,4>
~    pigment {G}
~  }
#end

- --
******************************
*      Jerome M. Berger      *
* mailto:jbe### [at] ifrancecom *
*  http://jeberger.free.fr/  *
******************************
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAm8vZqIYJdJhyixIRApdtAKChblNUkCop2iq9Qi5M+NCIu8v7xwCeJvcQ
jIyiFOOsnufFiAnRHkSU2oE=
=Witz
-----END PGP SIGNATURE-----


Post a reply to this message

From: Mike Williams
Subject: Re: Heightfields from textures?
Date: 7 May 2004 16:41:41
Message: <KYWh5AA+L$mAFwao@econym.demon.co.uk>
Wasn't it Thomas de Groot who wrote:
>Now consider the code Isosurface/Heightfield:
>#if (HF)
>  height_field{function 300,300{P(x,0,y)}
>    translate <-0.5,0,-0.5>
>    scale <4,0.75,4>
>    pigment{G}
>  }
>#else
>  isosurface {
>    function { y - P(x,0,1-z)}
>    open
>    max_gradient 7
>    contained_by{box{<0,0,0>,<1,1,1>}}
>    translate <-0.5,0,-0.5>
>    scale <4,0.75,4>
>    pigment {G}
>  }
>#end
>
>It is possible, for later use, to increase the isosurface by increasing the
>bounding box. If I want to test this larger object with a heightfield
>because my landscape is larger than the unit HF (not considering the scale
>of course), how should I do that? Is that possible at all?

Try this, setting M and N to the scale you require in the X and Z
directions respectively.

#if (HF)
  height_field{function 300*M,300*N{P((x-0.5)*M+0.5,0,(y-0.5)*N+0.5)}
    translate <-0.5,0,-0.5>
    scale <4*M,0.75,4*N>
    pigment{G}
  }
#else
  isosurface {
    function { y - P(x,0,1-z)}
    open
    max_gradient 7
    contained_by{box{<0.5-M*0.5,0,0.5-N*0.5>,<0.5+M*0.5,1,0.5+N*0.5>}}
    translate <-0.5,0,-0.5>
    scale <4,0.75,4>
    pigment {G}
  }
#end

The "300*M,300*N" bit is optional

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

Goto Latest 10 Messages Next 2 Messages >>>

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