2
$\begingroup$

First question on this forum... I need to take a generated cube map then use it as a base texture onto a sphere in a material. It must have been done a gazillion times in blender but I just can't find the information of how to do it.

I want to use a cube map this way to texture a planet and get rid of the worst distortions around the poles as compared to using a single texture.

So what I want to do is:

  1. Load a cube map texture
  2. Use xyz coordinates as a texture lookup in this cube map to get the base color.

Anyone knows how to do it?

EDIT: I realized I was a bit unclear above.

Cube mapping is an established tech in computer graphics but requires the "engine" to support it.

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

If I only project a cube on the sphere I will have blending artifacts between the 12 seams of the textures which will especially bee noticeable when rotating the object.

Cube Mapping removes these artifacts by assuming the 6 faces are the same texture and kind of samples across the different faces to do i.e. trilinear mipmapping or whatever algorithm one have selected for zooming in.

The downside to this is that you need to use 3d-coordinates (u,v,w) instead of 2d (u,v). The sign and to the absolute value largest axis decides which face you will pick a sample from and the other two coordinates will denote the uv locally on that face. This has been in hardware for very many years (at least since the beginning of 2000 or so).

I can't find any places where you can upload a "real" cube map texture and use it in a material in blender.

Is this possible?

$\endgroup$
4
  • 1
    $\begingroup$ A possibility can be transforming a cube to a sphere. No equation needed. $\endgroup$
    – lemon
    Nov 9, 2020 at 17:51
  • $\begingroup$ Have you tried (cube with subdivision modifer, with sharp UVs, and cast to sphere)? If yes, could you indicate what is wrong with it? If you feel it not spherical enough, cast to sphere twice. $\endgroup$
    – lemon
    Nov 10, 2020 at 10:23
  • $\begingroup$ The link to wikipedia includes a sample function to translate from xyz coordinates into per-face-uv and face coordinates. Isn't it just the case that you need to implement a similar re-mapping in material nodes? Can you provide a sample cube-map to demonstrate what's being worked with? $\endgroup$ Nov 10, 2020 at 10:46
  • $\begingroup$ Hello, thanks for the answers! I haven't tried to implement it myself although I assume it should be technically possible but would probably go deep into code which deals with texture sampling. The reason I ask is that it is about 100% covered by hardware these days so I just want to check if someone already have used it / implemented it. Maybe it's possible to only modify a small part of the code to get it to work, I don't know, but it basically has to work with mipmap levels etc as well and is for this reason a bit more complicated to implement than just to insert the code from wiki. $\endgroup$
    – Decaf Sux
    Nov 10, 2020 at 13:26

1 Answer 1

0
$\begingroup$

The comment from lemon is what i thought too. Take a default cube, subdivide it good and well, then "Transform -> to sphere -> 1.0" The UV map on the cube should still be squarical, and be able to map.

The other way is messing with UV unwrap and trying "cube projection", but IDK enough about that to help you.

$\endgroup$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .