Search Unity

Texture Forest

Discussion in 'Assets and Asset Store' started by orni137_, Feb 25, 2016.

  1. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    I was asked many times about it. I think that this technology can be used with any type of terrain but for now I made the asset for Unity native terrain only. If you want to use it for another type of terrain you need to modify 2 functions getting splat map and height for the vertex. I repeat: the asset contains all the source code.
    If you generate mesh terrain from Unity terrain you can simply copy the forest from Unity terrain to mesh terrain.
     
  2. worldcreator3d

    worldcreator3d

    Joined:
    Nov 17, 2014
    Posts:
    83
    Hi ... this asset looks really interesting and nice :) - will check it now also. BTW, World Creator creates a 100% Unity terrain so it will work without any problems ;)

    Good work Dmitry!
     
  3. Edgar-Szilagyi

    Edgar-Szilagyi

    Joined:
    Apr 20, 2016
    Posts:
    2
    Hi again Dmitry!

    We are planning to buy your plugin. We have some development stations. One of them is focused in modeling scenarios and models. Another 3 are focused in development code (C#) and one for building final executable.

    Do we need Texture Forest Studio license in all 4 machines or only on that one focused in scene/models creating?

    Do we need Texture Forest licence in all development stations or only one for building station?

    Thanks!
     
  4. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Thank you, nanthrox. I have not worked with the World Creator but I like what it does.
     
  5. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Hi Edgar,

    You need Texture Forest Studio and Texture Forest for designer only but you have to copy the shader of Texture Forest (if you will use it) to all the developers and to the build-server.
    If you still have a question send me an email.
     
    Frednaar likes this.
  6. needyme

    needyme

    Joined:
    Feb 10, 2013
    Posts:
    8
    Hi Dmitry, I am very interested in Texture Forest Studio. My question is can you see down through the forest to the terrain mesh from an overhead camera. Could you see, for example, a vehicle moving on the terrain through the forest where there are breaks in the trees? Can you post a demo of that?
     
  7. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    ObjectInForest.jpg
    It seems they look well :)
     
    John-G likes this.
  8. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
  9. jungleeToofan

    jungleeToofan

    Joined:
    Oct 14, 2012
    Posts:
    1
    Hi Dmitry, does Texture Forest Studio also include the functionality of Texture Forest? I have bought TF Studio and I can generate trees and textures but how do I paint it on the terrain? The TextureForest script is not present.
     
  10. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    The functionalities of these two asset are different. I devided the system onto two parts: TFS and TF. I supposed that people who doesn't use native Unity terrain or even Unity render can use TFS to create texture forest for their game.
    The programmers who use native Unity terrain can use Texture Forest to apply the texture set to their terrain.
    So, TFS is for creating of texture set, TF is for applying the texture set to STANDARD Unity terrain.
     
  11. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    Hi Dimitry,

    We want to use Texture Forest in our ship simulator to enhance the our terrain. I purchased the asset, but are having some difficulties getting it to work. I get it to work on a fresh Unity terrain asset, but not on our actual terrain.

    Can you please help us out, perhaps a short skyp session? contact me on olav@morildinteraktiv.no
     

    Attached Files:

    Last edited: Jul 24, 2016
  12. hyprstereo

    hyprstereo

    Joined:
    Dec 1, 2014
    Posts:
    1
    Hi, it seemed to be taking a long time generating the texture forest. I've even drew a smaller patch and it's still taking a long time (waited for over an hour, nothing generated still). Attached #1is the smaller patch im trying to test it out. Screen Shot 2016-07-31 at 4.52.41 PM.png

    When it's generated attachment #2 (Bigger Area), the scene became extremely slow.

    Screen-Shot-2016-07-31-at-12.13.18-PM.jpg

    Could this be a problem with the latest Unity3D 5.3.6f? Because previous version, it worked like a charm.


    Im running on OSX.
     
  13. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Hi hyprstereo,
    Did you try the version 1.4? I've analyzed a code and made some improvement in the scope of performance. If it doesn't help I'll continue this research.
     
  14. Mukabr

    Mukabr

    Joined:
    Jun 10, 2013
    Posts:
    61
    Hi Dmitry, how are you?

    I'm working with your tool and I would like to know a few things:
    1. When I generate the forest, there are a lot of places that doesn't have trees, but you create a mesh for that place (since i'm working with a freaking giant map, there are a lot of "empty" objects in the scene). There is a way of not creating this quads that have no functionality? (check image)
    2. Also, I need to create an asset bundle with this terrain with the trees and everything. I found a problem where the mesh created is not being saved and therefore when this asset is instantiated, the forest is not there. I tryied to fix this problem saving the meshes but, like I said above, my map is huge and there are alot of tiny meshes that are not being used but are also saved (I spent 30 minutes waiting to unity save all the meshes). Do you know another way of "serializing" the meshes?


    Thank you very much!
     
  15. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    Has anyone modified this to work on a mesh that would be willing to share what steps are required. I skimmed the above posts and the author said it wouldn't be difficult. I can update the code, I just don't have time to work through and troubleshoot it. Thanks.
     
  16. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Hi Mukabr,

    These are additional squares of forest mesh which were generated before version 1.4. They were needed for correct sorting of forest meshes. Now texture forest uses render queue for sorting and it doesn't generate these squares any more.

    About mesh saving: I can't answer to this question immediately. I will research it.
     
  17. Mukabr

    Mukabr

    Joined:
    Jun 10, 2013
    Posts:
    61
    Hey Dmitry,

    Thanks for your reply.

    I've managed to "save" the meshes by literally saving the mesh when creating it. So when I create the asset bundle, it has a reference to all the meshes created (just like it have with the materials).

    Something like this (just after you call createLayerMesh function on createForest):

    Code (csharp):
    1.  
    2. string savePath = "Assets/Texture Forest/Meshes/" + "ForestLayer" + layerNum.ToString() + "_" + x.ToString() + "_" + y.ToString() + ".asset";
    3. AssetDatabase.CreateAsset(layerMesh[layerNum], savePath);
    4.  
    I don't really know if it's the best solution, but it works.

    Thanks again,
    Murillo.
     
  18. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    Hi Dmitry,

    from what I see I understand that you are creating a diffuse map from slicing through the spherical trees.
    Do you also create a heightmap of some sorts to emphazise parallax effects or lighting? How about ambient occlusion maps?
    Would it be possible to create all these custom textures entirely through utilizing Maya and feeding these into your editor? That would enable us to create very unique looking forests and maybe increase the frequency of details.
     
  19. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Hi Marco-Sperling,
    I use my own empirical function for calculation of lighting in forest. Texture Forest Studio contains all the source code, so you can change this function and play with it.
    For Texture Forest I presumed that we have a relatively large distance between texture layers. If we will decrease this distance we will have usual 3D texture instead of layers at the end.
    I don't know Maya well enough to say, can we use Maya for 3D texture calculation. I hope we can :)
     
  20. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Hi Soundwolf776,

    >Can you elaborate on why TFStudio uses ellipsoids to generate tree crowns?

    Ellipsoid is the most convenience form to detect a point position in a volume.

    >What if I place SpeedTrees and then go along Y axis doing "depth-slices" with an orthographic camera to produce roughly the same kind of layers?

    A lot of people wants to make such an algorithm for SpeedTrees. I don't know how to do it in details but I think it's possible.

    >Personally, I'm extremely interested in dynamic lighting on texture forest, even if it's not super-realistic or precise. Do you have any plans&timetables for it? If not, any advice for implementing it on our side?

    If you say about time of day only, I think that the easiest way is to generate the forest textures with some time step and to change them during the gameplay.
     
  21. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    Hey Dmitry,
    is there a way to NOT rely on a splatmap to paint your forest meshes on a terrain?
    We already have 4 splattextures assigned and do not want to replace any of that with your Layer0 texture.
    Ideally your tool would store the forest distribution inside its own splattexture and only use the terrain mesh collider to detect where its brush hits the terrain.
    Also your tool could paint Layer0 on a submesh that is lying on the terrain with an offset. This would free us from having to mess with our terrain just to paint forests.

    Also:
    What you see is what you get would be great. Having to press a "generate" button after having painted an area of "soon to be forest" doesn't feel intuitive and increases iteration cycles.

    Also #2:
    The mesh generation process takes ages.
     
    Last edited: Nov 18, 2016
  22. Deleted User

    Deleted User

    Guest

    I would also like a tree map, of some sort...WorldComposer has no splat maps...but I can create a tree map in TerrainComposer, based on tree colors. Something to think about.

    Also, how difficult is multi-terrain? (just a script on each?).

    I am sorry i did not see this earlier!,! was looking for a fast, good looking way to have my trees back on mobile!

    p-
     
    Last edited by a moderator: Nov 18, 2016
  23. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    Yep, we work with RTP shaders and are very limited in the way we have to set everything up. So having the forest painting decoupled from the actual terrain (except for its collider) would be helpful.
     
  24. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    By that I really mean hours on an i5 with 8GB of RAM. It takes so long that I had to cancel the process because I need to get other work done and cannot wait for the mesh generation to finish. Honestly, this renders your tool useless to me :(
     
  25. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Hi Macro-Sperling,

    Splatmap is seemed to me the simplest way to define forest area. And the ground layer is a part of forest sandwich construction. This way is convenient for simple projects. You can try Texture Forest immediately from the box.
    I didn't presume that this technique will be used by professional development team because such teams usually have their own format for terrain and other objects.
    Professional teams usually modify any module for project purposes.
    So, Texture Forest contains all the source code. You can modify several strings and forest will be generated by any function you want.


    >What you see is what you get would be great. Having to press a "generate" button after having painted an area of "soon to be forest" doesn't feel intuitive and increases iteration cycles.

    I agree, it would be nice to see ready forest when you paint the area.


    >The mesh generation process takes ages

    What version of Texture Forest do you use? 1.4?
    I've increased the speed of generation in the version 1.4.
    If it's still slow what size of terrain do you use?
     
  26. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Macro-Sperling,

    It doesn't matter how much memory you have. I calculated 7 layer Texture Forest on i7 for terrain 4096x4096. It took about 30 seconds.
    If it's too slow then increase "Mesh step" to 4 or 8 or more.
     
  27. HaBe

    HaBe

    Joined:
    May 29, 2014
    Posts:
    31
    Hi folks,
    I've adopted the Terrain Forrest shader and added a couple of options that I thought could also be useful for some of you, so I'd like to share the modified version with you here. Thanks to Dmitry for his permission to do so!

    Synopsis
    This version of the shader adds more control over how the TerrainForest mesh appears (light and alpha), as well as optional support for the Sunshine! asset by Punk Labs, and also procedural wind animation on two axes.

    The sway animation is modified by vertex world position to offset the animation over the forest surface for a more organic look. It's also modified by the _shiftScale value that Texture Forest already calculates for each layer mesh. This makes the trees sway more at the top compared to the bottom, which also helps to create a natural looking effect.

    It's working in Forward render mode and adds light from one directional light plus ambient. If you have the Sunshine! asset installed as well, you get shadows casted on your woods from all meshes that have one of the Sunshine! occluder layers plus shadow from the Overcast Cookie (aka cloud shadows) applied.

    TF_Sunshine.png

    Note: Shadow on the terrain in this screenshot is prebaked in the terrain splatmap, the shader doesn't do shadow casting for the Terrain Forest meshes themself in any way.

    Option details

    TF_Inspector.png

    Border Alpha Shift
    Gives you control over how much the borders of the mesh are blended out. Useful for making visible edges disappear where the TF mesh intersects with the terrain.
    Light Base
    Makes the whole forest lighter or darker, a value of 1 gives no change.
    Sunshine Boost
    Controls how much of the sunshine lightmap (light and shadow) is added. If the Sunshine! support isn't enabled, this value does nothing.
    X/Z Sway Factor
    How much the forest is swaying on the X and Z axis and in which direction respectively.
    X/Z Sway Speed
    How fast the trees are swaying in the respective direction. Make sure to have different values for both to avoid a "zero point" where the trees don't move at all in both directions.

    Enabling Sunshine! support
    To make the shader work with Sunshine! lighting and shadow casting, you just have to add the SUNSHINE_SUPPORT keyword to your Terrain Forest material. To get acces to the keyword field, you have to set the Unity Inspector to Debug mode.

    TF_Debug.png

    Disclaimer
    Even though I'm an experienced programmer, this is my first shader work. So if you find any bug or see room for improvement (esp. concerning shader performance), please let me know. I'm always happy to learn from other's experience.
     

    Attached Files:

    Last edited: Dec 12, 2016
    slashware likes this.
  28. Gibbonuk

    Gibbonuk

    Joined:
    Dec 10, 2013
    Posts:
    175
    Hi I am very eager to buy this but before I purchase i was wondering if i can generate forest at runtime based on a splatmap or imagemap? (as this is what I require)

    Thanks
    Andy
     
  29. Gibbonuk

    Gibbonuk

    Joined:
    Dec 10, 2013
    Posts:
    175
    Hi Dmitry, Ive been reading everything I can about this as it is near perfect for what Ive been looking for for a while now. However I believe I have hit a few snags that wont work for me but wondered if there is any work around or solution?

    The main one is I already use 4 textures in my splat, the way I am currently placing trees is using terrainComposer and reading an image map (red values are for trees). Is there a way anyway at runtime that your plugin could generate the meshes by using an texture loaded via script and not via the terrain splat map (but still read terrain height values obliviously)?

    The other thing is I have a in-game "level editor" which lets people play with the heightmap, they then save it and can use it in-game? Is there anyway the generated tree meshes can be saved so they don't have to be generated each time the level loads?

    Many Thanks
     
  30. Frednaar

    Frednaar

    Joined:
    Apr 18, 2010
    Posts:
    153
    Hi,
    I am trying to generate a forest using external textures. I see the forest used in the samples are simple RGB textures with no alpha channel, how do you actually achieve the texture transparency on the different layer ? they all seem to have a greenish background....

    I there a workflow to create forests from textures not using TF Studio ?

    thanks
    Fred
     
  31. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Hi Frednaar,

    Of Course, TF textures are RGBA textures with MIPmaps. TF Studio calculates MIPmaps during working. If you import textures to Unity from outside Unity calculates MIPmaps at the moment of import by default.
    The green background is used to avoid color interpolation to wrong color on crown's edges.

    upload_2017-2-10_21-21-24.png
     
  32. barcode802

    barcode802

    Joined:
    Apr 6, 2014
    Posts:
    36
    Hi I just purchased this asset in hopes of once and for all solving a 'too many trees on screen' but client has to have that many problem for a project. However - I started the script to create forest for a small area - and it has been working for over 4 hours now. This is with the latest unity version 5.6.

    I also tried an empty project - same unity version - and I immediately had scripting errors and couldn't run the script at all to generate.

    Also doing exactly what the guide says, an another terrain and no errors but also nothing happens when clicking the button to generate. Over all not having success with this tool.
     
    Last edited: Apr 13, 2017
  33. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Hi barcode802,
    I installed Unity 5.6 and tried the Texture Forest. I installed it from Asset Store. Everything works well. I tested it on Windows 7.
    What OS do you use? If you use Mac I will check Texture Forest on it.
     
  34. rblkwa

    rblkwa

    Joined:
    Jun 20, 2013
    Posts:
    61
    Hi Dimitri,

    I have just bought your asset. However, processing takes very long. Allthough, after its finished, it seems to work.

    I tested it with a new terrain (500 x 500 units)

    settings:
     
  35. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Hi rblkwa,

    For time of generation it doesn't matter how the terrain large in units. It matters only how many vertices in it. If you want to reduce the time of generation you can increase Mesh Step and Mesh Tile (for example to 16 and 64). But you will lose the precision in this case.
     
  36. rblkwa

    rblkwa

    Joined:
    Jun 20, 2013
    Posts:
    61
    Cool thanks. I have noticed however that sometimes (after processing is done) nothing has happend.
    Using it on a default unity terrain which have been generated using TerrainComposer 2.

    Using Splatmap index 8. It looks like that the mesh is created though, just not the effect of the shader.
    I haven't looked into detail yet though.
     
  37. rblkwa

    rblkwa

    Joined:
    Jun 20, 2013
    Posts:
    61
    Issue solved;

    If you are not using a brush at full opacity the process of generating takes long and sometimes failes. Setting the texture brush opacity to full resolved the issue.

    Thanks.
     
  38. gibmation

    gibmation

    Joined:
    Dec 1, 2014
    Posts:
    311
    Yes I'm having same problems on a large terrain, is over 3hours nows at about 90% done.
    Not sure if to just hard restartUnity.
    This was a test so not even sure if its going to work.

    It would be a good idea to add a Cancel button on Progress Bar to be able to exit this.

    But still think the idea behind this is quite cool.

    It would be even better if you could use this with meshes.
    Maybe support/integration with MegaSplat?
     
  39. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    With this asset is it possible to access properties of each single tree so that I can change its appearance during game play. e.g The tree is healthy and green then later it is unhealthy and losing its bark.
     
  40. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Hi TokyoDan,

    You cannot change anything in texture during runtime. But if you want you can easy precalculate several texture sets and change these sets during game play.
     
  41. dezzell

    dezzell

    Joined:
    Feb 7, 2015
    Posts:
    32
    Just purchased yesterday, I left it up all day and night and all day today. I left the cursor at the edge of the progress bar all day at around 90% and it never moved, so I ended the task. then tried again with a smaller area, and still no go. I do have a large terrain 32768x32768, but just seems like after a day or two it would be done. I process VR video from the interface and it takes less time than this process.

    I'm using Unity 5.6.1f1 and have Windows 10 with i7 six core processor, with 64 GB of memory and 30 TB of disk space with an Asus GTX 1070 video card...

    On a smaller terrain of 4096, it took 5 min for a small patch, however nothing happen on that small patch, instead it all appeared in an area I didn't paint with ForrestLayer0. I selected the Texture Object ForrestLayer0, same as I used to paint a small area, and it just put everything on top of each other on the backside. Very strange.. I went through the document and read the forum and not sure what I'm missing.

    Any help would be great. Texture Forest.jpg
     
  42. dezzell

    dezzell

    Joined:
    Feb 7, 2015
    Posts:
    32
    After another night and day, on a 4096 with no textures except for ForestLayer1, it just sits there. I made sure Opacity was set to 1 with target strength set to 1 and only did a small patch, and still it sits at 90% with no movement. from 7 PM to 8:30 AM. Not sure what else to do. Played with the settings and the Mesh Step and didn't use Mesh Collider. Wasted 3 days of my time waiting and unable to use.
     
  43. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Hi dezzell,

    First of all you have to set the correct index of Forest Splat Map: In your case Splat Map Number must be 5. Splat Map Number is an index of texture which is forest on your terrain. It starts from 0.
    The second, Mesh Step and Mesh Tile must be power of 2. And Mesh Tile must be greater then Mesh step. The greater Mesh Tile and Mesh Step your choose the faster generation will be. I advice to set 64 and 8 for example for large terrain.
    The third, try to create a really small terrain (about 256 or 512 points) and make Texture Forest to work on it. Here you could feel how it works and transfer it to larger terrains.

    Hope it helps.
     
  44. dezzell

    dezzell

    Joined:
    Feb 7, 2015
    Posts:
    32
    Thank you, That helped, I didn't understand the Splat Map Number. I was thinking it would go by the ForestLayer I selected instead of the texture number, which makes since why it took forever to run at the default Texture Number.

    I would have called it Texture Number, or base it on the selected texture. Anyways I was able to paint some areas, and it didn't take that long to paint. I appreciate the quick reply. I will continue to play around and look forward to having fun with this plugin. Will give a good rating. Also will look at checking out your editor.

    Enjoy your week and thank you again.
     
  45. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93

    "Splat map" is a Unity term for that type of mapping which we are discussing. So, I tried to keep this term in documentation.
     
  46. dezzell

    dezzell

    Joined:
    Feb 7, 2015
    Posts:
    32
    I've heard of Splat Map, just never really thought about it in Unity, always called it Alpha Map or Texture Map or Weight Map. Guess different circles refer to it differently. Been using Unity since 2011 and never called it a splat map. Appreciate your help on this and gave you a good rating in the asset store. Will continue to play around and make progress. Enjoy your day.

    Thanks
     
  47. nikescar

    nikescar

    Joined:
    Nov 16, 2011
    Posts:
    165
    Hello Dmitry,

    I understand the purpose of this asset (to be used with Unity terrain) but, I would like to make "pre-baked" forests that I can use on mesh terrain. Is this possible? I have no problem playing with and modifying code if need be, just want to know if your system could work with that before I spend a few days on a futile solution.

    Thanks!

    ps I bought your asset with the intention of tinkering with it to get it to work for my purposes. If it's not possible, thanks for the cool asset anyway. :)
     
    one_one likes this.
  48. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Hi Nikescar, sorry for long delay. I was in hospital. Hope, you were managed to solve all the problems to this time because it seems you are experienced and powerful programmer :)
    In any case I remember that in the beginning many programmers wanted to rebuild TF for mesh terrain and I saved the next explanation:

    The idea is very simple and clear: you have to create a set of surfaces which are parallel to your terrain.
    It makes the function
    void createLayerMesh(int y1, int y2, int x1, int x2, Terrain ter, Mesh mesh, int layerN)
    This function do it not for all the terrain in one step but for squares of terrain bounded by indecies:
    int y1, int y2, int x1, int x2

    To make this function work with your terrain you have to change only 2 functions:
    Vector3 pointIn3D (int x, int y, int layerN, float yShift = 0.0f)
    and
    float pointAlpha (int x, int y)

    This two functions use Unity Terrain data. All the other doesn't (if I am right :))
    So, change them and try.
     
  49. nikescar

    nikescar

    Joined:
    Nov 16, 2011
    Posts:
    165
    Thank you very much for the pointers. Hope all is well!
     
  50. Vander-Does

    Vander-Does

    Joined:
    Dec 22, 2015
    Posts:
    19
    I'm having issues with deferred rendering in Unity 2018. I tried the shader you provided above (though I figure you have since deployed that to the asset store), but the trees don't show. Any thoughts?