I’d like to do something roughly equivalent to BP_Sky_Sphere in C++. I browsed through the blueprint and it seems fairly straightforward. I see how the directional light’s rotation is used to blend colors and materials. But what I don’t see is how the actual sphere works. When I add BP_Sky_Sphere to a level, it doesn’t act like a normal sphere… For example, I can’t see the outside of the sphere, no matter how much I zoom out. I don’t see anything special about the sphere in the blueprint – I don’t see anything there that changes the sphere’s position or size based on distance. So how do I get a sphere to act like this in C++?
Cool, I can make a sphere with flipped normals. But what I’m really trying to figure out is this part:
it doesn’t act like a normal sphere… For example, I can’t see the outside of the sphere, no matter how much I zoom out
It acts like an infinitely large sphere. It doesn’t appear to move, regardless of what the camera does. I can’t figure out how it does that.
It is in the mesh data. The vertex normals simply “point” inwards. So to reproduce this in c++, you have to either use the same mesh that BP_Sky_Sphere is using, or make your own SkySphere/SkyDome in a 3D modelling program with flipped normals.
That is most likely cube mapping in the material itself.
You need special textures for this technique though.
Here is a nice answer hub post. It handles space box creation, but the process is the same.
I think cube mapping is new in 4.9. BP_Sky_Sphere has been around a lot longer.
Edit: Actually, I think I might be wrong about that. Still, even with cube mapping, I’m not seeing how it would work. If the camera moves outside the sphere, it’s going to cause problems. Yes, I could restrict camera movement in the game itself to keep that from happening, but that’s not an issue with BP_Sky_Sphere and I’d like to understand why.
Cube mapping has been around forever. And what problems are you talking about?
Also the camera should never leave the skysphere during gameplay anyways.
EDIT: here is a simple tutorial on how to create a cube mapped skybox
Woops, the sphere in BP_Sky_Sphere really is just a regular sphere. It’s scaled to about 16 km, which is so large that it doesn’t appear to move when the camera moves, or when you move around in the editor. Somehow, I got it in my head that there was something a lot more complicated going on.