Adding a Sphere primitive to the Terrain plugin

I’m jumping back into Unity after several years. I’ve been in VFX for a long time but see the future of my carrier moving toward real-time.

I’ve scene many requests for a Sphere primitive in addition to a Plane for the Terrain plugin.

I believe adding the option would be fairly straight forward. I’ve written plugins for Maya, 3dsMax and XSI and I wouldn’t anticipate this being all that difficult. The HSDS that it appears to be using would only require a few options to add allot of functionality,

Is it possible to get the Code to add these features myself. I’d be happy to share it back with the community; Or return the code to Unity for addition in a future point release.

Just so you know I’m not full of hot air…
http://vimeo.com/38405052
http://vimeo.com/8853272

Cheers,
Tharyn

The terrain plugin is generally pretty old by any standards of today in game engines and is, i’m pretty sure, going to get rebuild from the ground up at some point.

Also what you ask already has been asked on the unity feedback section: http://feedback.unity3d.com/unity/terrain/1/hot/active/spherical-heightmaps-with-gravit

tbh, of all features the terrain should have, spherical shape ranks pretty low (in my opinion) as they are very niche in most game designs anyhow.

This was not a feature request.

I was offering to do it myself.

Thanks for your opinion, but it would be worth my time as I need it.

It being called Terrain in Unity is a misnomer. The nature of HSDS was designed by Pixar for surfaces of all types. Including characters. Its is a waste to have it solely work on a plane. It should be able to simply import any Quad based mesh with predetermined mapping coords.

Cheers.

euh, terrain doesn’t use HSDS, and it doesn’t subdivide (most current day engines don’t subdivide their terrains either), it uses a heightmap image that, prolly (going by guessing as my knowledge of unity and terrain in unity is very limited, going by what most engines do in this case) by the usage of mip mapping is reduced to lower quality depending on a (likely) bias + distance. Atleast that’s how it’s done in many game engines.

From some quick tests it seems to be even the case, as you can clearly see different terrain sectors and neighbouring sectors that are higher optimized are 1/4th the detail of the higher detail sector, a good indicator of mip-map optimization of the terrain heightmap. It’s a popular implementation, thou a bit old (doesn’t make it bad thou :slight_smile: ).

All data is already at the highest level, no subdivisions, it just optimizes itself into a lower level.

Making that system support spherical isn’t necessarily “hard” thou either.

edit: you can actually clearly see it doesn’t subdivide by setting the terrain resolution to 32 (set textured wire on), making some hills and then setting the resolution to 1024 and making the hills again. The clear density difference is easy to see, no subdivisions, just heightmap mipmapping optimization.

The real reason this system usually is confined to planes is because of the heightmap being a greyscale. It only supports values for one of the 3D coordinates (in unity’s case the Y coordinate), but it’s pretty much lossless for that one coordinate, which is great! Technically you could just multiply the heightmap with the worldnormals of a sphere and get the heightmap working for a sphere (or any shape really), but you’d also need a UV mapping scheme that works great for spheres (to counteract too much detail at the poles etc…) and a sphere generation algorithm that doesn’t waste triangles where it doesn’t need it, like at the poles again.
That’s the hardest part of getting a sphere shape to work, the blatant amount of waste in the system and the visual errors it introduces.

Poles usually get effed up with spheres and algorithms that counter the triangle waste at poles, end up not being detailed enough for the detail in the heightmap or the sphere ends up being too detailed for the heightmap (again waste), I don’t know any algorithm that works perfect for spheres in this case atleast. Someone can point me to a source with a good algo, I’d definitely be interested! (no sarcasm or anything implied here, I truly would be).

And generally this system was designed for planes, not for other shapes :slight_smile: