Thursday, February 21, 2013

Undergrowth

Last weekend I took some time to add a new feature to the engine. It is some sort of mesh instancing system that brings additional detail on top of the geometry output. It can be used to add a new vegetation layer under trees, like the following images show:



I will be using it for rocks, pebbles, even man-made elements sticking out of the blocks you place.

Polygon counts are now escalating quickly because of this. My old 4770 still averages 40 FPS at 1080p but begins to struggle. It is still manageable, there are some polygons right now I can cut.

This one was long needed. I will be posting a video later so you guys can see how the LOD transitions are managed. I think this has improved a lot.

38 comments:

  1. Are you using ATI Radeon HD 4770? It's the one I have. Also, good job on this.

    ReplyDelete
  2. How are you determining where to place the undergrowth meshes? Do you actually have any logic behind it such as placing it on top of voxels marked as thick vegetation or is it entirely random?

    What mesh instancing method are you using?

    ReplyDelete
    Replies
    1. There are multiple layers to deciding the location.

      The first is determined by the selection of the main material. In this case you can specify a material to appear only under trees. This is why in the earlier videos you do not see much grass under trees, the materials that appear there have very low settings for the billboard grass objects.

      Then a single material may list a number of possible instances. Each entry in the list includes a density function that determines the probability to find that instance there. The function is a perlin noise with some additional random multipliers.

      For the instancing I am duplicating the instance vertex and face data into buffer objects. It is the brute force approach to instancing. I'm not sure using pseudo-instancing (as described by Nvidia) or real instancing would help much in this case, as my bottleneck is not in the bandwidth, but actually transforming so many vertices which has to happen regardless of which method is used.

      Maybe someone who has implemented this can provide a better perspective, I did not try the other two approaches.

      Delete
    2. Howdy! I'm the creator of Blockscape and I was sent here by a follower on twitter. I can confirm that this is how I render massive amounts of foliage in the Blockscape engine as well. Other methods would only make sense with more complex objects.

      Delete
    3. Very nice work on Blockscape. The rendering is beautiful. Got any rendering hints for me?

      Delete
    4. Hi Miguel,
      Great work as usual!
      I wish I knew a more efficient way to do it too. To be honest, we've found that one of the best speed increases we have got with this sort of stuff is making sure the poly count on detail models is low and that they share materials.
      If you are just doing grass then you can get away with a clever shader, but with unique models theres not much you can do other than use simple models and careful distribution I think. The just give the user some sliders, so that they can decide where they want to take the hit?

      Delete
    5. This comment has been removed by the author.

      Delete
    6. Oh thank you! Well, the lighting is a mix (or mess) of an offline gi engine and a bunch of shaders. Very different from what you will find in a text box. I can tell you all about it over a beer sometime in the future.

      Delete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Nice details, big effort, smart programmer !!!

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. This is a BIG improvement, it changes it from looking like the trees are a bit far apart, to them looking perfectly spaced, it also makes it feel like you are actually in a fertile forest.
    As you probably know though, there are forests with and without undergrowth.
    For example, in the forests in the Netherlands (which might not be a good example, since they are all planted, but still left to their own devices)there is a shrub here and there, and many spiky berry plants (forgot their English name)
    While here in New Zealand, most natural forests are almost impassable because of the thick undergrowth.

    There should also be places with only shrubbery etc. (In Tundras and close to mountain peaks) since trees cant survive in those areas.

    But great start!

    By the way, what were you thinking of adding in artificial places (buildings etc.) which arent overgrown by nature?

    ReplyDelete
  7. Makes a huge difference with the lush undergrowth. Fantastic work again. I remember reading in a previous post that the engine will scale with a more powerful graphics card. I'm curious about exactly how that scaling works? Do you upgrade the texture resolution or put more undergrowth in our give a higher lod or something else i wouldn't understand? (sorry my programming skills are pitifully small, I'm more about the pretty pictures!)

    ReplyDelete
    Replies
    1. Scaling works in different directions. Like you say it is possible to use higher resolution textures, more detailed models for the plants and rocks, higher polygon density so surfaces would have better silhouettes. Also the rate at which the LOD changes can be dramatically less, resulting in smoother transitions when you walk.

      Delete
    2. That's pretty cool... Do you design the undergrowth by hand or is that also procedurally generated beforehand to be instanced in the realtime engine? That's how you do the trees isn't it?

      Delete
    3. The trees are procedural but the undergrowth models are carefully handmade. They have to be very low-poly but still look good and volumetric, so a lot of skill goes into making good ones.

      These screenshots contain only two models: a fern and some kind of bush. Although each model has from three to four different LOD.

      Delete
    4. Do you think you could make code to procedurally create plants, which are low poly but still look decent? Or would that be asking too much?

      Delete
  8. Do you have some kind of culling for underground meshes? IF not, That could save alot of triangles.

    ReplyDelete
    Replies
    1. They is a big source of scene complexity and I have not found a way to cull them. The problem is with free sandbox voxel edition large underground areas can become exposed. I would need a culling method that is robust, I cannot make any safe assumptions on what is underground and what is not.

      Hairy problem!

      Delete
  9. One thing I don't think I've seen done before for undergrowth is to have a leafy texture follow the contours of the ground about 12" above the level of the ground. Where there are gaps between the leaves you could see through to the ground underneath. I'm guessing this could be added with quite a low rendering overhead (although I'm not the expert!) and this additional layer would add a real sense of depth to the undergrowth and look really cool. Something like this: http://farm5.staticflickr.com/4055/4679253336_c8a12a61e0_z.jpg

    ReplyDelete
    Replies
    1. So you mean have the contours of the land, raise it up about.. half a meter? And then have that a texture of leaves and stuff with holes (alpha) inbetween them so you can still see the ground a bit?

      Delete
    2. Exactly. Maybe not quite as high as half a metre, I think that could add a lot to the realism of the undergrowth without creating too much extra processing or calculation (i guess).

      Delete
    3. Yes, it is a good idea. I wanted to have something like that for smaller plants that stick to the ground or rocks.

      I did not try larger leafs like the one you show. I think it may be a problem when you are close, since you would see the leaves are all in one flat layer. But I would need to try it.

      Delete
    4. You could make two or three layers, unless that defeats the purpose...

      Delete
  10. Hello Mr.Cepero
    your project looks very intresting.
    i have a question, will it feature survival/Resources based gameplay like in Minecraft, will there be multiplayer servers ?
    And how do the player models/animals if there is one look like ? i suppose that those will have a realistic apperance aswell ? would it also be able to customize the player model ?

    ReplyDelete
    Replies
    1. It is not clear at this point. Survival, multiplayer and ability to mod the game and engine are a given. Beyond that it is really hard to tell. It is likely that the art direction will be similar to Skyrim's or the Witcher. I think there will be too many stylized sandbox games by the time, we may have a better chance with a more realistic look. Odds are creatures and player models will be realistically rendered, even if their concept is alien, for instance: http://4.bp.blogspot.com/_kvCpVC7wn5s/TT7_m56aB3I/AAAAAAAAAfg/5mkKL57zRRI/s1600/bug1.png

      Delete
    2. Ooh, I would love an alien world =D. Would you be able to produce procedurally made creatures you think? I know its possible, I just wonder if it would be within your scale of knowledge =3. (Since it would also require procedural animation etc.)

      Delete
    3. It is completely outside my scale of knowledge, pretty much like anything else I have done before. If it is in Google, it should be doable.

      But no plans for that right now. I still feel there is a lot of work to be done in the environments.

      Delete
    4. ah ok.
      so will the Player model itself be an Alien or a Human ? i am not sure how Aliens would fit in a non Alien, earth like world. Not that i want to be contrary. I think some Alien like Monsters, could work well (see creepers or enderman in Minecraft), but the main characters and creatures perhaps earth Fauna.
      I could imagine it to be a mix, there would be earth like animals and maybe human Npcs like thiefs which might attack you. And there could be additional lifeforms which might only appear during night with hard difficulty, creatures like Ghostes, Trolls or Monsters or mysterious Alien beasts.

      Delete
  11. Miguel, your videos are a demonstration of the engine, or you are going to make a game?

    ReplyDelete
    Replies
    1. The videos are a demonstration of the engine. Hopefully there will be games.

      Delete
    2. This engine is incredible, there will be games of course...
      I hope you will make this game soon)

      Delete
  12. Miguel, quiero jugar YA

    ReplyDelete
    Replies
    1. Bueno dame veinte pesos y te mando una copia.

      Delete
    2. Is that the Game or the Engine you are talking about!

      Delete