UVTexture - Cylindrical perfect mapping

   197   6   2
User Avatar
Member
35 posts
Joined: April 2017
Offline
Need some help.
I want to map a texture using UVTexture - Cylindrical type.
All goes fine when the box is 1x1x1 meters.
As long the box changes the proportions in x , y , or z the texture is distorsed.

¿¿Is there a perfect formula to fix it and get near-perfect quads in the mapping???

Attachments:
UVTexture_Cilindrical_Map.jpg (128.5 KB)

User Avatar
Member
247 posts
Joined: Sept. 2013
Offline
For boxes and rectangular surfaces you could just use cubic mapping:
http://forums.odforce.net/topic/18451-uv-cubic-map-procedurally/ [forums.odforce.net]
www.konstantinmagnus.de
User Avatar
Member
35 posts
Joined: April 2017
Offline
Hi again Konstantin,
its not for a perfect box. Its for a chimeney.. it has bevel surfaces on borders(polybevel) and one curvature in center (polyextrude + curvature).
I can control at tall in Y. The problem comes when changing chimeney size X and Z.
Edited by bhbilbao - Sept. 13, 2017 21:04:36

Attachments:
UVTexture_cycilndrical_bevel_curvature.jpg (102.0 KB)

User Avatar
Member
247 posts
Joined: Sept. 2013
Offline
I´d still say use cubic mapping.
Edited by Konstantin Magnus - Sept. 14, 2017 02:17:54

Attachments:
pillar.hipnc (145.2 KB)
cubic_pillar.jpeg (176.8 KB)
cubic_pillar2.jpeg (69.0 KB)

www.konstantinmagnus.de
User Avatar
Member
35 posts
Joined: April 2017
Offline
That image you posted here looks fine.
Yesterday, I tried the vertex wrangle you posted, and didnt worked for me.

The -X, X primitives UVs are rotated 90º down.

Attribute Wrangle(Vertices):
vector bbox = relbbox(0, @P);
vector side = sign(@N);
vector nml = abs(@N);

vector size = getbbox_size(0);
vector ratio = size / max(size);
vector scale = bbox * ratio;

//if (nml.x == max(nml)) { @uv = set(-scale.z * side.x, scale.z, 0); }
if (nml.x == max(nml)) { @uv = set(scale.y * side.x, scale.z, 0); }
else if (nml.y == max(nml)) { @uv = set(scale.x * side.y, scale.z, 0); @uv.y += 1; }
else { @uv = set(scale.x * side.z, scale.y, 0); @uv.y += 2; }

@uv *= 0.3333;
@uv.x += 0.5;

Attachments:
UVtexture_attwrangle_fix.jpg (100.7 KB)

User Avatar
Member
247 posts
Joined: Sept. 2013
Offline
You probably have to switch two vector components in the code or so. I will look into it over the weekend.
www.konstantinmagnus.de
User Avatar
Member
247 posts
Joined: Sept. 2013
Offline
vector bbox = relbbox(0, @P);
vector side = sign(@N);
vector nml = abs(@N);

vector size = getbbox_size(0);
vector ratio = size / max(size);
vector scale = bbox * ratio;

if (nml.x == max(nml)) { @uv = set(-scale.z, scale.y * side.x, 0); }
else if (nml.y == max(nml)) { @uv = set(scale.x * side.y, -scale.z, 0); @uv.y += 1; }
else { @uv = set(scale.x * side.z, scale.y, 0); @uv.y += 2; }

@uv *= 0.3333;
@uv.x += 0.5;
www.konstantinmagnus.de
  • Quick Links