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
    Hi Vander-Does,
    I can't answer immediately. I need to try it.
     
    Vander-Does likes this.
  2. Deleted User

    Deleted User

    Guest

    Hello, you should upload an 2018.3 version with hdrp support

    Im sure alot of people will be interested by your asset
     
  3. maynardkl

    maynardkl

    Joined:
    Nov 20, 2015
    Posts:
    6
    Hello, Dmitry can i make other trees beside pines? something like palm? can you suggest something? i try to make palm but i doesn't look like a palm, can you give me some tips and trick
     

    Attached Files:

  4. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Hi maynardkl,
    Many people asked me about palms so I decided to make a palm prefab for you. It looks approximately like this:

    upload_2019-3-24_0-31-34.png

    I've uploaded palm prefabs and scene to Dropbox. Download it and unpack to Texture Forest Studio.

    https://www.dropbox.com/s/m9acr6xamrgqoy4/TFS_Palms.unitypackage?dl=0

    By the way, I am preparing an update for Texture Forest with multiple forest types, LOD system and shader with fading. It should be ready in the next two weeks. I'll include palms into update.

    upload_2019-3-24_0-42-35.png
     
    maynardkl likes this.
  5. maynardkl

    maynardkl

    Joined:
    Nov 20, 2015
    Posts:
    6
    Hi Dmitry,
    Thanks for your help, the palm's prefab can work (y)
    But can you help me to set the texture like what you show, since my palm tree texture looks like this :
    PalmTree.PNG

    Is there any setting to make the texture looks like palm leaf like yours?
    Texture Forest Studio config.PNG

    Nice! will wait for Texture Forest with multiple forest types, LOD system and shader with fading on your next update.
    Thank you before.
     
  6. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Hi maynardkl,
    I've checked and found that Asset Store contains very old version of TF Studio. It doesn't support variable ragged edges. So I am urgently preparing the update. I'll send it to you before publishing in Asset Store.
     
  7. SimLoop

    SimLoop

    Joined:
    Jun 17, 2013
    Posts:
    25
    I'm trying to use Texture Forest with 2018.3.7f1 and it doesn't seem to be working. Is this because of the new terrain features? When I load a scene with a texture forest added in 2017 it still works properly.
    Do you have an update planned?

    Update-never mind. Just saw you have an update coming out in two weeks.
     
  8. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    I've checked Texture Forest for 2018.2. It worked well. I'll check for 2018.3.7f1 before uploading the update.
     
  9. SimLoop

    SimLoop

    Joined:
    Jun 17, 2013
    Posts:
    25
    Yeah, it looks like it is not working on terrains made with Real World Terrains. Very odd.
     
  10. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Ok. Can you send me one for test?
     
  11. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,372
    Any plans to support the LW SRP?
     
  12. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Frankly speaking at the moment I don't have any plans to support LW SRP. Texture Forest is created for fast but for quite simple render which could work everywhere. Right now my highest priority is to prepare good release of the latest version for TF and TF Studio because I already have many useful features for them.
     
  13. maynardkl

    maynardkl

    Joined:
    Nov 20, 2015
    Posts:
    6
    Ok Dmitry, thanks for your info
    Let me know if you your update is ready.
    Many thanks
     
  14. SimLoop

    SimLoop

    Joined:
    Jun 17, 2013
    Posts:
    25
    Do you have an email I can send this scene to you.
     
  15. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    I've sent the new versions of TFS and TF to review.
    I've tested them on 18.3.10 and 18.3.11. They were converted with a couple of warnings (obsolete splatPrototype and macro in shader).
    TF and TFS work fine on these versions.
    Here is the documentation for them:
    https://www.dropbox.com/s/i97v8l1zglk4rmu/Texture Forest Documentation.pdf?dl=0
    https://www.dropbox.com/s/g8c187rxra36fsl/Texture Forest Studio Documentation.pdf?dl=0
     
  16. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Unity has released the Assets. Now you can use version 2.0 of TF and TFS.
    I've tested it once more on 2018.3.11. It works well.
    Enjoy.
    upload_2019-3-31_15-6-31.png
     
  17. SimLoop

    SimLoop

    Joined:
    Jun 17, 2013
    Posts:
    25
    Well I downloaded and installed the update and this is what I'm getting (see image).
    The effect is only being applied to a small portion of the painted area. TF.jpg
     
  18. orni137_

    orni137_

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

    I can't understand by the picture what happens. Is it standard Unity terrain? Do the sample terrains from my package work well? I've created a terrain from the scratch in 18.3.11 and applied Texture Forest to it. It worked well.
    Can you send the sample of your terrain to me? I'll look at it.
    What opacity do you set when paint a forest texture? It must be 100%.
    What Mesh Step do you use? It must not be to large or the forest can go under the terrain.
     
  19. SimLoop

    SimLoop

    Joined:
    Jun 17, 2013
    Posts:
    25
    TF.jpg Ok, finally got it figured out and got it working. I've got another issue though. I have a multi-tile terrain made with Real World Terrain. I have applied and textured each tile individually and created the forest separately but this is what I get.
    I've done this before with multi-tiled terrains on and earlier version of TF and it worked. Any suggestions?
     
  20. orni137_

    orni137_

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

    It should be the interference of materials. Check material's folders and indices.
    upload_2019-4-11_11-33-35.png

    I often use connected terrains but usually they use the same material for forests.
     
  21. hMark

    hMark

    Joined:
    Oct 16, 2013
    Posts:
    16
    Hi Dmitry,

    First, thanks for your work. Your plugin has really helped to develop the environment in our application.

    But to the point... we ran into an issue with Ambient Occlussion in Unity Post-Processing Stack v2. When the AO is turned on there are weird black artifacts rendered around forests.
    ao_on.png

    The same scene with AO turned off.
    ao_off.png

    We can partially resolve the problem by moving the forest material to 2500+ queue base telling the system to render them later. But this is double-edged sword as forests overdraw other materials, so it is not bulletproof solution.

    Do you have any idea if there is a fix for this problem?

    Thanks for response.
     
  22. orni137_

    orni137_

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

    I think that shifting of render queue to 2500+ is a good solution. This queue is for transparent objects and we can consider forest as transparent. As a bonus it solves the problem with shadows from another objects. I often use such a solution in my scenes.
    But frankly speaking I've never used AO in my projects with Texture Forest. TF shader doesn't write Z so AO will not work correctly with it. Trees are not objects but just an illusion :)
    Maybe we can add Z-writing to shader but in this case it must be Alpha Test, not Alpha Blend. I don't like how Alpha Test looks.
    In any case the research in this direction may be successful.
     
  23. AnndreasC

    AnndreasC

    Joined:
    May 3, 2019
    Posts:
    3
    Hello Dmitry,

    First, a real big thanks for all the work you put in this Asset. It's a real improvement to the project I am working on.

    Though the problem I ran into, is the forest not receiving or casting any shadows.
    I have a scene with a simple Terrain and a texture forest. What I need is for the texture forest to receive shadow from a mountain.

    Ideally even casting a shadow.

    I tried to rewrite the shader but it seems I am still too inexperient with shaders to understand what I am doing.

    Thanks in advance for your help.
     
  24. orni137_

    orni137_

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

    Texture Forest really doesn't support standard lighting because it's useless for this sort of objects. Brightness of such objects doesn't depend on the angle between normal and light direction.
    Texture Forest shader supports vertex color. You can make shadows by transmitting shadow color into vertices. It can be done during generation of forest mesh,
    in this function:
    Color pointColor(int x, int y)
     
  25. AnndreasC

    AnndreasC

    Joined:
    May 3, 2019
    Posts:
    3
    Hi Dmitry,

    Thanks for your reply.
    Though sadly I don't understand how I can access shadows on the terrain, while creating the forest.
    Especially in the "Color pointColor(int x, int y)" function, as it only gets two int as parameter and nothing else.
    Do I have to completely rewrite the function and add a reference to the terrain pixel underneath the forest I am currently creating?

    Could you please guide me in the right direction with this?
     
  26. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Hi AnndreasC,
    The algorithm could be the next:
    When we create a vertex for forest mesh, we check a raycast in the direction opposite to light. If there is no intersection, we remain the vertex color as it is. If there is an intersection, we decrease the color to ambient value.
     
  27. AnndreasC

    AnndreasC

    Joined:
    May 3, 2019
    Posts:
    3
    Hi Dmitry,
    your algorithm sounds like an idea that should work.
    Thought I am stuck again as I can't find the world position of the current vertex, where the raycast should start from.
    Could you please help me out again?
     
  28. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    In "createLayerMesh" we fill all the data for vertex.
    Vertices.Add (pointIn3D(x, y)) fills the position of vertex in the world.
    function "pointIn3D(x, y)" returns this position.
    Nearby we set the color for vertex: Colors.Add (pc)
    Cast a ray from the position and change the color.
     
  29. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Hi everyone,
    There's certainly something I'm missing out, but I can't get texture forest to work. I followed the very simple workflow described in the documentation: selecting a texture, painting it on the terrain where I want texture forest to be applied, selecting the texture as texture object, setting the right index for terrain texture index... Hit "Create Forest" and... nothing. No error, no weird result, no nothing. Just the plain flat texture on my terrain. Tried on Unity 2018.1, 2018.3 and 2019.1.
    Could you please help?

    Clipboard02.jpg

    I've also noticed, in my example which has two textures used on the terrain, that it works if I set the texture forest index to 0, but it looks like it is generated everywhere (see screen capture below).

    Clipboard03.jpg

    One last thing: from what I can see, the only difference between any terrain I create (where texture forest works for me) and the terrain I'm working on is that, on the latter, heights are generated by importing a raw heightmap.

    EDIT: I think I figured it out: texture forest will work only if, in the terrain parameters, the heightmap resolution and the control texture resolution have the same value (the +1 increment on heightmap resolution set aside). I don't remember reading this in this forum thread or in the texture forest documentation. There may be something wrong with my setup. Any leads?
     
    Last edited: May 20, 2019
  30. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Hi SgtLame,
    The main map for Texture Forest is a height map but it may work with control map of any resolution.

    Vector3 pointIn3D (int x, int y, int layerN = 0) {
    Vector3 p = new Vector3 (x * terData.heightmapScale.x,
    heightMap[y, x] * terData.heightmapScale.y + layersHeightDiff * (layerN + 1),
    y * terData.heightmapScale.z);
    return forestTer.transform.TransformPoint(p);
    }

    float pointAlpha (int x, int y) {
    int X = (int)((x)*alphaCoeff);
    int Y = (int)((y)*alphaCoeff);
    return alphaMap [clampA(Y), clampA(X), splatMapNumber];
    }

    Tx = terData.heightmapWidth;
    aTx = terData.alphamapWidth;
    alphaCoeff = aTx/(Tx-1);

    The main loop runs by heightmap.
    If you can share your project with me I can look at the problem of forest generation here. From the first look everything is correct in your settings.
     
  31. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Thanks for your answer Dmitry. As I said, the problem occurs when heightmap resolution and control texture resolution don't have the same value (for example, 513 and 1024). You can download an example here: https://we.tl/t-lrovjc2xRL
    Other than that, now it works perfectly.
     
  32. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    I've reproduced the problem. Really something strange happens. It looks like the terrain returns one and the same splat texture for whole terrain. If the first vertex is forest, the whole terrain will be forest and vice versa. I need a little bit more time to investigate it.
     
  33. orni137_

    orni137_

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

    The problem is solved. It was because of integer division.
    Please change string 307:
    alphaCoeff = aTx/(Tx-1);

    to:
    alphaCoeff = (float)aTx/(float)(Tx-1);

    and everything will work.
    I'll include this fix into the next release.
     
  34. SgtLame

    SgtLame

    Joined:
    Nov 26, 2015
    Posts:
    129
    Thanks a lot Dmitry! Glad this helped notice a bug. ;)
     
  35. BoogieD

    BoogieD

    Joined:
    Jun 8, 2016
    Posts:
    236
    Hello Dmitry. I just bought your assets and like them although having problems with the Texture Tree Studio. I'll persevere with it for the moment but may get back to you. :)
     
    Last edited: Jul 20, 2019
  36. orni137_

    orni137_

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

    Thank you for purchasing the Texture Forest Studio. The problem you met may be caused with the algorithm using by Studio for generation of tiled texture.
    Studio creates the additional equivalent trees on the both edges of field to create tile effect and removes them after generation. If something prevents to terminate generation well the additional trees will remain on the edges of field. In this case you can press undo. It must restore the initial state of scene. After that you should fix the cause of problem using log and then generate textures again.
    I advice you to generate textures of low resolution first. It helps you to save your time. If everything is Ok during generation of low resolution textures you can run the generation with high resolution.
    If you can't get over the problem you can send me your project and I'll help you to tune everything.
     
  37. BoogieD

    BoogieD

    Joined:
    Jun 8, 2016
    Posts:
    236
    Dmitry, Thanks for your response. I changed my comment because I figured I may have moved a file in Texture Studio causing the exception. Your answer was useful though in understanding the extra trees outside the field which don't get removed when it's resources are not right and the process fails.

    I have found what I think is an error though. You are not setting the colliders to Convex therefore isTrigger does not get set. An easy fix in your code.
    I suspect your collider shapes are at times out of whack too. Sometimes excessively or mostly over the non forest parts and or missing over the forest parts too. I have not fully evaluated though.
    I'm testing your Fir Wood terrain sample with your forest painted. 64 size field.
     
    Last edited: Jul 24, 2019
  38. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93

    Hi BoogieD,
    Ok. I'll check it this weekend.
    Maybe you know, the shape of collision mesh is not convex in our case, so if I set Convex for collider it will not truth. But I can set it anyway. Will this work right?
     
  39. BoogieD

    BoogieD

    Joined:
    Jun 8, 2016
    Posts:
    236
    Dmitry.
    I think some of the collider meshes are concave depending on the shape of the forest edge on that mesh tile so I'm not sure of the consequences in our case. Perhaps the concave part equates as being within the collider. If so, the collider for that tile would ideally need to be made into more than one so as a set, they are all convex.
    The wavy forest edge within a tile can make colliders for it more complex because they need to be convex for isTrigger to be set.
    Changing the line below from false to true enabled me to check the isTrigger and my plane now plummets into the forest undergrowth rather than bounce off the forest collider. :)

    In TextureForest.createForest method
    mc.convex = true;
    rather than false as it currently is.
     
  40. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Yes. To make collider convex is no problem. But it will generate false alarm in gaps. If you don't need to have such a precision it will work.
     
  41. BoogieD

    BoogieD

    Joined:
    Jun 8, 2016
    Posts:
    236
    Yes, your colliders are all convex with the occasional odd one over no forest at all. In the case of a forest edge that is convex where collision is critical the forest can be re painted to suit the edge of the collider. Fewer colliders is best.
     
  42. RetroFlight

    RetroFlight

    Joined:
    Nov 16, 2019
    Posts:
    41
    Hi Dmitry, this looks amazing. Im interested in using this for an Oculus quest flight sim that uses mesh trees, but use this for the undergrowth/small bushes under the trees and in fields etc. 1. Can I use this to make a bush texture and layer it over another terrain texture with some transparency so you can see the base texture come through?
    2. Also how does it work in VR with head movement?
    3. Does it work on mobile?
    Thanks!
     
  43. RadekMan

    RadekMan

    Joined:
    Jul 31, 2018
    Posts:
    3
    Hi Dmitry,
    just purchased the asset. Works very well if I just try to use one type of tree texture on terrain. When I try to use second type of texture on the same terrain the first one after "Create Forest" turns into pink blob. See attached picture. Is second type of forest texture supported?
     

    Attached Files:

  44. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Hi RadekMan, The multiple type forest must work. As far as I remember I included sample with such project into the package. Can you send me your project? I'll try to tune it.
    By screenshot I can see only material conflict.
     
  45. RadekMan

    RadekMan

    Joined:
    Jul 31, 2018
    Posts:
    3
    It was a material confict indeed. Setting individual Material Ponflict for each texture type did the trick.
    Thank you,
    Radek
     
  46. RetroFlight

    RetroFlight

    Joined:
    Nov 16, 2019
    Posts:
    41
    Hey Dmitry, I've purchased this and am trying to get it to work on Oculus Quest... with poor result. Any chance of getting textures higher than 256? 1024 would be great 2048 ideal. Also any chance of having it generate only say 3 or 4 layers instead of 7, but at a higher resolution? Right now it looks like blurry mud when compared with modern high resolution textures.
     
  47. RetroFlight

    RetroFlight

    Joined:
    Nov 16, 2019
    Posts:
    41
    Ok I have got it mostly working after lots of playing around. By changing thetile size I can keep the batch count down and it is very performant - i cant tell any slowdown. It looks good in VR. I upscaled the textures in GIMP to 2048 and it looks waaaaaay better.

    A few issues: on a brand new terrain I can paint the forest and generate it, no issues. If I make changes though and regenerate it will only let me generate on texture 0 - and it covers the entire terrain. Any ideas?
     
  48. RetroFlight

    RetroFlight

    Joined:
    Nov 16, 2019
    Posts:
    41
    Well looks like it was a Unity bug. Restarting fixed it.

    I am giving this a 5 star review - i will be able to do so much with this.
     
  49. MixedupJim

    MixedupJim

    Joined:
    Mar 12, 2018
    Posts:
    7
    This is an awesome asset - thanks for making it.

    I've seen a few people asking about lighting for the trees. I've managed to cobble together a work around to get the tree shaders working with Overcloud which has a day/night cycle in it....

    It consists of 2 parts.
    1. A script that reads the colour of the Sun/Moon lights in Overcloud (should work for any light though) which I've attached. Assign your Texture Forest materials and the Overcloud Lights in the inspector.

    2. A slight modification to the shader to allow a tint colour to be set as follows....
    Line 5 - ensure you have _TintColor ("Main Color", Color) = (1,1,1,1)
    Line 77 - change o.color = v.color to o.color = v.color * _TintColor;

    That's it. The script will run in the editor and tint the tree materials as needed giving a pretty good approximation being lit correctly.
     

    Attached Files:

  50. orni137_

    orni137_

    Joined:
    Jun 24, 2015
    Posts:
    93
    Hi MixedupJim,
    The Texture Forest Studio asset writes light to textures to be faster and easier. It is interesting what solution you suggest. I am on vacation now. I'll look at it when I return. Do you have some screenshots?