|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi,
I've been trying to test UV mapping using the mesh object directive. A
problem I've been unable to solve since the days of MegaPOV is that the UV
mapped texture is applied to the mesh using the same colour of the first
pixel in the positive direction of the { <0,0>,<1,1> } square in the XY
plane. Applying the same texture to a sphere, for instance, works okay. Is
it me that I haven't really understood the meaning of UV mapping? If that's
so, please forgive me. Below follows an example of a sphere and a triangle
mesh with different behaviours.
warm regards,
arthur
/*******************************
* File: Mesh_Test.pov
* Testing UV Mapping using the
* mesh {} object
*******************************/
camera {
location <6,0,-80>
look_at <10,0,0>
angle 35
orthographic
}
light_source { <100,100,-100> color rgb <1,1,1> }
light_source { <-100,-100,-100> color rgb <1,1,1> }
/* -----------------------------
Render Controls
----------------------------- */
#declare trace_sphere = 1;
#declare trace_mesh = 1;
/* ------------------------------
Textures
------------------------------ */
#declare White = pigment { color rgb <1,1,1> }
#declare Checkerboard = pigment {
checker
color rgb <0,0,1>
color rgb <0,1,0>
scale 0.2
}
/* ------------------------------
Objects
------------------------------ */
#if (trace_sphere = 1)
sphere {
0,10
uv_mapping
pigment { Checkerboard }
}
#end
#if (trace_mesh = 1)
mesh {
triangle { <0,0,0>,<3,1,1>,<6,0,0> }
triangle { <0,0,0>,<3,-2,0>,<6,0,0> }
scale 3
translate 15*x
uv_mapping
pigment { Checkerboard }
}
#end
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
in news:3ba4f6e6@news.povray.org Arturo Gonzalez wrote:
> Applying the same texture to a sphere, for instance, works okay.
for the mesh yoou have to add uv_vectors to the triangles, see 6.7.7.2.
Note to self: update syntax for mesh.
From your example, but with uv_vectors:
mesh {
triangle {
<0,0,0>,<3,1,1>,<6,0,0>
uv_vectors <0,0>,<1,0>,<1,1>
}
triangle {
<0,0,0>,<3,-2,0>,<6,0,0>
uv_vectors <0,0>,<0,1>,<1,1>
}
scale 3
translate 15*x
uv_mapping
pigment { Checkerboard }
}
Ingo
--
Photography: http://members.home.nl/ingoogni/
Pov-Ray : http://members.home.nl/seed7/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
news:Xns### [at] povrayorg...
> in news:3ba4f6e6@news.povray.org Arturo Gonzalez wrote:
>
> for the mesh yoou have to add uv_vectors to the triangles, see 6.7.7.2.
> Note to self: update syntax for mesh.
Dear Ingo,
Thank you for your kind response. I still can't understand the syntax very
much. Does this mean that if I have a mesh with a thousand triangles
imported from a modeller, I need to calculate three uv_vectors for each
triangle? Mmm... Well, I'm going to study this then. Thanks for all!
arthur
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Arturo Gonzalez <arg### [at] adinetcomuy> wrote:
: Does this mean that if I have a mesh with a thousand triangles
: imported from a modeller, I need to calculate three uv_vectors for each
: triangle?
If the modeller/converter does not export uv-coordinates to pov-format,
then there's little you can do.
For some reason it seems to be a very common misconception that uv-mapping
is something "automatic", that you just take a mesh and "turn uv-mapping on"
and that's it.
I don't understand where does this idea come from. UV-coordinates are no
different from vertex coordinates. They say for each vertex where to take
the texture for that vertex. This has to be modelled, it can't be automatically
calculated; povray can't think "ok, these triangles form an eye of the head,
so I'll put the uv-coordinates at the texture location where there's the eye
texture". It's the modeller which has to do this, not povray.
And of course the modeller or converter has to support reading and writing
uv-coordinates. If the modeller/converter doesn't write the uv-coordinates
to the pov-file, then they are simply lost and there's nothing you can do
about it. It's like writing triangle vertex indices but not the vertex
coordinates themselves: The indices are pretty useless by themselves.
--
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
3ba5ba6b@news.povray.org...
> For some reason it seems to be a very common misconception that
uv-mapping
> is something "automatic", that you just take a mesh and "turn uv-mapping
on"
> and that's it.
Hi Warp,
Thanks a lot for your comments. I had no idea about the real neccessity of
uv_vectors. I thought that they were only useful for a better control of the
texturing. I'll try to find some documentation on the uv_mapping procedure
to understand it better. Sorry, I thought this was a little bug. Mmm... but
the bug's on my head! :-)
arthur
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|