Home Technical Talk

Correct uvmapping for a cub to preview cubemap

Hi guys,

this may be a weird question, but hopefully someone will know the answer or let me know that I'm asking a wrong question :)

So let's say I have this cubemap that has 6 images in it, side by side, resolution of 1536x256.

What should be the exact uvw coords (in 3dsmax) of a cube so that it displays the cube map correctly and also that I can paint on it correctly in mudbox for example.

Right now if I divide 1 by 6 I get 0.1666667 for each following uv square. One of the problem is the rounding problem. The other is that if I setup the uvs according the above numbers, I'm noticing that there are small gaps where the next texture is showing up.

I could try manually matching the textures, but I was wondering if there is some exact solution.

Thanks

Replies

  • IvanA
    I believe Max uses a vertical-cross layout. Look here for more info.
  • Eric Chadwick
    You can't really texture a cubemap on a cube correctly in Max, because its scanline material doesn't support UV clamping. The UVs in Max always tile, so each face tiles with itself along the edges, creating unavoidable thin seams.

    A DirectX shader can do this though. UV clamp means the edge pixels are sampled, instead of the other side of the texture. Not sure if Mudbox supports this with its material system or not.
  • ulukai
    Thanks both of you.
    Now I'm really curious what would be the best way for painting cube map in mudbox (on a box)... I don't mind if it's cross or other system.
  • Eric Chadwick
    Painting on a box is really not a good idea, unless you can keep the viewpoint exactly in the center of the cube while you paint. Angular distortion increases as you get closer to each edge of each face, and you need to keep that distortion in the end product.

    IMHO the better method is to simply paint on a panorama layout, then convert it to a cube, and fix the poles.

    You can also use something like Skypaint. The interface is stuck in the Windows 95 era, but it does get the job done. Basically you load your cubemap into it, navigate to the view you want to paint on, then send that view to Photoshop so you can paint, when you're ready you send it back to Skypaint where you can pan to another angle to paint some more, then finally you save out the finished cube from Skypaint. Works pretty well actually. But painting a pano latlong in Photoshop is still easier.
  • Eric Chadwick
    Yep, I think that's the best way to render one in Max (wiki). But you can't really paint on it. :(
  • ulukai
    Thanks everybody.
    Skypaint looks like a useful tool, but omg... that interface... stuck not in win95 era, but probably win 3.11 :)
  • Gilgamesh
    Offline / Send Message
    Gilgamesh polycounter lvl 12
    Haha, Good example of a programmer making a interface lol, I'd say that's 3.11 era too.
  • sprunghunt
    Offline / Send Message
    sprunghunt polycounter
    You can't really texture a cubemap on a cube correctly in Max, because its scanline material doesn't support UV clamping. The UVs in Max always tile, so each face tiles with itself along the edges, creating unavoidable thin seams.
    .

    You can't just uncheck "tiling" in the max bitmap dialog? That essentially clamps the edges of a bitmap. It's to the right of the "mirror" checkbox.
  • Eric Chadwick
    Unfortunately, not the same. It doesn't smear out the edges of the map, instead it makes it like a decal on top of the diffuse color. So it blends with that color instead of with its own edge pixels. :(

    You can try Mirror instead, but you also need to offset it .5, and I don't remember that working very well.
  • Eric Chadwick
    In case anyone searches for this...

    I found out today that the Mirror checkbox does work properly in Max... mapping the six cube faces onto a cube does give a seamless cube in a 3ds Max render. Doesn't help the OP with Mudbox, because Mirror is only a material editor thing, instead of mesh UVs. But it's kind of cool that it works in Max.

    Make a Box with flipped normals, apply a Multi/Sub-Object material with six submaterials, each with one of the six bitmaps in it. Adjust the bitmap coordinates for each face: change all four Offset and Tiling spinners to .5, and turn on both Mirror checkboxes. Then flip and/or rotate the UVs on each side of the cube until things line up.
Sign In or Register to comment.