- Home /
How to generate a smooth spherical world?
Hi
First a description of what I'm trying to achieve. I'm trying to make a game where you can modify the spherical world you're standing on. Such as the old game Populous 3 / Populous the beginning.
Now I read on wikipedia that the maps you play on in that game, aren't actual spheres but instead composed of a real projective plane
Wikipedia article on real projective plane
So based on this, I tried to make a vertex shader which warps the plane to a spherical view. This looks fine for the sphere itself, but it fails horribly when I attempt to attach stuff like trees on it as i get distanced to these objects. They simply don't follow the surface.
Notice how the tree hovers above the ground, and the 45 degree turned cube which has the same vertex bent shader applied to it also hover slightly above the ground despite both the plane and the cube being at y = 0.0
So I tried looking for an answer in the forums, and the closest thing I came across was this article:
Article involving a spherical world
Now the possible solutions I can come to think of is:
1. Finding a way to use the shader with a terrain My ideal way of using unity was to take advantage of the built in terrain engine, which I am aware is optimized to do stuff based on its height. My shader won't work on that though.
2. Finding a way to get a nice evened-out sphere If I shouldn't use a terrain or plane due to the problems described, I might as well just have an actual sphere instead of a shader-manipulated plane. However that introduces another problem; A sphere mesh usually has vertices very far apart in the center, with a very high concentration of vertices at its poles. Any idea on how to get an evened out spherical mesh?
I did also consider modifying the camera, to have a fish-eye-ish effect. I don't know how to achieve that either though.
So, if anyone has any suggestions on how I can achieve that populous 3 effect - either by the methods I described, or a completely different approach - I would very much appreciate it :)
Answer by Kiloblargh · Jul 19, 2013 at 08:16 PM
Try combining the mesh of the 'tree' and 'house' with the planet mesh. If that works, then try keeping the tree and house transforms at (0,0,0) and just moving the vertices of their mesh around to place them.
There's a spherical map setup for a geodesic dome / buckyball shaped world on the asset store, and there's also a horizon-warping effect intended for "endless runner" games that could probably also apply to a sphere world if you don't need to zoom out that far. Don't know what they cost, but if either solution works then it's worth it if your goal is to get this game done, less worth it if your goal is to expand your knowledge.
Your answer
Follow this Question
Related Questions
Billboard trees glow white in dark scene. 2 Answers
Adding a static fog in the bottom of a terrain 1 Answer
Using custom vertex shader for terrain? 0 Answers
FX/Flare is always on top 0 Answers
How to change terrain shader 0 Answers