Search Unity

Texture Forest

Discussion in 'Assets and Asset Store' started by Dmitry-Soldatenkov, Feb 25, 2016.

  1. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    TF_860x389.jpg


    A forest is an essential part of landscape. Usually trees are very close to each other in the forest. So close that there is virtually no space between adjacent trees.
    In computer games, if we try to create a really dense wood it will cause significant FPS drop.
    This is especially true for games where the player can rise to a considerable height and see the forest stretching to the horizon. In this case the frame can contain millions of trees. With the standard approach, computer game designers have to reduce the density of the forest to increase FPS. That usually looks unrealistic.
    “Texture Forest” technology allows you to draw dense forest without reducing FPS. It involves the use of multiple texture layers which show the relevant sections of the forest.
    “Texture Forest” technology works fast enough even on weak machines, though looking realistic.
    This asset contains Editor Extension, special Shader and a few sets of textures to create the Texture Forest on a Standard Unity Terrain. The shader uses model 2.0 so it will work on mostly any Android tablet.

    https://www.assetstore.unity3d.com/en/#!/content/54846

    If you have questions you can ask them here.
     
  2. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    Here is the documentation about Texture Forest
     

    Attached Files:

    Tinjaw likes this.
  3. Tinjaw

    Tinjaw

    Joined:
    Jan 9, 2014
    Posts:
    518
    Thanks for documentation. What I've seen so far from this asset has me believing it would work well in a flight simulator. My test project now is to produce a smooth transition from Texture Forest trees when flying to SpeedTrees when landing and then walking. I'll let you know how it goes.
     
    one_one likes this.
  4. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    Tinjan, this technology was designed from the very beginning especially for flight simulators. It's very interesting for me how do you use it and what are the results. Maybe you can post some screenshots?
     
  5. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,128
    It is very interesting.
    Could you show an example for tropical forest textures?
     
  6. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    511
    I'm also interested in ways to neatly transition this to regular trees. I think especially the edges of the forest are going to be tricky to transition.
     
  7. gameDevi

    gameDevi

    Joined:
    Oct 14, 2015
    Posts:
    155
    I just purchased it..
    impressive..
    But the forest doesn't react to lighting.
    Would that make a huge impact on performance if it did?
     
  8. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    Yes, now lighting is baked into the texture set. I don't have a clear idea how to process a realtime lighting for such an object. And, of course, it will decrease the performance. Very soon I'll publish the Texture Forest Studio. It is my editor for Texture Forest. It support lighting. You could change an ambient and one directional light source.
     
  9. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    Usually we added some common trees on the edges of the forest. Especially near aerodromes and target points.
     
  10. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    tropical_forest_il2.jpg

    This is a tropical texture forest from IL-2 Sturmovik - Hawaii. I don't know how realistic it is. Frankly speaking I have not made my own tropical forest yet but I think it's not difficult.
     
    Last edited: Apr 9, 2016
  11. gameDevi

    gameDevi

    Joined:
    Oct 14, 2015
    Posts:
    155
    Texture Forest Studio is going to be a separate asset?
     
  12. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    Yes, It will be separate asset because I think that it can be used not only for Unity engine but for any engine in which you want to use texture forest. If somebody already has his own flight sim engine he can install free Unity Editor and Texture Forest Studio and so he can generate Texture Forest sets for his sim.
     
  13. gameDevi

    gameDevi

    Joined:
    Oct 14, 2015
    Posts:
    155
    and how much are you planning on selling it for?
     
  14. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    I think about 20$
     
  15. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    229
    Hello,
    I was wondering if the the result of your operation is a regular mesh?
    What controls do we have over the generated mesh?

    Also, Can we easily use the "Texture Forest Studio" to prepare forest textures to be used in FPS perspective? Can you show an example of the process (screenshots or video)

    Can "Texture Forest Studio" alone can generate custom textures and the generate the mesh? or do we need both "Texture Forest" and "Texture Forest Studio" for a complete package?

    Thanks for your time.
     
  16. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    You are right. The result of operation is regular mesh. The special shader just removes some artefacts which occurs when the direction of view is perpendicular to normal of the terrain surface. You can change this shader on simple alpha blend and look what happens.
    During mesh generation you can change the distance between texture layers and the size of each cell of forest mesh in terrain height map. You can scale the forest using texture scale coefficients in terrain settings.

    TFStudio.jpg
    Right now I am preparing TF Studio documentation. It will be ready very soon.

    Texture Forest Studio can generate textures only. For complete package you need both assets. I received many questions from people who doesn't use Unity engine in realtime, just texture set. So, I decided to separate assets on two parts.
     
    Tinjaw likes this.
  17. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    By the way, I assembled a standalone app with a small scene from the package. Now you can look at the Texture Forest in real time.
     
  18. alienheretic

    alienheretic

    Joined:
    Oct 15, 2008
    Posts:
    55
    Shader error in 'Texture Forest/Alpha Blended': '' : non-square matrices not supported (3x1) at line 66 (on gles)
     
  19. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    Sorry for this. Please take the corrected shader and replace the old one. I will fix this in the nearest asset update.
     

    Attached Files:

  20. alienheretic

    alienheretic

    Joined:
    Oct 15, 2008
    Posts:
    55
    thanks much appericiated
     
    jasrei likes this.
  21. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    The most common question is "How to use Texture Forest with mesh terrain?".
    I see 3 ways to solve this problem:
    1. If the mesh terrain made from Unity terrain you can create Texture Forest on Unity terrain and reattach it to mesh terrain.
    2. Texture Forest asset contains all the source code. If you want to use another type of terrain you have to change 2 small functions for the terrain you want to use. Namely are "Vector3 pointIn3D (int x, int y, int layerN, float yShift = 0.0f)" and "float pointAlpha (int x, int y)". Maybe something else. I don't know exactly until start to do it.
    3. Do something, so that I stop my current job and start to solve this problem :)
     
  22. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    Yesterday I submited Texture Forest Studio asset to approval.
    Here is the Texture Forest Studio documentation.
    Tutorial video:
    The Texture Forest Studio can work with Texture Forest asset of version 1.1 and older. So, if you use Texture Forest asset update it from the Unity Asset Store.
     

    Attached Files:

    Brity, John-G and Tinjaw like this.
  23. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    322
    Hi Dmitry,

    I've just integrated Texture Forest into my flightsim, and I'm really happy with how it looks. It gives a convincing impression of soft foliage, even from fairly low alitudes. I grew up playing Il-2, so I've always been quite fond of this aesthetic anyway- I think I can suplement Texture Forest with a few mesh trees around built up areas.

    I'd add to the above that realtime lighting would be a nice feature, if possible. There's a negligible difference in the profiler between a plain terrain and a terrain with Texture Forest, so I'd happily incure a slight performance penalty if necessary!

    Just having a rendering issue with HDR on- the areas where the forest dips into the landscape in particular. Please see the attached screenshots.
     

    Attached Files:

    John-G likes this.
  24. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    Hi Karearea,

    Nice to hear that you played in "Il-2". In those times I played many hours a day. I was in a serious squad. As a programmer I specialized in aerodynamics and artificial intelligence of the aircrafts but I can suggest some interesting graphic solutions of that time ;) I hope that the Texture Forest is not the last one. I am planning to make a tool for volumetric clouds which we use in "Il-2". The clouds in which you can hide add a great component to flight simulator gameplay.

    About realtime lighting: You see, the lighting of forest is a very specific thing. Forest is an unusual material like velvet, fur or grass. The albedo of forest does not depend on the angle between surface normal and light direction. The dependence is more complex because you have to consider the lighting of every tree in the structure. So, now I don't know how to realize a real time lighting for texture forest. Maybe you have an idea.

    It's a pity that Texture Forest shader doesn't work properly with HDR. As far as I remember Unity HDR doesn't support hardware antialiasing and uses several smart algorithms of software antialiasing. May be one of this algorithms conflicted with Alpha Blended shader when the surfaces are close to each other.
    The Texture Forest shader is very simple. It made of standard Alpha Blended shader by adding just several strings.
    This strings are required to realize the idea that we have to collapse forest layers when the angle between view vector and surface normal vector tends to 90 degrees (see the picture below).
    Forest Shader.jpg
    So, I will see what's happening with HDR but I don't promise to solve this problem easy.
     
  25. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    I'm probably going to ask a lot right now and i'm not expecting any completely positive replies but is there a way to apply this asset procedurally? In addition to this does it cope with the transition between flying above cloud level (truesky typically) to ground level (speedtree) entirely or is it focused mainly on high altitude movement?

    I'm working on a prototype thing to ideally impress a few people and it does involve extremely quick transitions between ground level and high altitude movement and while I can probably live without speed tree really I am trying to find a good marriage of assets that can handle those transitions gracefully in an area where fumbling comes under a lot of scrutiny (vr).
     
    John-G likes this.
  26. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Just read about lack of hdr support, I hope you get that figured out, it's practically impossible to use a sky asset like truesky without hdr sensibly, really
     
  27. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    322
    Hi Dmitry,

    Thank you for the explanation, much appreciated.

    As mentioned above, a lot of other essential flightsim features are built with HDR in mind- it would be difficult to give up. Hoping you are able to find a fix for the problem eventually.
     
  28. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    The Texture Forest technology doesn't like when you go below tops of trees in forest. When you go higher it works well. When the height is increasing you can make some forest texture layer more transparent and skip it when it became absolutely transparent. So, step by step you can remove all the layers except level 0. But on the level 0 we can see full forest from the top view. We did something like this in "Il-2". In "Il-2" you can jump instantly from 15 Km to 0 and vise versa.
    Concerning very close views, I think that if we took as a base forest model in Texture Forest Studio trees from SpeedTree we could make a very smooth transition from mesh technique to texture set technique.
    I think I will not do it myself but I supply all the source code in my assets and it is quite short and simple. So, you can modify it for your needs and make all what you want.
     
  29. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    At first sight, only Unity Editor has HDR problem. When I look at the same scene in runtime everything is ok. Isn't it?

    HDR_editor.png
    HDR_runtime.png
     
    John-G likes this.
  30. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    Oh. I turned Deferred Render on and everything became bad. :)
     
  31. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Thank you for your response. Without considering the issue of below-tree-height viewing, would your asset be able to be implemented on procedural (generated at run-time) terrain? Could it be altered at runtime in cases such as damage? And do you intend to broach the problem with hdr?
     
  32. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    I think this asset can be easily implemented on a procedural terrain, much easy then a forest consisting of separate trees. But not asset itself. You can take the idea, textures and basic functions from asset and combine all these things in your own application.
    About runtime forest modification: if you can change the terrain mesh then you can change the forest mesh as well. Forest mesh is a copy of terrain mesh but shifted to up.

    About HDR: When I turn "Deferred Render + HDR" on not only Texture Forest shader doesn't work. The standard Unity terrain shaders don't work as well. The standard fog doesn't work too. So, for this settings we have completely different pipeline for render and Texture Forest must have another shader for this pipeline.
    I'll try to find some shader that will work in this case. It may be Alpha Test instead of Alpha Blended.
     
  33. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    Try this shader. It must work with HDR.
     

    Attached Files:

  34. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    Try this shader. It must work with HDR. If it works well I'll submit an update for the asset with this shader.
     

    Attached Files:

  35. HaBe

    HaBe

    Joined:
    May 29, 2014
    Posts:
    31
    Hi Dimitry,
    I'm interested in buying your system and have some questions in advance.
    What are your plans for extending the system?
    Something like the following comes into my mind:
    Add a button for autogenerating collider boxes (or meshes) around the tree patches. This would make possible to have a simple raycast check to see if any tree patch mesh is visible in the player's FOV. A script assigned to those collider boxes then could create trees for the sides of the forrest patches during runtime to hide the seams.

    Also, would it be possible to extend the custom editor so that one could simply drag any folder from the project view to those options where a path is needed? Typing in paths manually seems to be a bit cumbersome. I'd rather prefer the easier standard approach of drag and drop that Unity is known for.

    Thanks in advance for the time you put into answering.
     
    Last edited: Apr 2, 2016
  36. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    322
    Thank you Dmitry,

    That new shader works perfectly in HDR, Deferred on Mac OSX, will try on PC as soon as possible.

    Cheers!
     
  37. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    I've tried on PC myself. It works.
     
    Last edited: Apr 2, 2016
  38. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    Hi HaBe,

    I intend to extend the system as far as possible unless it takes an extraordinary efforts from me. And it depends on that how many people need this system. At the beginning it was a question for me but now I can say that there is an interest :).

    About special needs of developers: I presumed that every professional developer wants something special, so I supply all the source code. The source code is quite short and simple and everybody can ask me how to do the thing he want. For example, the users asked me about different types of terrain they want to support.

    I will try to realize all the features which can be interesting for the most of users. I think that generating of mesh collider is a good idea as well as a drag and drop of a folder from the project view. I'll try to make it ASAP.
     
    HaBe likes this.
  39. HaBe

    HaBe

    Joined:
    May 29, 2014
    Posts:
    31
    Thanks for looking into my suggestions! I just bought both assets, I always loved that forest effect in IL2 and you made it even better looking than the original that I remember. Looking forward to what you'll come up with next for this.
     
  40. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    HaBe, thank you for purchasing of the Texture Forest. Drag and drop for texture file and mesh collider generation are ready. I'll submit it this week.
     
    HaBe likes this.
  41. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    Karearea, what do you think about idea to make realtime lighting by the next way: we can easy generate several texture sets for different sun positions. When the position of the sun is changed we can substitute an appropriate texture set in the material. That's all.
     
    Tinjaw likes this.
  42. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    322
    Hi Dmitry- that would be a good start I think
     
  43. ardakaya

    ardakaya

    Joined:
    Mar 17, 2014
    Posts:
    2
    Hi Dmitry, I am working on augmented reality apps, so as you know apps has very limited storage. I wanna ask how big these texture files? For example, how big the total file size of 100 trees' textures ? Sorry if it's a lame question, as I am quiet newbie to this topic?
     
  44. Edgar-Szilagyi

    Edgar-Szilagyi

    Joined:
    Apr 20, 2016
    Posts:
    2
    Hi Dmitry!
    It looks very nice, good job! Is it possible to use it with regular mesh, instead of Unity's native terrain system?
     
  45. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,338
    Is it possible to auto generate a forest based on a color map for example? I am looking at systems which can auto generate scenery at a planetary scale and doing this manually is not an option.
     
  46. VavylonaEntertainment

    VavylonaEntertainment

    Joined:
    Oct 21, 2015
    Posts:
    149
    Hello does this work with the terrain creators? World Creator, Gaia etc...
     
  47. VavylonaEntertainment

    VavylonaEntertainment

    Joined:
    Oct 21, 2015
    Posts:
    149
    Hello does this work with the terrain creators like Gaia, Terrain Creator, Terrain Composer etc
     
  48. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    This technology is great for mobile devices and for virtual reality. The shader using in it supports GLES and works on Android and iOS.
    The size of textures does not depend on the amount of trees AT ALL. The performance does not depend on trees amount as well. In this asset I supply the textures 256x256, 7 layers including ground. But using Texture Forest Studio you can generate textures of any resolution and for any number of layers.
     
  49. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    Texture Forest works with STANDARD Unity terrain. If an editor or creator supports the standard Unity terrain the Texture Forest will work with it.
    If not then in any case I supply all the source code and you can modify the asset to support any format you want.
     
  50. Dmitry-Soldatenkov

    Dmitry-Soldatenkov

    Joined:
    Jun 24, 2015
    Posts:
    75
    Many users modified this asset for generating forest in real time. This technology is very convenient for this. And of course you can use for it a color map. It doesn't matter. But you have to do it yourself, I just can say what part of code you need to modify and which way.
     
unityunity