Jump to content

[Idea] Realistic ground scatter


skykooler

Recommended Posts

The trees on Kerbin (which can only be seen with ground scatter enabled) are rather low-poly when standing right by them - but they have too many polygons to render a realistic number of them.

So, I've been thinking about how one might make a mod to fix this. I made some mock-ups in GIMP of what I came up with (and what I believe many modern games do); grey is what you'd actually be seeing, red is the edges of in-game polygons.

My proposed solution: A proper LOD (level of detail) system for trees. Close up, trees would be fairly high-poly models, with at a few polygons per branch:

5clKpNF.png

Once the camera is more than say 100 meters away from them, they fade into a more simplistic model of three intersecting planes. The key to making this look realistic is a combination of proper normal mapping, so the trees appear lit from the correct angle, and a shader which fades the planes to transparent as they come close to edge-on (which avoids the effect of stretched trees).

6WUQa6f.png

Finally, for further distances, the trees are all drawn on the same texture, parallel to the ground. Ideally, this would be part of the terrain shader itself rather than seperate geometry. (This is a top-down view.)

EoYFQTF.png

To prevent pop-in, the low-poly trees should fade out as the ground texture fades in. Here is a mock-up of how that might look (notice the fading of the furthest trees):

osX3t13.png

And that same image with polygons visible, showing the transition from high(ish)-poly trees to low-poly trees at about a hundred meters out:

GAq2OTx.png

So why did I start this thread? Quite simply, because I need help. I've created some mods for KSP but don't know enough about Unity to do this - in particular, I don't know how to modify geometry directly without adding a game object for each tree, and I don't know very much about Unity shaders. So, I am looking for feedback, and pointers if anyone can help.

Link to comment
Share on other sites

I doubt I'd be of any help plugin-wise, but I'm very keen on seeing how this turns out.

I'm also interested in procedurally generating cities, towns, villages and roads, although that's another topic altogether.

Link to comment
Share on other sites

I'd like to add a few more suggestions to the original proposal:

Variations in plant size / maturity

Should be fairly easy, with randomized scaling

Variations in plant types depending on biome

- Palm trees near Shores

- Deciduous (broadleaf) in Grasslands/Highlands

- Coniferous (evergreen) in Mountains

- Cacti in Desert

- Shrubs in most biomes to add visual interest

Seed-based procedural generation

The same seed value results in the same distribution of scatter between savegames

Link to comment
Share on other sites

I'd like to add a few more suggestions to the original proposal:

Variations in plant size / maturity

Should be fairly easy, with randomized scaling

Indeed.

Variations in plant types depending on biome

- Palm trees near Shores

- Deciduous (broadleaf) in Grasslands/Highlands

- Coniferous (evergreen) in Mountains

- Cacti in Desert

- Shrubs in most biomes to add visual interest

That was something I was hoping to do once I had the basic system working, as well as grass.

Seed-based procedural generation

The same seed value results in the same distribution of scatter between savegames

Having them line up predictably is required anyway, so that they match up with the static textures at long draw distances.

Link to comment
Share on other sites

Might as well add the stock feature that we need to somehow disable it so that the users will not compilain the low poly trees. (Add coliders too? Amount of scatter percentage?)

EDIT : do also do for other planets. Eg (laythe mun minmus etc)

EDIT 2 : nice idea i like it!

- - - Updated - - -

I'm also interested in procedurally generating cities, towns, villages and roads, although that's another topic altogether.

it is kinda difficult. You know that those cities need meshes and colliders.

EDIT 3 : i just realised it is the EPL original owner! :o

Link to comment
Share on other sites

i really hope you can pull this off dude, one selfish suggestion as a planet pack creator is the ability to add custom models & textures. Then we can add alien objects as scatter to other worlds easily :wink:

are you planning on having a collision mesh system? or just the current "trees aren't relly there" system?

Link to comment
Share on other sites

You might want to have a look at this video then:

It shows how what you are describing is done in Proland and gives some details on how it is achieved. Not that I understand much off it, but maybe it makes more sense to you. The source code and some documentation is available on the Proland website as well: http://proland.inrialpes.fr/index.html I am not sure if it is even possible to bring this to KSP, but there seems to exist a (basic) port to Unity http://scrawkblog.com/2014/05/20/proland-to-unity-forests/

Link to comment
Share on other sites

I've looked at Proland's trees before. The trouble with them in regards to KSP is that they use geometry shaders (bits of code that the GPU uses to figure out where polygons are), which requires a higher level of DirectX/OpenGL compatibility than KSP has.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...