Monday, February 25, 2013

97 – I am so behind

Today I tried to fix the need for a hardcoded rotation for trees. I did again small incremental changes, the first being to save/load the number of bones in the mesh. Then I wrote a small API to load/save bones to disk. Then I made it that all bones are loaded and taken into consideration when rendering and removing the hardcode gave this result:


Wow! I tried to fix it a lot but I failed. So instead I tried to do something about distant trees. They look a little bit flat. Before: 


After:


Take a very close look at the trees. The effect is very subtle but I think it is an improvement. It is a custom shader that does a very approximate edge glow which is relatively cheap, but I still have it disabled for low quality settings. The shader has no name, I just made it up on the spot.

Maybe I should modulate it a little based on diffuse lighting for the backside of trees. Maybe they are a little bit too bright. Before:


After:


Too bright? Sometimes I wish I still had my DH audience so that questions would get answered :P. I won't bother with it more, it looks good in my eyes.

To bad about the bones issue though...






HA! Fooled you! Giving up is the first sigh of failure! Let's fix this!

The first thing I do is open up the Blender three file and add a new box that has the same general shape as the tree trunk and I test with it. The bones seem to work fine. But the actual tree trunk still doesn't work. After further testing I determine two things: 1. there isn't an uniform up direction for exporting from Blender; it depends from file to file and 2. the rotation of the tree trunk is ignored. But only on the tree. The rest of rotations are not ignored. But at least now I have a certain level of certainty that the bones do work correctly  In order to no longer loose time on this I just apply the rotation to the vertices and this fixes the problem. The real issue might be an import/export bug somewhere.

Then I fix the frustum culling for entities without physics (like tree canopies) and get this result:


The objects in view is a lot lower right now because more things are culled.

Finally, I add 2 more trees. Unfortunately  the canopy shader needs custom parameters for each tree depending on the leaf texture quality. Here is a shot of a random forest:


I still didn't get around to implementing grass streaming, but that does not mean that it does not work. Let's take a look at the engine, with all details turned to max:


Pretty good. Must add that skybox. And grass is certainly the most "last-gen" thing I have. I need to greatly improve it somehow.

2 comments:

  1. Something you may want to know: that pine tree is majorly f'ed up in how it was modeled. I found literally hundreds of unnecessary overlapping polygons mostly visible from view in the canopies.

    I don't know what kind of blunder would cause that, but long story short, I deleted the extra polygons. The new tree is 1/3 its original polycount and rendering is faster (in my tests)! I can upload the new fixed tree model if you want it.

    ReplyDelete
    Replies
    1. That would be great! The oak model is also weird. Has a strange floating branch in my case.

      But did you have to do something extra for the rotation of the pine?

      Delete