POV-Ray : Newsgroups : povray.general : Scaling mesh2 objects with uv_vectors Server Time
23 Nov 2024 20:54:41 EST (-0500)
  Scaling mesh2 objects with uv_vectors (Message 1 to 4 of 4)  
From: Chris R
Subject: Scaling mesh2 objects with uv_vectors
Date: 9 Aug 2022 11:15:00
Message: <web.62f2791756acd0a064326bc25cc1b6e@news.povray.org>
I have been playing with some code for modeling paper using mesh2 objects.  The
code starts with a flat rectangle for the paper and creates the vertices based
on the size of paper I want.  It creates uv coordinates in that same range,
assuming that any texture I apply later will be scaled to the size of the paper.
 I then have various options for adding wrinkles, bends, scrolls, etc. to the
paper, which moves the vertices around, but leaves the original uv coordinates.

This was all working fine until I decided to scale one of the mesh2 objects (by
2), and scale the texture by the same amount.  When I rendered the object,
however, the texture (I used an image map), was 2x too big.

Does scaling a mesh2 object only scale the vertices and not the uv_vectors?  If
so, am I better off creating the uv_vectors with some constant scale and
ensuring that the texture is also kept at that constant scale?

-- Chris R.


Post a reply to this message

From: William F Pokorny
Subject: Re: Scaling mesh2 objects with uv_vectors
Date: 9 Aug 2022 12:09:09
Message: <62f286a5$1@news.povray.org>
On 8/9/22 11:11, Chris R wrote:
> This was all working fine until I decided to scale one of the mesh2 objects (by
> 2), and scale the texture by the same amount.

It should be, once you have created your initial uv textured object, you 
can create a 2x sized version of it with:

object { MyPaperMesh scale 2 }

In other words, the 2x scaling of your texture is not needed and I think 
the answer to you final questions are yes.

Bill P.


Post a reply to this message

From: Chris R
Subject: Re: Scaling mesh2 objects with uv_vectors
Date: 9 Aug 2022 16:00:00
Message: <web.62f2bb9fb5e8547364326bc25cc1b6e@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:
> On 8/9/22 11:11, Chris R wrote:
> > This was all working fine until I decided to scale one of the mesh2 objects (by
> > 2), and scale the texture by the same amount.
>
> It should be, once you have created your initial uv textured object, you
> can create a 2x sized version of it with:
>
> object { MyPaperMesh scale 2 }
>
> In other words, the 2x scaling of your texture is not needed and I think
> the answer to you final questions are yes.
>
> Bill P.
Thanks.  I am reworking the mesh-creation code and how I use the mesh in my
scenes to account for that.


-- Chris R.


Post a reply to this message

From: Alain Martel
Subject: Re: Scaling mesh2 objects with uv_vectors
Date: 10 Aug 2022 11:50:40
Message: <62f3d3d0$1@news.povray.org>
Le 2022-08-09 à 11:11, Chris R a écrit :
> I have been playing with some code for modeling paper using mesh2 objects.  The
> code starts with a flat rectangle for the paper and creates the vertices based
> on the size of paper I want.  It creates uv coordinates in that same range,
> assuming that any texture I apply later will be scaled to the size of the paper.
>   I then have various options for adding wrinkles, bends, scrolls, etc. to the
> paper, which moves the vertices around, but leaves the original uv coordinates.
> 
> This was all working fine until I decided to scale one of the mesh2 objects (by
> 2), and scale the texture by the same amount.  When I rendered the object,
> however, the texture (I used an image map), was 2x too big.
> 
> Does scaling a mesh2 object only scale the vertices and not the uv_vectors?  If
> so, am I better off creating the uv_vectors with some constant scale and
> ensuring that the texture is also kept at that constant scale?
> 
> -- Chris R.
> 
> 
As I understand it, UV mapping maps locations from the pattern to 
specific locations of the mesh. This have the effect that the pattern 
will follow any deformation of the mesh.

So, when scaling the mesh, the pattern should follow.
Solution : Just don't scale the image_map and you should be fine.


Post a reply to this message

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