UVTexture - Cylindrical perfect mapping

   6654   18   5
User Avatar
Member
67 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
682 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]
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
67 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 bhb - Sept. 13, 2017 21:04:36

Attachments:
UVTexture_cycilndrical_bevel_curvature.jpg (102.0 KB)

User Avatar
Member
682 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)

https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
67 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
682 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.
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
682 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;
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
67 posts
Joined: April 2017
Offline
Hi again Konstantin Magnus,
I tried your fix and the faces are oriented right, but the problem is in the edges, .. the textures are not aligned well.
That method you described is great for fast uv-mapping and paint after outside with Allegorithmic Painter or Mari.
User Avatar
Member
682 posts
Joined: Sept. 2013
Offline
What do you mean? The script is just doing cubic UV mapping. All it does is dividing UV islands by the primitives main orientation. And its mapping straight from the sides.

Maybe append a UVlayout node, but it´s a bit hard to tell what you are after.
Edited by Konstantin Magnus - Oct. 21, 2017 08:45:08
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
67 posts
Joined: April 2017
Offline
Texture pattern doesnt warp around right.

Attachments:
Texture_pattern_wrap.jpg (131.5 KB)

User Avatar
Member
483 posts
Joined: Dec. 2006
Offline
What about simply adding some cuts?
Or, maybe “easier”, use a procedural stone shader?
Edited by matthias_k - Oct. 22, 2017 11:03:51

Attachments:
uv-test.hip (138.5 KB)

English is not my native language, sorry in advance for any misunderstanding :-)
User Avatar
Member
67 posts
Joined: April 2017
Offline
Same problem. The pattern dont coincide where the seams are cutted.

Attachments:
cut_seam.jpg (75.0 KB)

User Avatar
Member
483 posts
Joined: Dec. 2006
Offline
Hi, that's right, but you can manually remove the cuts.
I made them to avoid distortions.
Maybe then UV edit/move the points.

If I'm right, then you'll need for perfect fit,
a volume based shader or real geometry.
Edited by matthias_k - Oct. 22, 2017 11:42:55
English is not my native language, sorry in advance for any misunderstanding :-)
User Avatar
Member
682 posts
Joined: Sept. 2013
Offline
If you want all projections to line up, you have got to simplify the code a little:

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); }
else                        { @uv = set(scale.x * side.z, scale.y, 0);  }

@uv = abs(@uv);
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
67 posts
Joined: April 2017
Offline
Better but not perfect. Line-seams in the edges.

Attachments:
Chimneys_sizesXZ.jpg (158.4 KB)

User Avatar
Member
483 posts
Joined: Dec. 2006
Offline
A texture can not work on a diagonal in/outset in my opinion.
Only if you repaint it, to match the border.
What about using real geometry, then project to lowres geometry?

Attachments:
wall_test_b.hip (779.5 KB)
wall_test.jpg (309.0 KB)
wall_test_b.jpg (248.0 KB)
why_i_prefere_real_geometry_here.jpg (242.5 KB)

English is not my native language, sorry in advance for any misunderstanding :-)
User Avatar
Member
67 posts
Joined: April 2017
Offline
That is Mathias, the code supported by Konstantin is very good if we want to paint after outside in Mari or Substance Painter. There are little seams that are appreciated when the camera is near them.

I tried another way using node UVProject (Cylindrical). But same as UVTexture, when the proportions of the chimney changes the texture 1:1 ratio distorses.


For the “real geomtry projected” I will try soon the file you uploaded. Thanks.
Edited by bhb - Oct. 22, 2017 15:03:34

Attachments:
uv_project_cylindrical.jpg (261.9 KB)

User Avatar
Member
483 posts
Joined: Dec. 2006
Offline
If you need it only on the sides, with small convex shape…
then maybe define first UVs, then deform.
This should give a perfect match, if the texture is seamless.


Ups, vertical line should have same point count like the lattice deformer (4)
Edited by matthias_k - Oct. 22, 2017 15:38:09

Attachments:
other_way.hip (307.1 KB)
other_way.jpg (247.7 KB)

English is not my native language, sorry in advance for any misunderstanding :-)
User Avatar
Member
483 posts
Joined: Dec. 2006
Offline
Better…
to change the width, depth, modify the “curve1”, the multiplier for the UVs
is:
vertical the height of the “line1”
horizontal the point count of “curve1”
with this 2 values in mind you can easilly add a UV transform and set right multiplier.
Edited by matthias_k - Oct. 22, 2017 15:50:09

Attachments:
other_way.hip (308.4 KB)

English is not my native language, sorry in advance for any misunderstanding :-)
  • Quick Links