POV-Ray : Newsgroups : povray.general : img2mesh PNG height field to POV mesh converter finished (hopefully) : img2mesh mapping added (was Re: img2mesh PNG height field to POV mesh converter finished (hopefully)) Server Time
19 Jul 2024 23:06:50 EDT (-0400)
  img2mesh mapping added (was Re: img2mesh PNG height field to POV mesh converter finished (hopefully))  
From: Ilya Razmanov
Date: 20 Jun 2024 12:36:46
Message: <66745a9e$1@news.povray.org>
Ok, I was lying when I promised to stop updating img2mesh PNG 
heightfield to 3D mesh conversion utility:


I realized that, when doing something with heightfields "for fun", that 
is, not trying to convert some actual geometry data but, say, creating 
fake coins or medals, I often repeat one procedure: in Photoshop, apply 
"Curves" to image, save it, convert to mesh, render, say "I need extend 
gradations here and invert this small part" and repeat it again and 
again (including saying).

To reduce time for resaving and number of resaying I implemented 
"Curves" right in exported POVRay file - with img2pov (and, 
correspondingly, img2mesh when POV export option is used) version z-coordinate of mesh triangles, generated and saved according to 
source PNG pixel brightness, is fed to map function in POVRay when 
rendering. By default exported map is five points linear spline, 
corresponding to straight line describing "identical" transform, i.e. 
input=output. Map description is placed near the beginning of scene file 
and I guess its two-column layout makes it easy to understand - input is 
the first column, output is second column, third column contains unused 

Note, that map does not change actual z coords in mesh, it is applied 
when scene is rendered, so map is non-destructive and may be returned to 
"identical" 0/0 - 1/1 line anytime you want. Note that, as a result, map 
works only in POV file - with STL and OBJ export there is no map, since 
only POVRay allows easy internal recalculation of every facet according 
to user-defined function.

Have fun,

Ilyich the Toad

Post a reply to this message

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