POV-Ray : Newsgroups : povray.unofficial.patches : Megapov 0.5 and heightfield : Megapov 0.5 and heightfield Server Time
2 Sep 2024 04:16:49 EDT (-0400)
  Megapov 0.5 and heightfield  
From: Fabian BRAU
Date: 18 May 2000 04:35:04
Message: <3923AB2B.A5C41E41@umh.ac.be>
Hello Nathan,

First, congratulation for your global optimization: a scene which needs
4 min 45 sec to render (it was mainly heightfield with material_map)
needs 3 min to render now!
But there is a problem. This is not a bug because I know how get 
megapov0.5 work correctly. The code is below.

There is a difference between Megapov0.4 and Megapov0.5:

With Megapov0.4 once you have given the texture to the heightfield,
if you scale the heightfiled, you dont need to modify the texture,
the appearance of the heightfield and its texture is scale (
for uniform one) independant.

With Megapov0.5, if you scale your heightfield (after give the texture)
by scale <x,y,z> and suppose, in general, that your texture have 
already a scaling like scale <a,b,c>, to have the same result than 
with megapov0.4 you need to scale your texture by scale <a/x,b/y,c/z>. 
This is true for translation (and certainly with rotation).

I think this is not good. Suppose you do an object which contain
heightfield,
now you want to use this object in a scene, but you need to scale the
object,
so you will need to rescale all the texture of the heightfield! I think 
a scene or an object must be scale (uniform) independant.
I don't know why you change this. If you tell me "this is only for
optimization,
if I use the old code for texture, you will lose all the optimization",
so
I say we can discuss and see if this is good. Otherwise please put the 
Megapov0.4 code for the texture of heightfield :).

Thanks for reading me,

I hope the explanation is clear otherwise tell me it, I will explain
again.

Fabian.


THE HEIGHFIELD
---------------

#declare Foo = object { 
  height_field {
    tga "foo.tga"
    water_level 0.001
    smooth
  }
  rotate    <-90, 0, 0> // Turn onto XY plane. Now points along -Z
  scale     <  2, 2,-2> // Scale to Cube size. Now points along +Z
  translate < -1,-1,-1> // Center around origin

// These transformations are done automatically by Moray, as this 
// is done before texturing, I need to transform the texture 
// accordingly.

  material {
    Foo_tex
  }
  scale <30.0, 40.0, 15.0>
  translate  <-120.0, 37.5, 14.98>
}

THE TEXTURE
------------
#declare Foo_tex = 
   material 
   {   
      texture
      {
         material_map
         {
            gif   "rhombmap4_big.gif"
            once
            texture  
            {            
               pigment
               {
                  image_map
                  {
                     gif   "Dsc01619_public.gif"
                  }
                  turbulence 0.15
                  ramp_wave 
                  scale <1/60,1/80,1/30>     //MegaPov0.5 but
                  // you need also to add translation
                  // scale 1                 //Megapov0.4
               }
            }
            texture  
            {            
               pigment
               {
                  image_map
                  {
                     gif   "Dsc01619_public.gif"
                  }
                  scale <1/60,1/80,1/30>      //MegaPov0.5 but
                  // you need also to add translation 
                  // scale 1                  //Megapov0.4
               }
            }
            texture  
            {            
               pigment
               {
                  color rgb <0.656233, 0.656233, 0.656233>
               }
            }
            texture  
            {            
               pigment
               {
                  image_map
                  {
                     gif   "dirt_miller_fab.gif"
                  }
                  scale  <3.0/60, 3.0/80, 1.0/30>   //MegaPov0.5 but
                  // you need also to add translation 
                  // scale <3.0,3.0,1.0>            //Megapov0.4 
               }
            }
            texture  
            {            
               pigment
               {
                  image_map
                  {
                     gif   "grassg.gif"
                  }
                  scale  <3.0/60, 3.0/80, 1.0/30>  //MegaPov0.5 but
                  // you need also to add translation
                  // scale <3.0,3.0,1.0>            //Megapov0.4
               }
            }
         }

         scale  <2.0, 2.0, 1.0>   // I need to perform these 
         // transformations because the heightfiled is transform 
         // by Moray, before giving the texture.
         translate    <-1.0, -1.0, 0.0>
      }
   }


Post a reply to this message

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