POV-Ray : Newsgroups : povray.unofficial.patches : uv_mapping again - how to? : Re: uv_mapping again - how to? Server Time
1 Sep 2024 12:16:26 EDT (-0400)
  Re: uv_mapping again - how to?  
From: ingo
Date: 17 Apr 2001 18:17:20
Message: <Xns90873450EBD1seed7@povray.org>
in <3adc9cd6@news.povray.org> Marc-Hendrik Bremer wrote:

> I exported a simple plane out of 32 patches an tried to map a png
> on it. The union lies in the x/z-plane. As the image_map is in the
> x/y-plane, I rotated it x*90.

You don't need to rotate the image_map. The part of a texture that is 
used for uv_mapping is the part in the xy-plane going from <0,0> to 
<1,1>

> The code I added to the union:
> 
You'll have to add uv_mapping and the texture to use to each patch, not 
only to the union. Also you may need to add the uv_vectors. If you use
uv_vectors  <0,0>,<1,0>,<1,1>,<0,1>, this wil map the texture in the 
above mentioned area to each patch. If you want to to map your image 
over several patches yoou'll have to divide the uv_vectors to smaller 
areas. See example below.

---%<------%<---
#version unofficial MegaPov 0.7
global_settings{assumed_gamma 1}
camera {location <0,0,-3> look_at 0}
light_source { <500,500,-500> rgb 1 }

#declare Bic_Tex=texture { 
   pigment {
      wood
      frequency 4
      turbulence 0.1
      octaves 7
      lambda 0.5
      omega 0.5
      color_map {
         [0, rgb 0]
         [1, rgb 1]
      }  
   }
   translate <0.25,0.5,0>
}

union{
bicubic_patch {
   type 1 
   flatness 0 
   u_steps 3 
   v_steps 3
   <0,0   ,0>,<0.33,0   ,0>,<0.67,0   ,0>,<1,0   ,0>
   <0,0.33,0>,<0.33,0.33,0>,<0.67,0.33,0>,<1,0.33,0>
   <0,0.67,0>,<0.33,0.67,0>,<0.67,0.67,0>,<1,0.67,0>
   <0,1   ,0>,<0.33,1   ,0>,<0.67,1   ,0>,<1,1   ,0>

   //uv_vectors  <0,0>,<0.5,0>,<0.5,0.5>,<0,0.5>
   uv_mapping
   texture {Bic_Tex}
   translate <-1,-1,0>
   
}

bicubic_patch {
   type 1 
   flatness 0 
   u_steps 3 
   v_steps 3
   <0,0   ,0>,<0.33,0   ,0>,<0.67,0   ,0>,<1,0   ,0>
   <0,0.33,0>,<0.33,0.33,0>,<0.67,0.33,0>,<1,0.33,0>
   <0,0.67,0>,<0.33,0.67,0>,<0.67,0.67,0>,<1,0.67,0>
   <0,1   ,0>,<0.33,1   ,0>,<0.67,1   ,0>,<1,1   ,0>

   uv_vectors <0.5,0>,<1,0>,<1,0.5>,<0.5,0.5>
   uv_mapping
   texture {Bic_Tex}
   translate <0,-1,0>
}

bicubic_patch {
   type 1 
   flatness 0 
   u_steps 3 
   v_steps 3
   <0,0   ,0>,<0.33,0   ,0>,<0.67,0   ,0>,<1,0   ,0>
   <0,0.33,0>,<0.33,0.33,0>,<0.67,0.33,0>,<1,0.33,0>
   <0,0.67,0>,<0.33,0.67,0>,<0.67,0.67,0>,<1,0.67,0>
   <0,1   ,0>,<0.33,1   ,0>,<0.67,1   ,0>,<1,1   ,0>

   uv_vectors  <0,0.5>,<0.5,0.5>,<0.5,1>,<0,1>
   uv_mapping
   texture {Bic_Tex}
   translate <-1,0,0>
}

bicubic_patch {
   type 1 
   flatness 0 
   u_steps 3 
   v_steps 3
   <0,0   ,0>,<0.33,0   ,0>,<0.67,0   ,0>,<1,0   ,0>
   <0,0.33,0>,<0.33,0.33,0>,<0.67,0.33,0>,<1,0.33,0>
   <0,0.67,0>,<0.33,0.67,0>,<0.67,0.67,0>,<1,0.67,0>
   <0,1   ,0>,<0.33,1   ,0>,<0.67,1   ,0>,<1,1   ,0>

   uv_vectors  <0.5,0.5>,<1,0.5>,<1,1>,<0.5,1>
   uv_mapping
   texture {Bic_Tex}
}
rotate <0,0,45>
}
---%<------%<---





Ingo

-- 
Photography: http://members.home.nl/ingoogni/
Pov-Ray    : http://members.home.nl/seed7/


Post a reply to this message

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