Sat, Jan 18, 12:36 PM CST

Renderosity Forums / Poser - OFFICIAL



Welcome to the Poser - OFFICIAL Forum

Forum Coordinators: RedPhantom

Poser - OFFICIAL F.A.Q (Last Updated: 2025 Jan 18 10:25 am)



Subject: Correctly UV-Mapped Elliptical Cylinder


kawecki ( ) posted Wed, 29 August 2012 at 3:18 AM · edited Sat, 18 January 2025 at 12:32 PM

Attached Link: http://www.renderosity.com/mod/rrfilelock/download.php?fileid=46374&key=5863

file_485829.jpg

There is no problem to map a cylinderwhose cross-section is a circle, but when it becomes an ellipse the texturing goes wrong. The texture is expanded in the middle and compressed at the sides. The distortion becomes increased as the eccentricy of the ellipse is increased.

After breaking my head, I managed to solve this problem and now I am able to correctly UV map with an uniform texture distribution for any cylinder with any eccentricity, ranging from 0 (circle) to 1 (plane).

The example is in obj format.

Stupidity also evolves!


basicwiz ( ) posted Wed, 29 August 2012 at 8:55 AM

So, how did you fix it?


ockham ( ) posted Wed, 29 August 2012 at 2:41 PM · edited Wed, 29 August 2012 at 2:43 PM

I've done it by brute-force:  Make a circular cylinder in Amapi, UV map it in UVmapper, then take it back to Amapi and reshape it.

Wonder if Kawecki has a more 'elegant' way to do it? 

Watching........

 

My python page
My ShareCG freebies


PhilC ( ) posted Wed, 29 August 2012 at 4:33 PM

Use the UV mapper "relax" option?


manoloz ( ) posted Wed, 29 August 2012 at 6:33 PM

file_485849.jpg

I took a quick look, and to make it look as in the screenshot was: 1. Re-uv-ed in Silo to make sure the UVs were evenly spaced without distortion. However, this generated the problem that the UVs only used some 50% of the UV space, so 50% of the texture (whatever it would be eventually) would be wasted, so I 2. Stretched vertically the UVs to use all available UV space. Then, in the Gimp I grabbed my UV test image, and made a 2:1 version. That is to say, a 2048x1024 version. When I applied it as a texture in Silo, the image in the UV view looks stretched, but as you can see in the screenshot, it looks fine in the 3d viewport. Compensating the UV stretching with the texture's proportion size.

still hooked to real life and enjoying the siesta!
Visit my blog! :D
Visit my portfolio! :D


kawecki ( ) posted Wed, 29 August 2012 at 9:55 PM · edited Wed, 29 August 2012 at 9:59 PM

How I did it?

Well, the solution of the problem is nothing easy. I shall try to explain in a way as simple as I can.

To have an uniform distribution of the texture map applied to a curved surface, the UV coordinates must be proportional to the perimeter or arch lenght of the curve.

The simplest case is a plane, as the curve is nothing more than a line, the texture coordinate becomes the plane coordinate  u = x , v = y  scaled by a factor to fit into the uv range, generaly 0.0 to 1.0

Next cames a cylinder. It is a little more complicated, but still continues to be very simple. One UV coordinate is a simple line (the height of the cylinder) so v = y and the other coordinate u is the perimeter of a circle.

The perimeter of a circunferrence is something very simple and it is proportional to the arch angle, so we have u = angle. To find the angle of a point along the perimeter of the circle, we only need basic school trigonometric functions, sinus, cosinus, etc. This functions any calculator does, any software routine has and even are implemented in the CPU of a computer.

Here ends the easy story. If we have an ellipse instead of a circle, things go ugly. No school knowledge can solve this. Now we need University grade and advanced calculus. The solution for the arch length of an ellipse is the incomplete elliptical integral of the second kind. Nice name, but the problem doesn't end here. This integral has no exact solution. To solve the integral it must be expanded into series. It was done and results were tabulated one or two centuries ago, but still contine to be something nothing common in our lives. This integral is part of what we know as "speciall functions". Common scientific calculator don't have them, we need a calculator with speciall functions. There are also software routines and libraies that can calculate this integral.

Stupidity also evolves!


kawecki ( ) posted Wed, 29 August 2012 at 10:02 PM

file_485857.jpg

For whom likes advanced math, the solution of the problem

Stupidity also evolves!


kawecki ( ) posted Wed, 29 August 2012 at 10:17 PM

Well, now I have the math base needed, but how I do it? I can use some software package to solve this integral and I found some after some day of web search. But there is also another big problem. The calculation is time consuming, for today computers it means nothing, but if we want to map meshes with tens or hundreds thousands polygons it will take some time to do it, well rendering an image takes much more, but I wanted to find another and faster way to do it.

My idea was to approximate the solution, I don't need an exact solution, I am not going to land in Mars with this. An error of one percent would be something beautiful and nobody will see any difference in the texturing. I wanted to approximate this integral with something basic mathematical operations and basic mathematical functions.

After two or three weeks of work I found something very simple with an error of less than 1.5% and it took me half of an hour to code and include into a software app.

Stupidity also evolves!


kawecki ( ) posted Wed, 29 August 2012 at 10:18 PM

file_485860.jpg

The approximation

Stupidity also evolves!


kawecki ( ) posted Wed, 29 August 2012 at 10:27 PM · edited Wed, 29 August 2012 at 10:27 PM

The inverse problem.

The second problem was that I wanted to build a mesh of an ellipse with uniform lenght of the faces. Any edge of a face along the perimeter of the ellipse has the same length.

The mathematical solution is the inverse of the incomplete elliptic integral of the second kind, nice name again, but this time I was unable to find a software package, library or related maths. What do exist is the inverse of the elliptical integral of the first kind (Jacobian functions), but nothing about the second kind. Until now I was unable to find the exact solution.

What I did was also another approximation with an error less of one percent. I have not implemented it in any software yet

Stupidity also evolves!


dadt ( ) posted Thu, 30 August 2012 at 2:38 AM

file_485875.jpg

I cannot see any problem here. I made an elliptical cylinder in Wings and UV mapped it and the texture is not stretched.

The distortion only happens if you UV map the cylinder and then make it elliptical.


kawecki ( ) posted Thu, 30 August 2012 at 2:55 AM

I don't know how Wings works, maybe it maps correctly an elliptical cylinder, but Rhino 4 does not !

Stupidity also evolves!


dadt ( ) posted Thu, 30 August 2012 at 3:19 AM

file_485877.jpg

This is the UV map


kawecki ( ) posted Thu, 30 August 2012 at 3:20 AM

file_485878.jpg

I have mapped something that is neither a cylinder nor an ellipse. The elliptical mappig produce better texturing.

Stupidity also evolves!


dadt ( ) posted Thu, 30 August 2012 at 3:25 AM

I did not use cylindrical mapping, I used unfolding.

 


kawecki ( ) posted Thu, 30 August 2012 at 3:45 AM

file_485879.jpg

Another example

Stupidity also evolves!


MistyLaraCarrara ( ) posted Thu, 30 August 2012 at 8:57 PM

integrals magick.

 

would this work for mapping an egg shape?

i been stumped for months on mapping a dragon egg for seamlessness. playing with the geodome in wings



♥ My Gallery Albums    ♥   My YT   ♥   Party in the CarrarArtists Forum  ♪♪ 10 years of Carrara forum ♥ My FreeStuff


kawecki ( ) posted Thu, 30 August 2012 at 9:18 PM · edited Thu, 30 August 2012 at 9:19 PM

Quote - would this work for mapping an egg shape?

You can map an ellipsoid, you only need to do the same with the y coordinate.

An egg is not an ellipsoid, but is similar so the mapping will work fine even not exactly.

Stupidity also evolves!


Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.