How to apply a cubemap onto a sphere

Hi,

My question is simple. How to apply a cubemap texture on a simple sphere ?

The sphere is not a skybox but an object like a planet so Sky.j3md seems irrelevant, is it true?



Thanks

Actually you could use Sky.j3md for it, if you’re okay with it being just a texture without lighting and such.

Applying a cubemap with the lighting material would be more difficult, since you have to modify the shader to sample a cubemap instead of a 2D texture

First of all, thanks for your answer. After some testing, i got my cubemap working on a simple sphere. I think that sky.j3md is not suitable for this use yet because it only transforms the vertex coordinates with the view matrix and the projection matrix (probably to keep the sky sphere around the camera). Adding WorldViewProjectionMatrix As Material’s parameter and using it on the vertex position (gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition, 1.0):wink: solved my problem.



I don’t know if the transformation applied to the vertex coordinates is a bug or not but it creates a blind spot (@See TestSkyLoading) cause the camera position is on the sphere surface not at the center. Did i miss something about sky positioning?



Another short question, could i use more than one material at a time?



Thanks for your time and efforts



Mumrah