Grass Blocks ( anyway to make them feel more dynamic? )

Started by
15 comments, last by riuthamus 11 years, 1 month ago

So the current issue we have ( now that we have working sexy alpha based grass ) is that we dont want a simple grass block with a silly X on it.

gallery_1_8_105445.jpg

Instead we want something with a bit of a dynamic feel to it.

gallery_1_8_285288.jpg

We had a previous grass thread with many great suggestions ( click here to read it ), but the issue is that our land is 100% dynamic and block/voxel based. This means that normally a single grass object can rely upon one block at a time. The problem with this is that when you do this setup you get the minecraft shot we had above.

However, we could stack a bunch of model blocks into one block:

gallery_1_8_11256.jpg

But unless you allow for some overhang you are going to still get the problem we had with minecraft which is some nasty looking topdown or 45 degree looks. So you say "Why dont you just allow for overhang?"

gallery_1_8_15428.jpg

If we allow for overhang, what would we do if somebody destroyed block 1? Simple answer is to destroy all of the grass blocks that take up space in block 1, but this only works if the art assets support such a theory. If we make a grass plane that is long and that spreads to the edges ( but is spawned on the edge ) we would have a grass plane that looked like it was hanging off with odd grass out in the middle of nowhere.

Note: While posting this i figured out that i could fix this by limiting the width of the base and spawning multiple instances from the origin of the model/plane and fanning it out from there. I would like to not have to be limited by that though.... so ill keep posting.

So the next question would be, how can we code something that has to be reliant upon dynamic terrain changes that will allow for a more dynamic feel? Is there a way to allow for overhanging grass that will be removed when block 1 is removed?

Advertisement

What is exactly your problem here, that the grass looks like an X when looked from above or how the grass is distributed on the ground?

For the former the first idea I have is to just give the grass mesh a different shape, e.g. a downwards pyramid shape (then at least it would look like a 3D mesh from any angle instead of looking like a bunch of quads). It requires more triangles, of course, although you can decide how much detail you can afford to spend.

Can't come up with suggestions for the latter, since I can't understand exactly what would be the issue with the distribution of the grass. Got completely lost at the overhang part.

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

So lets go by this step by step and see if this explains it better:

gallery_1_8_36292.jpg

Here we have a nice sexy block 1 and 2, on block 2 is the spawned grass that we created. ( note that it has a very long base )

gallery_1_8_36974.jpg

Here we have the same as the previous image but the grass is spawned inbetween 1 and 2 as well as on 2. This creates for a more realistic look when at an overhead or 45.

gallery_1_8_24732.jpg

In this picture we remove block 2 and notice that because of the long base of the grass model we have some issues. 2A grass block would be destroyed but 1A could or could not depending on how you wanted to do it. ( which is part of the problem, deciding how to do it )

gallery_1_8_33174.jpg

While making the post I realized that if i make the base of the model smaller we could allow for edge spawning to occur without having to remove the grass model and it would still look okay!

gallery_1_8_15996.jpg

But I do not want to be limited by this because it would limit the style that a person could use ( mods are allowed ) and would limit the style of grass being created. It is a solution though. Last but not least this is the current grass we have

gallery_1_8_57386.jpg

gallery_1_8_111893.jpg

Out of curiosity, what stops you from swapping grass models when you remove a block? You could switch to a more appropriate length on block removal

1) Bend the grass quads, and use at least 3-4 of them at different angles/positions. Any modern game seems to use few more quads at different angles so it looks good from any direction. The texture of the grass and how it blends with the terrain is also important, otherwise you have nasty edges and it doesn't look good. This plus some random rotation applied to each blade should give a good result without much work.

2) I'm not sure how you generate grass but you can re-generate it once blocks are changed, so you can easily spot which block (that was base for generating grass) disappeared and just don't generate grass there. As you use uniform grid of cubes it will be harder to make a good looking grass distribution - if you used marching cubes mesh, you can easily create a method that will distribute grass over the surface of a "grass triangle", make it conform the normals of terrain, decide, decide on number of grass chunks depending on the size of triangle face etc. I did it and it looked okayish (considering how little time and effort I put into it) also from above, but can't find a picture found a picture!. Its just a single grass billboard distributed quite densely, plus randomly rotated at each position so not a single quad has the same orientation. The terrain is fully diggable so I had the problem of removing the terrain from underneath the grass, but it was easily solved by just rebuilding certain grass chunk taking into account new mesh that didn't have certain grass triangles (but rock for example).

savannah.jpg

I guess you have it a bit harder because whatever you do, all you have is cubes so distribution will always be tied to these cubes, unless maybe you create some sort of "terrain mask" on which you paint where the grass should appear and apply grass distribution based on this mask, so its not tied to cubes - some engines use such masks to "paint" grass over terrain, but its heightmap, so in case of 3d voxel volume terrain it may not be that easy to achieve.


Where are we and when are we and who are we?
How many people in how many places at how many times?

Out of curiosity, what stops you from swapping grass models when you remove a block? You could switch to a more appropriate length on block removal

Not a bad idea, this is possible too depending on how hard it is. The problem that I see is how to poll what grass is in what area? normally a grass block takes up a block so there is a simple method by calling the block/box. If we remove that we are now polling everything for grass? could be a memory hog.

I guess you have it a bit harder because whatever you do, all you have is cubes so distribution will always be tied to these cubes, unless maybe you create some sort of "terrain mask" where you generate a mask where the grass should appear and apply grass distribution based on this mask - some engines use such masks to "paint" grass over terrain, but its heightmap, so in case of 3d voxel volume terrain it may not be that easy to achieve.

That is indeed the problem. :P Thanks for the posts guys. Keep the ideas coming

Not a bad idea, this is possible too depending on how hard it is. The problem that I see is how to poll what grass is in what area? normally a grass block takes up a block so there is a simple method by calling the block/box. If we remove that we are now polling everything for grass? could be a memory hog.

Isn't your grass sorted in some way already? If you don't have some kind of paging* system in place you might run into performance constraints later if you wind up having a lot of grass

Edit: when I say paging I'm thinking octree or other spatial hierarchy

Isn't your grass sorted in some way already? If you don't have some kind of paging* system in place you might run into performance constraints later if you wind up having a lot of grass

Our grass is built into a single vertex buffer for each chunk. We cull the entire chunk if its not visible, so there haven't been any performance problems

So it's already sorted by chunk, that'll do just fine. What stops you from simply looping through the grass strips of the removed chunk and adjacent chunks and applying your chosen solution?

You needn't necessarily delete any offending grass strip*, either. If you want all the strips to use exactly the same model and similar geometry, simply rotating or translating an existing strip a little bit to a new valid position might even work.

*on blocks adjacent to the removed one

Well my complaint was having the grass spawn anywhere, he didnt know how to do that... or if he did he didnt know how to remove the shit once a block below was removed.

This topic is closed to new replies.

Advertisement