POV-Ray : Newsgroups : povray.binaries.images : <no subject> Server Time
25 Dec 2024 00:54:10 EST (-0500)
  <no subject> (Message 1 to 2 of 2)  
From: muyu
Subject: <no subject>
Date: 31 Jan 2019 16:25:01
Message: <web.5c53670fc23a6d9a6ca73bb0@news.povray.org>
I would like to add the image texture to the mesh (wheat plant leaf). However,
the image could not attached on the mesh properly. It seems I need set
uv_vectors to control...I tried but not successful. Could you please show me how
to do that? Thanks.


    camera {
        perspective
        location <0.00,0.00,50.00>
        look_at <0.00,0.00,0.0>
        right <1,0,0>
        angle 10
        sky z
        rotate <20,0,0.00>
    }


light_source { <25, 25, 100> color rgb 1 }

#declare p_map6=pigment {image_map{png "wheat.png" interpolate 2}}

plane { <0,0,1>, 0 texture {pigment {color rgb <0.5,0.5,0>}} }

#declare leafmap=
texture{pigment {p_map6}}

#declare wheat =  union{
#declare GEOMID_329306648_155281880 = object {
  object {
    mesh2 {
      vertex_vectors { 20
      <0.214732,-0.119527,2.87786>, <0.182308,-0.159119,3.37809>,
<0.0760855,-0.323833,4.04767>, <0.0328297,-0.386392,4.30684>,
<-0.225844,-0.797652,5.10559>,
      <-0.425035,-1.12277,5.51566>, <-0.557483,-1.34125,5.71863>,
<-0.755441,-1.65093,6.01031>, <-1.00284,-2.00163,6.34971>,
<-1.34481,-2.49057,6.76999>,
      <-0.18809,0.104624,2.8803>, <-0.200009,0.0536224,3.38041>,
<-0.277783,-0.126922,4.04982>, <-0.305741,-0.197993,4.30889>,
<-0.511466,-0.638717,5.10732>,
      <-0.678944,-0.981479,5.5172>, <-0.792911,-1.21025,5.72006>,
<-0.949017,-1.54322,6.01148>, <-1.11348,-1.94007,6.35038>,
<-1.34481,-2.49057,6.76999>}
      normal_vectors { 17
      <0.48426,0.86917,0.100181>, <0.468033,0.838044,0.280405>,
<0.468033,0.838044,0.280405>, <0.417974,0.745479,0.51919>,
<0.359359,0.638382,0.680684>,
      <0.306156,0.541657,0.782864>, <0.306156,0.541657,0.782864>,
<0.306156,0.541657,0.782864>, <0.48426,0.86917,0.100181>,
<0.468033,0.838044,0.280405>,
      <0.468033,0.838044,0.280405>, <0.417974,0.745479,0.51919>,
<0.359359,0.638382,0.680684>, <0.306156,0.541657,0.782864>,
<0.306156,0.541657,0.782864>,
      <0.306156,0.541657,0.782864>, <0.284633,0.502614,0.816311>}
      face_indices  { 17
      <0,10,11>, <1,11,12>, <2,12,13>, <3,13,14>, <4,14,15>,
      <5,15,16>, <6,16,17>, <7,17,18>, <0,11,1>, <1,12,2>,
      <2,13,3>, <3,14,4>, <4,15,5>, <5,16,6>, <6,17,7>,
      <7,18,8>, <8,18,19>}
      normal_indices  { 17
      <0,0,0>, <1,1,1>, <2,2,2>, <3,3,3>, <4,4,4>,
      <5,5,5>, <6,6,6>, <7,7,7>, <8,8,8>, <9,9,9>,
      <10,10,10>, <11,11,11>, <12,12,12>, <13,13,13>, <14,14,14>,
      <15,15,15>, <16,16,16>}
      texture { leafmap }
    }
    rotate <0,-0,85.2711>
  }
  translate <0.714286,0,0>
}
object {
  GEOMID_329306648_155281880
}
}

object {wheat double_illuminate hollow}


Post a reply to this message


Attachments:
Download 'wheat.png' (120 KB)

Preview of image 'wheat.png'
wheat.png


 

From: Thomas de Groot
Subject: Re: <no subject>
Date: 1 Feb 2019 02:37:01
Message: <5c53f71d@news.povray.org>
On 31-1-2019 22:22, muyu wrote:
> I would like to add the image texture to the mesh (wheat plant leaf). However,
> the image could not attached on the mesh properly. It seems I need set
> uv_vectors to control...I tried but not successful. Could you please show me how
> to do that? Thanks.
> 
> 
>      camera {
>          perspective
>          location <0.00,0.00,50.00>
>          look_at <0.00,0.00,0.0>
>          right <1,0,0>
>          angle 10
>          sky z
>          rotate <20,0,0.00>
>      }
> 
> 
> light_source { <25, 25, 100> color rgb 1 }
> 
> #declare p_map6=pigment {image_map{png "wheat.png" interpolate 2}}
> 
> plane { <0,0,1>, 0 texture {pigment {color rgb <0.5,0.5,0>}} }
> 
> #declare leafmap=
> texture{pigment {p_map6}}
> 
> #declare wheat =  union{
> #declare GEOMID_329306648_155281880 = object {
>    object {
>      mesh2 {
>        vertex_vectors { 20
>        <0.214732,-0.119527,2.87786>, <0.182308,-0.159119,3.37809>,
> <0.0760855,-0.323833,4.04767>, <0.0328297,-0.386392,4.30684>,
> <-0.225844,-0.797652,5.10559>,
>        <-0.425035,-1.12277,5.51566>, <-0.557483,-1.34125,5.71863>,
> <-0.755441,-1.65093,6.01031>, <-1.00284,-2.00163,6.34971>,
> <-1.34481,-2.49057,6.76999>,
>        <-0.18809,0.104624,2.8803>, <-0.200009,0.0536224,3.38041>,
> <-0.277783,-0.126922,4.04982>, <-0.305741,-0.197993,4.30889>,
> <-0.511466,-0.638717,5.10732>,
>        <-0.678944,-0.981479,5.5172>, <-0.792911,-1.21025,5.72006>,
> <-0.949017,-1.54322,6.01148>, <-1.11348,-1.94007,6.35038>,
> <-1.34481,-2.49057,6.76999>}
>        normal_vectors { 17
>        <0.48426,0.86917,0.100181>, <0.468033,0.838044,0.280405>,
> <0.468033,0.838044,0.280405>, <0.417974,0.745479,0.51919>,
> <0.359359,0.638382,0.680684>,
>        <0.306156,0.541657,0.782864>, <0.306156,0.541657,0.782864>,
> <0.306156,0.541657,0.782864>, <0.48426,0.86917,0.100181>,
> <0.468033,0.838044,0.280405>,
>        <0.468033,0.838044,0.280405>, <0.417974,0.745479,0.51919>,
> <0.359359,0.638382,0.680684>, <0.306156,0.541657,0.782864>,
> <0.306156,0.541657,0.782864>,
>        <0.306156,0.541657,0.782864>, <0.284633,0.502614,0.816311>}
>        face_indices  { 17
>        <0,10,11>, <1,11,12>, <2,12,13>, <3,13,14>, <4,14,15>,
>        <5,15,16>, <6,16,17>, <7,17,18>, <0,11,1>, <1,12,2>,
>        <2,13,3>, <3,14,4>, <4,15,5>, <5,16,6>, <6,17,7>,
>        <7,18,8>, <8,18,19>}
>        normal_indices  { 17
>        <0,0,0>, <1,1,1>, <2,2,2>, <3,3,3>, <4,4,4>,
>        <5,5,5>, <6,6,6>, <7,7,7>, <8,8,8>, <9,9,9>,
>        <10,10,10>, <11,11,11>, <12,12,12>, <13,13,13>, <14,14,14>,
>        <15,15,15>, <16,16,16>}
>        texture { leafmap }
>      }
>      rotate <0,-0,85.2711>
>    }
>    translate <0.714286,0,0>
> }
> object {
>    GEOMID_329306648_155281880
> }
> }
> 
> object {wheat double_illuminate hollow}
> 

It appears to me that your mesh2{} block is not complete. In order to do 
proper uv_mapping it should have the following component blocks:

vertex_vectors{}
normal_vectors{}
uv_vectors{}
face_indices{}
uv_indices{}
normal_indices{}

or, at least, that is how my own mesh2{} objects are built up.

Editing mesh2{} objects is /absolutely not/ trivial, and the best you 
can do is (1) go to the program that generated the object in the first 
place, (2) apply an appropriate uv_map to the object, (3) save/export 
the object and open it in Poseray, (4) export as a mesh2{} object to be 
rendered with POV-Ray. That should do the trick.

-- 
Thomas


Post a reply to this message

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