g3n/engine

How to create a cubemap?

tod91 opened this issue · 3 comments

tod91 commented

I see that you support a skybox, but is there an easy way to make a cube map im trying to make a pair of dice.

Hi! Yeah, skyboxes in G3N use cube mapping. If you want to texture cubes as dice you need to associate a different material with each cube face. Each cube face is already in a different geometry group to simplify this process. You just need to call mesh.AddGroupMaterial(diceFaceMaterial2, 2) for each cube face. For example, check out how it's done in Gokoban here (where we alter a single cube face) or how we do it for skyboxes here (where we set a different texture+material for each face).

tod91 commented

@danaugrs Hey, thanks for the reply! Works beautifully. The thing i'm concerning myself now
Screen Shot 2022-08-10 at 5 16 18 PM
is that the edges seem very sharp as shown here
is there a way to smooth em out i'm planning them to rotate them and have a clean collision detection, meaning as they are now if htey land on their edge the will rotate on some really , for lack of a better word, shady position.

You would have to create the 3D model with the edges smoothed out. It's straightforward to do it in Blender e.g. https://www.youtube.com/watch?v=wYBkLrca67Q.