POV-Ray : Newsgroups : povray.general : Height field to mesh - more resolution : Re: Height field to mesh - more resolution Server Time
3 Mar 2024 07:57:37 EST (-0500)
  Re: Height field to mesh - more resolution  
From: William F Pokorny
Date: 1 Dec 2023 09:13:40
Message: <6569ea14$1@news.povray.org>
On 12/1/23 02:03, jr wrote:
> proof of concept (640x480 image source).  ~20 minutes 😉

This a good example to show the value of the yuqk / v4.0 idea of 
providing a 'munctions.inc' / macro defined functions include.

The yuqk fork has no 'eval_pigment', but it does have a munction called 
   M_evaluate_pigment(). The following runs in about 4.5 seconds, 
elapsed, on my old i3.

In this case, I think, you can mostly emulate what was done with 
M_evaluate_pigment() in official releases of POV-Ray - to some degree or 
other.

Bill P.

----- snip ------
#version unofficial 3.8; // yuqk
#if (file_exists("version.inc"))
     #include "version.inc"
#end
#if (!defined(Fork_yuqk))
     #error "This POV-Ray SDL code requires the yuqk fork."
#end
global_settings { assumed_gamma 1 }
#declare Grey50 = srgb <0.5,0.5,0.5>;
background { Grey50 }
#declare VarOrthoMult =
     2.0/max(image_width/image_height,image_height/image_width);
#declare Camera01z = camera {
     orthographic
     location <0,0,-2>
     direction z
     right VarOrthoMult*x*max(1,image_width/image_height)
     up VarOrthoMult*y*max(1,image_height/image_width)
}
#declare PigIm = pigment {
     image_map {
         png "Test680x480.png"
         gamma srgb
         interpolate 0
     }
     scale <640,480,1>
};
#include "munctions.inc"
// Following defines FnPg00() so it can be used directly.
#declare Vec00 =
M_evaluate_pigment("FnPg00",PigIm,<0,0,0>,false);

//--- scene ---
union {
#for (R,0,479)
     #for (C,0,639)
         sphere {
           <(C+.5),(R+.5),0>, .495
           texture {
             pigment {
                 // Can call 'munction' repeatedly too, but it's
                 // 2x slower than FnPg00() due the macro call.
               //color
               //M_evaluate_pigment("FnPg00",PigIm,<C,R,0>,false)
                 color FnPg00(C,R,0)
             }
             finish {emission 1}
           }
         }
     #end
#end
scale <1/640,1/480,1>
translate <-0.5,-0.5,0>
scale <VarOrthoMult*max(1,image_width/image_height),
     VarOrthoMult*max(1,image_height/image_width),
     1>
}
camera { Camera01z }
----- snip ------


Post a reply to this message


Attachments:
Download 'jr.png' (33 KB)

Preview of image 'jr.png'
jr.png


 

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