Home Technical Talk

Unwrapping a Sphere?

polycounter lvl 19
Offline / Send Message
TorQue[MoD] polycounter lvl 19
Hey all!

So I'm working on a model of the solar system and obviously have a lot of spheres that I need to unwrap. I didn't think this would be an issue when I started but now I'm finding that unwrapping a sphere without major seams or distortion is a lot harder than one would think and there really aren't any useful tutorials on the subject that I've been able to find.

Does anyone have any tips on how to do this properly in 3D Studio max? I would think pelt mapping a sphere would be an easy way to do it, but I can't seem to loose the distortion in the center area of the sphere.

Any help on this would be greatly appreciated.

Replies

  • DarthNater
    Offline / Send Message
    DarthNater polycounter lvl 10
    I usually cut my sphere in half along the middle loop and then make a 'half loop' cut from pole to pole. You have to be real good at hiding your seams, but it creates less distortion. I do things the hard way though so I'm sure someone (Vig) will come along and make me look like an ass...
  • Mark Dygert
    Quadsphere maybe?

    Start off with a box, unwrap it.
    Turbosmooth it once or twice until its a smooth sphere, might need to relax it.
    Assign all the faces to one smoothing group and you're good to go.
    Now you have a nice sphere made of all quads unwrapped in a predictable way.

    There's a quad sphere primitive shape plug-in for max, probably something for Maya too, otherwise you could just as quickly make it.

    Ha ha ha Darth you crack me up, thats a good method too, could probably easily apply it to a quadsphere too, instead of going with a box map?
  • Grobi
    I remember this image cropping up in a thread a while back;

    293diyf.jpg

    Basically, to make a quad sphere thats easier to unwrap than a regular sphere primitive you should start off with a cube, add a couple of segments to each axis and apply a spherify modifier, you'll be able to follow the example's here pretty easily after that.
  • DarthNater
    Offline / Send Message
    DarthNater polycounter lvl 10
    Yeah your method sounds easier. Never thought of starting with a cube. That's why I don't have a game job yet HA

    Anyway, here's a screenie of how I do it. I'm pretty good at making seams disappear with Photoshop (I'd say I'm more skilled in PS than I am at unwrapping) so you have to play off your strengths. Try Vig's method first, it makes a lot more sense HA.

    Untitled-2.jpg
  • TorQue[MoD]
    Offline / Send Message
    TorQue[MoD] polycounter lvl 19
    Thanks guys for responding so fast!

    Vig, I tried your idea of using a box and then just Msmoothing it a few times to turn it into a sphere but the problem there is it ends up at about 768 polys by the time it looks nicely spherical.

    I was talking to Kman and he pointed out that using a Geosphere with Octa for the Geodesic base type is a much better way to go about it and also makes the poly count much lower. He unwrapped a sphere for me and showed me how he laid it out which was quite good, however after playing around on my own for a bit, I realized that if I simply create a geosphere and load an unwrap onto it, Max unwraps the mesh perfectly without my help at all.
    mars_render.jpg

    It does have a bit of a seam at the top, but with a little work in photoshop, I could make it completely invisible. The only problem now is if I want to add some snowy areas to the poles, I'd need to re-unwrap the top and bottom and it might make a more obvious seam.

    Still, not bad for virtually no work. If anyone else has to do something similar, I definitely suggest using Octa Geospheres.
  • Piflik
    Offline / Send Message
    Piflik polycounter lvl 12
    For Snow Caps you can use simple Maps...one projecting planar from he top for the actuat texture, and one projecting cylindrical from the sides for a Mask...at least thats what I'd do...if you want, you can then bake it into on texture, using the original Unwrap...
  • TorQue[MoD]
    Offline / Send Message
    TorQue[MoD] polycounter lvl 19
    Thanks Piflik, I'll see about doing that!

    BTW, what size of a monitor do you work with? I've got a 40" tv hooked up to my computer with a 1920x1080 resolution and your website requires me to scroll to the right just to see the entire thing. You might want to scale it down just a smidgen :P

    Your models look pretty good otherwise :)
  • Piflik
    Offline / Send Message
    Piflik polycounter lvl 12
    Strange...it should always fill the complete width of the monitor...I used only relative width values...
  • Mark Dygert
    That kicks ass.

    /saved
  • TorQue[MoD]
    Offline / Send Message
    TorQue[MoD] polycounter lvl 19
    Vig? The fact that geospheres are automatically unwrapped? Are you kidding me? Is this the first time in polycount history that someone else told Vig how to do something? lol

    I thought you were the grand champion of max? Quick, brush it off like it was a freudian slip and you already knew how it worked!
  • vahl
    Offline / Send Message
    vahl polycounter lvl 18
    hey Peter !!!! how are you doing these days man ??? been so long :p

    (end of thread derailment :p)

    I'd go the geosphere route too, that or the sphere, but with a spherify kind of modifier on top to make it round without using too many polies :)
  • Mark Dygert
    Heh I get schooled all the time, won't be the last time =P
    Always learn something new.

    Now that you mention it, I remember it coming up in a previous "how do you unwrap a sphere" thread about a year ago. I think Mojokey brought up the geosphere? Because about that time I convinced our modelers to start using them for the eyes in our models (creepy wire views look like teeth). It saved enough polys we could do proper forehead wrinkles.

    I personally don't use them that much in stuff I make, as I hardly ever need just a sphere and I need something with clean straight edges that I can use to build other things with. The quadsphere is pretty good at that. It also ports over to a sculpting app a lot better than a geosphere or a regular sphere with poles.
  • TorQue[MoD]
    Offline / Send Message
    TorQue[MoD] polycounter lvl 19
    Hey Vahl! I'm great bud how are you doing? I've been keeping an eye on your portfolio and polycount postings, you've got some absolutely amazing stuff in there!

    I'm actually starting up a new project now that I met a useful programmer! Its a very small turn based space game actually hence the need for figuring out how to unwrap spheres :P

    Brutal as I'm sure you've figured out has been put on indefinite hold until it gets the proper funding it deserves!

    Vig, I don't believe you get schooled all the time, but I'm sure it happens occasionally. And see, what'd I tell you? It was a freudian slip of sorts... you just forgot that you knew the answer already :)

    Yeah they do look hella freaky in wire form, but hey, they work so what do I care? Lower poly too so that's always a bonus.
  • Scizz
    Offline / Send Message
    Scizz polycounter lvl 11
    Grobi wrote: »
    I remember this image cropping up in a thread a while back;

    293diyf.jpg

    Basically, to make a quad sphere thats easier to unwrap than a regular sphere primitive you should start off with a cube, add a couple of segments to each axis and apply a spherify modifier, you'll be able to follow the example's here pretty easily after that.

    The last picture. How do you get the sphere to unwrap like that? I normally use quad spheres but for doing a prop like a globe, I think unwrapping it this way would be more beneficial.
  • Eric Chadwick
    Select those edges on the model, then do a Pelt relax.
  • Scizz
    Offline / Send Message
    Scizz polycounter lvl 11
    OMG Thank you! Your a life saver.
  • JoshexDirad
    Hi, this will be my first post here if lag doesn't kill it. seriously theres a delay while typing. notepad copy pasta time.

    I too have been studying this, for exactly the same reasons.

    first off, I am a blender guy, so this help may need to be translated into Maxese.

    I just posted how to do this, here:
    https://blenderartists.org/t/spherical-unwraps/685424/2

    If you don't want to go there, another user posted a method thats almost perfect, but leaves gaps at the poles by turning a plane into a sphere and not merging the square faces near the poles into triangles thus allowing you to make a simple cylinder map to it.

    While that method is decent, it presents a problem, you can never ever merge the vertecies at the poles! otherwise you lose the extra edges which give you square UV faces to fill-in the texture space. If you merged them you’d suddenly be missing some texture space coverage and would see very obvious seams.

    However, not merging them will create surface normal inconsistency at the poles (dark spots). (keep in mind blender renders unmerged non-parallel edges as separate surfaces so reflections and shadows will not float over them properly.)

    But there is another way to get a perfect spherical map on a normal UV sphere. It CAN use 100% texture space as well. but it cannot handle generated textures NATIVELY, and will take some extra mapping steps.

    You probably never thought of mapping it corner to corner. that is to say you put the poles at any 2 diagonally opposite corners of the texture space and fill in the rest. It’ll take extra work to make the UV layout, but it’s worth it in the end. Just make sure you unwrap a blank sphere first then make copies with new duplicate materials for each object that way you don’t have to redo the UV layout each time…

    Technically you could use ANY good UV layout you want and get a seamless mapped sphere. It just takes extra steps in the mapping process, so if you don’t like the poles at the corners method, you can follow the following steps with your layout. (hint it will work for just about any shape even an Icosphere!)

    Step 1: make your UV layout how you think it will be best for your sphere. or how it NEEDS TO BE for your project’s aims.

    Step 2: For blender’s built-in generated textures (if using some other square or rectangle texture, ignore this step)

        on your sphere make any layers you need and any generated textures you want to apply, get them adjusted so they look good.
        on a UV unwrapped plane, load the sphere’s material(for a copy of the textures), then bake the generated textures to an image one layer at a time, save them each with easily findable names.

    Step 3: Make a new plane, subdivide it so it has the same number of faces as your sphere but for now maintain a rectangle or square outline.

    Step 4: Unwrap the plane to fill the texture bounds and load your intended sphere textures.

    Step 5: Modify the plane in Edit mode (you might want to open 2 copies of blender, so you can see your sphere’s UV outline while doing this) and adjust the faces of the plane to EXACTLY match the proportions etc. of the UV layout of the sphere!

    Step 6: put a camera above it angled down. set the render settings to not render the background, but instead render alpha. Change the output image format to a format that supports alpha (TGA, PNG, GIF) and switch the texture color settings to RGBA, Change the image proportions to match the proportions of your intended sphere images size on X and Y. adjust the camera height until the plane occupies the entire render area exactly (or until it will exactly match the Sphere’s UV layout (you see what I’m doing here?)).

    Step 7: back on the plane, set it to shadeless, render it 1 texture layer at a time and save each image as an easily understandable name. (I use NOR at the end of a normal map COL at the end of a Color map etc., I.E. Water128x128NOR.tga, Water128x128COL.tga)

    Step 8: on your sphere, import the images you just rendered as textures on your sphere, the UV layout should match exactly and you should not have any visible creases.

    Benefit: No bad normals at the poles, no gaps, blender sees the whole sphere as 1 surface so reflections and shadows flow over the whole sphere properly, everything is merged you don’t have to worry about accidental “select all”+“remove doubles” episodes. Complete coverage. Full control of the UV layout.

    This method is untested. It makes sense logically. I cannot guarantee generated textures will repeat correctly after being saved to an image, that may take some manual adjustment in The GIMP. (copy a small amount of the edges of the image to another layer or image, then delete 1 opposite side of each on X and Y from the original image, paste the opposite side’s pixels there, blend/smudge into place to remove any hard pixel edges.)

    I will be testing this at some point.

  • sacboi
    Offline / Send Message
    sacboi high dynamic range
    Hasn't Blender 2.8 / 2.9xx an extra objects preset mesh library/plugin which includes a quad sphere primitive!?

    Should take all of 5mins, if that! too manually unwrap in a predictable way as Mark Dygert commented 11 years ago upthread for Max.

    Or just simply subdivide a cube, without the hassle of dealing with poles.
  • JoshexDirad
    sacboi said:
    Hasn't Blender 2.8 / 2.9xx an extra objects preset mesh library/plugin which includes a quad sphere primitive!?

    Should take all of 5mins, if that! too manually unwrap in a predictable way as Mark Dygert commented 11 years ago upthread for Max.

    Or just simply subdivide a cube, without the hassle of dealing with poles.


    exactly, but, the point of my comment was not the shape, but method to generate and apply the texture to any UV map in a way that has no creases regardless the shape.


  • JoshexDirad


    I would like to bump this post to post the outcome.


    The system I proposed would Epic Fail if using normal maps. and did so.


    There is another system that I have come-up with and tested with normal maps. I almost have it perfect. controling the border margin of the map is the final step.


    What did I do?


    So you have to keep all edges of the UV islands actually CONNECTED on the image space. so nothing should attempt to flow over the edge and leave the software to attempt to put both sides of the texture space on repeat together. For this purpose you will need to do a "rupee" map with flat sides on the edges of the image space, and a pointy top and bottom in center image.


    Next you need to make 2 Materials. one for each side of the object. This is to ensure that you can control the TEXTURE normals later!


    Next you need to make one set of textures for each side. (so you can map each side to it's respective set of images)


    After that You will need to bake your textures to this UV face layout for both sides of the sphere. Island Pixel Margins are the only thing I have yet to perfect, in my software it looks like a border margin of 1 pixel should be roughly perfect. it's possible the UV map edges will have to leave a 1 pixel edge as well. it's also possible that there should be a 1 Pixel Edge AND TURN TEXTURE REPEAT OFF (use Clipped, Extend etc. instead). this is my intuition of how to fix it.


    Finally after all your baked images are applied, MAKE SURE ALL THE NORMALS ARE BEING APPLIED TO THE SAME INTENSITY!!!, select the normal maps on each side individually one at a time and use Trial and Error to get the right combination of Positive and Negative TEXTURE normal calculation. if done right the UV space texture normal Crease should completely disappear leaving you to only have to deal with Mipmap/ border pixel margins etc to perfect it.


    over and done.


    Edit: Additional info: SUBSURFS WILL MURDER THIS DELICATE SYSTEM IRREPERABLY. this means you CANNOT let the software automatically smooth the model into a billion polygons for you. you will need to work manually with a model of the desired complexity.

    "Hard to follow, some screenshots would really help here." -Eric


    ok I don't know if I'll do step by step images but I'll post a few that show the UV outlines and the final outcome. There is a minor seam, it's worst at the poles, it's just a texture based seam so I might have to expand the margin at the poles and manually edit the textures to include a larger margin near the poles and a smaller margin elsewhere.


    Each side should have a "rupee" UV face outline, here we see the Positive X Axis Side of the texture., there needs to be a separate texture for the negative side. Also BOTH sides of the sphere's UV outline should be exactly overlaid to match eachother so that all the UV edges bewteen the 2 sides meet in texture space.


    final outcome (Old Blender GE) (So far)


  • Eric Chadwick

    Hard to follow, some screenshots would really help here.

  • JoshexDirad

    Bump

    So, as good as that was, I found yet another way to do this. a way thats better.

    I call it the "Top-Centered Flared" method. It is completely seamless over 90% of the object even with normals applied. It takes a lot of work to do it though. And some of the information may not translate so well to your software package.


    the Idea is to use a typical UV Sphere, create equadistant rings each one bigger than the last onto the UV map. starting from the top in the center and working out towards the bottom at the edge of the image space then scale it Line by line till it hits the end of the image space ("Squaring" it).


    On the 3D end you will need to subdivide the pole pointing edges of the "South pole" and remove the central vertex then AFTER baking (based on World and Sphere MapInput); scale this ring to 0 in 3D space and match it to the negative offset of the top pole position(if the top is 1.000 , then bottom will be -1.000).

    Images will have to be Baked to this layout. (Tested!!! Works wonders!)


    the only downside is much like the flat plane ToSphere method or the geosphere method theres some puckering of the texture at the "South" pole, however unlike the Plane to Sphere method or geosphere method; it is ONLY at the south pole(plane to sphere/geosphere has puckering at North AND South). meaning in the Top Centered method, the northpole and the rest have no such "puckered" seam.


    This does mean you'll need 2 models a North and a South, and you'll need Code to tell the software to load the corresponding model when you(the camera) are above or below it's equator. then it appears to be seamless in entirety.


    Making this UV layout takes a lot of careful calculation of ring scaling, and time, and good use of the "limit faces to image bounds" feature. it is not the kinda thing you want to do for each new sphere or progress would be VERY slow (can be done in an hour and a half casually) the alternative is you will want to have a north and south set of "Baking" models, and a North and south set of "Finished" models. This way you can just change the Global+Sphere image on the Baking models to any image and bake, then merely make a copy of the "Finished" models and apply the baked images.


    This is very complicated. but it looks something like this (North) (this is a 32 vertex 32 ring UV sphere so it has 1024 faces the same texture can be applied to any other sized UV sphere so long as you unwrap it the same):


    if I come up with yet a better way I'll let you know, but so far so good.

  • Neox
    Offline / Send Message
    Neox veteran polycounter

    sounds like something you'd want a script to do for you :o

  • Joopson
    Offline / Send Message
    Joopson quad damage

    Sounds kind of like you're trying to re-invent map projections?

    The general agreement is, every method has its drawbacks, and there's always a trade-off between distortion and number of seams (as with all/most UV mapping)— but it's an interesting topic at any rate.

    https://en.wikipedia.org/wiki/List_of_map_projections

  • JoshexDirad

    https://en.wikipedia.org/wiki/Peirce_quincuncial_projection

    this was the original ideal I had, however this would have created major southern seams.


    So I ended up doing something between that and https://en.wikipedia.org/wiki/Azimuthal_equidistant_projection


    it would be nice to make a script to do it yes, in python I could do it. but, meh, preparing two mapping models for baking is just easier than losing myself in geometrical logic.


    The downside to this method is you'll need a large image area for clarity. with a 1024x1024 image this is 16 pixels between rings for a 32 ring sphere. which is not very clear. however mipmap really helps smooth it out.


    After thinking about it over night, the best thing to do will be to manually create distance models. so for a close up view of a planet maybe 8192x8192, where as if it's a smaller object (like a ball) 512x512 might do for the closeup, but if it's farther away, like the moon, even a planet could be 512x512. remember this is based on camera distance. so a telescope camera could trigger a higher res model and texture to spawn. and if somethign is even further away, maybe consider very small textures, 32x32 or 64x64

  • Tiles
    Offline / Send Message
    Tiles greentooth

    Why not simply sds a cube, and map it into 6 pieces? That way you have the most equal texel density everywhere. The pole of a sphere is always the biggest trouble maker ...

  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    Tiles - that's the correct thing to do and is thus  no fun at all :p


    @JoshexDirad
    didnt read your previous post properly

    why not use a mercator projection ?  that would get you closest to undistorted pixels

    and to cover things i spotted in your last post...
    adding new small textures for distant objects is the opposite of an optimisation - the computer does that for you, in hardware, for free, automatically.



  • Klunk
  • TorQue[MoD]
    Offline / Send Message
    TorQue[MoD] polycounter lvl 19

    Cube quad sphere wouldn't be seamless. It would have a ton of seams and be really difficult to make the texture seamless.

  • TorQue[MoD]
    Offline / Send Message
    TorQue[MoD] polycounter lvl 19

    I don't know what sds means, but if it's in 6 pieces there'd be a ton of seams. Also, the 3rd post already suggested a cube. In my experience, a Geosphere set to Octa still gives the best result where you don't have to mess with the texture too much and it's fairly easy to remove the seam. I love that this topic is still being posted to like 10 years later :P

  • Eric Chadwick

    Why are uv seams difficult for you @JoshexDirad ? Every single 3d model has them, and it's a solved problem. Highpoly baking, triplanar projection, 3d procedurals, 3d paint, etc.

  • Tiles
    Offline / Send Message
    Tiles greentooth

    >I don't know what sds means

    SDS stands for Subdivision Surface. In Max they call it turbosmooth from what i remember. You make a cube, and with three or four SDS levels this cube turns into a sphere, with 6 faces from the cube underneath. The result is that you can achieve a pretty equal texel density at the whole sphere when you map it. This is not the case with a sphere projection. The highest texel density is at the equator here, and the lowest at the poles.

    It is true that you have more seams this way. But a sphere is also not seamless. It still requires at least one seam. And i would care more about the texel density of the single faces than about having a few more seams in this case.

  • Piflik
    Offline / Send Message
    Piflik polycounter lvl 12

    Not to be that guy, but you don't get a sphere when you subdivide a cuve. Smoothing algorithms don't produce circular curves at an edge. 3ds Max has a Spherify Modifier you can add, then you get your quad-sphere.


    I don't know how people think they found a new perfect way to unwrap a sphere, when the way we unwrap spheres hasn't changed in 25 years. Takes a certain amount of arrogance to think yourself smarter than 25 years worth of 3D artists...and franky, most of the recent suggestions are junk. Full of distortions and impossible to work with. If you are unable to draw your textures, unless you live in 4 dimensions and can see past the distortions, and you are baking your textures into these perfect seamless coordinates anyway, why bother with seams? just "Flatten Mapping", unwrap every triangle into its own little island. No distortion whatsoever.


    And if your rendering software is not able to render smooth normals over uv seams, you don't need seamless unwraps, you need a better rendering software.

  • Tiles
    Offline / Send Message
    Tiles greentooth

    Yes, it is not completely round first. The sds algo is not perfect in this regards. But usually already close enough that you will not notice the difference without having a closer look at. In Blender you can also apply a cast to sphere to make the result even rounder. I guess it's the same than the spheriphy modifier in Max. So the improvement is one click away :)

    But i have to agree at the other part. It's wasted time and energy to invent the wheel from scratch. There are enough working methods around. Just pick one of the proven ones. That's why i mentioned the SDS cube method. It is also around since eons.

  • TorQue[MoD]
    Offline / Send Message
    TorQue[MoD] polycounter lvl 19

    I think it’s about time we set this thread out to pasture to die. Lol

    No offence meant to anyone, but it’s getting long in the tooth and people are reposting suggestions that were already made. It’s good for reference though. Can a mod lock this thread?

  • Joopson
    Offline / Send Message
    Joopson quad damage

    To be fair, the thread now may as well have been a separate thread than your original; all of these responses are interacting with the post from July 22nd by JoshexDirad, not your original post from 2010.

  • JoshexDirad

    yep.


    I found this thread by searching for info on how to do this and my replies were meant to propose other methods for if you really wanted a UV sphere. but I wasn't satisfied with the results of any method I tried. especially as I planned to use it in a Game engine (which typically have less than perfect rendering engines).


    really make your Sphere the way you need it for what you are going to use it for. there is no perfect way to do it, and all those movie quality spheres with a billion polygons honestly poke a tender spot in my gut and mock me saying "see they could do it, why can't you?, people are going to laugh at your game. no one will play it all because of the seams." it stings.

    The sds method or cube to sphere method works, yes, but I haven't been able to make it work with normal maps without seams. hence I keep trying new methods. in the end I decided "if there has to be a seam, I should --put-- hide it somewhere it wont be seen from 90% of the angles the object could be viewed at"

    Yes islanding each face works seamlessly, as long as you don't apply Normal Maps. once you do edges become apparent. I had the same opinion originally, that anything would work and after that it was just down to baking to make it seamless, this works for color textures, but normal perpixel offsetting doesn't like it. the problem isn't actually a texture seam, the problem is lighting will highlight the square edges of each normal mapped face, so instead of a smooth curved shadow of the backside you instead get a jittered shadow following edges. the same is true for specular regions. it'll drive you nuts thinking the normals are facing the wrong way on one side of the edge.


    The most even method I've seen is the plane to sphere method, where you take a flat plane of the desired number of rings X, and segments Y map any flat square image to it, and then make it into a sphere without merging the poles. This can accept the Mercator Projection in render this looks perfect, however in the game engine... It looks like the sphere has two "back passages" North and South and "Oh, I don't think we wanna go that way. It's the back passage." to quote the imps from Conker's bad fur day. or a chocolate starfish on a muddy world.


    I am a mad scientist. to me reinventing the wheel is fun work especially when I need it to save face and continue to use what I have to learn with. learning how to make a different kind of fire from the standard sinewaving fuel-source-arcing anti-magnetic plasma?... I mean sure if theres a good reason, but it kinda needs to be justified. Would be interesting to see square waving fire but I can't imagine what it'd be useful for.

  • Tiles
    Offline / Send Message
    Tiles greentooth

    >The sds method or cube to sphere method works, yes, but I haven't been able to make it work with normal maps without seams.

    Hm.

    It can be that neighbor pixels bleeds in. But this is not only of interest for normalmaps. Just more visible here. Make sure that the UV mapping ends as close as possible at the texel border of your chosen texture resolution.

Sign In or Register to comment.