Skybox or rendering inside a large sphere?

A need I have is to render a 360 background field, like a star field in space, with a custom shader. Basically an environment with a custom shader. Should I use a skybox or use the inside of a large transparent sphere enclosing the whole world? Or is there other approach? For using a skybox, how do I run custom shader(s) on the 6 faces of the skybox? For using a large sphere, does the rendering looke the same on inside as the outside?

The other option I’ve thought of is to use a large quad to cover the screen and pass the camera’s angle in to the shader for it to account for the rendering direction.

Hey @will

Welcome to the Babylon family! Great to have you hear!

Here’s a couple of resources that might come in handy as you start down the skybox path:

If you’re going to create a custom shader and want to apply parts of that shader to different sides of the skybox, this technique should help:

Here’s a playground pulled from that doc that shows the technique in action:
https://www.babylonjs-playground.com/#ICLXQ8#1

I hope this is helpful!

Cheers!

Those are excellent resources. I’ve gone through the Environment and Skeybox before, but not the Apply Material to Individual Faces. That one is promising. Upon reading it I just realized the Skybox is nothing but a box with material.backFaceCulling = false to allow the rendering to show through to the back faces.

Thanks!

1 Like