POV-Ray : Newsgroups : povray.advanced-users : UV Repeat in image_map : Re: UV Repeat in image_map Server Time
26 Apr 2024 02:42:49 EDT (-0400)
  Re: UV Repeat in image_map  
From: Roland Melkert
Date: 31 Jan 2018 14:20:00
Message: <web.5a7215a312d0a639c949581a0@news.povray.org>
Thanks Bald Eagle / William.

Using warp is genius, and so logical when you think about it, I'm thinking too
much in OpenGL terms :)

I'm now using this, which seems to work fine.
-----------
#macro getPngMapType(idx)
 #if (getPngNeedsURepeat(idx) & getPngNeedsVRepeat(idx))
  map_type 0
 #else
  map_type 0 once
 #end
#end

#macro getPngWarp(idx)
  #local doU=getPngNeedsURepeat(idx);
  #local doV=getPngNeedsURepeat(idx);

  #if (doU | doV)
   #if (doU)
     warp { repeat x }
   #else
     warp { repeat y }
   #end
  #end
#end

#macro ldrawBuildTex(basePigment, baseNormal, baseFinish, pngIdx)

 #if (pngIdx<0)
  pigment { basePigment }
  normal { baseNormal }
  finish { baseFinish }
 #else
  #local texPigment=
   pigment {
    uv_mapping
    image_map {
     png getPngName(pngIdx)
     getPngMapType(pngIdx)
     interpolate 2
    }
    getPngWarp(pngIdx)
   }
  ;

  #local result=
   texture {
    pigment { basePigment }
    normal { baseNormal }
    finish { baseFinish }
   }
   texture {
    pigment { texPigment }
   }
  ;
  result
 #end
#end


Post a reply to this message

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