Search Unity

[Released] Distingo - Terrain in Detail

Discussion in 'Assets and Asset Store' started by NemoKrad, Feb 1, 2016.

  1. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I only have 4 textures, but I'd like the error to go away. Anyway, I can't find that shader. Where is it? I think I'm not understanding your response. Is there a way to get the error to go away?
     
  2. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    Ok, judging by that error message it cant compile a shader due to it not finding the add pass dependency shader. Have you moved or deleted any shaders? Its the only real reason you will be getting that error message.
     
  3. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I did move the shaders into the Resources folder because I thought that was all that was needed for them to be included in the build, but apparently that's not the case. I will move them back and see if it changes anything.
     
  4. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    Martin_H likes this.
  5. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    That's awesome! At the moment I'm using a clunky hack that overwrites the Texture2D placeholder files that I'm using with Distingo. If you find a better solution that would be great! The biggest issue I had is that it's recommended to rebuild procedural textures before you access their generated texture data and the rebuild takes a moment. So it was not possible to do it every frame.
    Also you might want to head over to the allegorithmic forum and ask if they've got any recommendations. They used to have their own substance terrain asset that allows you to use substances on Unity terrain, but it's deprecated. Maybe they have some ideas what could work best or at least hints what didn't work for their solution?

    Edit: Those tesselation screenshots on twitter look impressive as well! Any chance that technique will also make it into Distingo? ^^
     
  6. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    All I will be doing is adding texture support, so extracting and using the textures provided in a substance on the texture channels in Distingo. I won't be implementing a substance shader in Distingo.
     
    Martin_H likes this.
  7. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    Isn't that the standard way how any substance is used? I'm not aware of anything that does more than use the bitmap textures that any given substance generates.
     
  8. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    No, a Substance shader, has all sorts of stuff going on in there, altering water levels, height blending and all sorts of stuff, they are pretty cool actually.

    At the minute I am thinking of having a slot on each texture channel for a material, if the editor picks up that a material is being used on that channel, it will extract what it can from the material and use that for the given channel. I guess it would work for ANY material you injected there, not just Substance materials. Still not sure if I can pass that as a param yet, but think I can.
     
    Martin_H likes this.
  9. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    Sounds great! If that makes live updates of the terrain material while tweaking the substance parameters possible, that would be even better! Thanks a lot for working on this!

    While you are looking at this, do you think it would also be possible to include a function for the terrain shader to include a splatmap directly? At the moment I think it's always reading the one from the terrain data and you can only get your own splatmap in with an additional script (or by using the mesh-only shader which doesn't work with terrain data). Am I overlooking something?

    Interesting, I never heard of those.
     
  10. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    May well be me not understanding them a great deal, but sure they have lots of stuff in there other than just the textures.

    I guess, if tweaking the materials params then yields the texture I can get out of the material, then yes, that is how it should work. At the very least, it will mean you can hand the material to a texture channel and Distingo will (if I get it to work) extract the textures it can use and implement them.
     
  11. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    I could offer up a param like in the mesh shader to pass a splat map directly, but as I say, would really like to not infringe on the terrain engine if I can help it. I will be bending this rule a little if I use my Substance material idea as I will be altering the albedo and normal map texture the engine would have set in it's script.

    As I write this, I am almost deciding not to add the Substance stuff, I am sure it will lead to a few headaches that I could probably do without as far as support goes as folk will want elements that I won't be providing like being able to edit the surface material params from in the Distingo Inspector.... :/
     
  12. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    The thing is I'm using 100% World Machine to generate the terrain. Manually creating the splatmap for that is comepletely out of the question, so I have to load in the one I generate in WM somehow. I'm not aware of any "official" way to do that, are you? So I'll have to mess with the splatmap that unity stores with the terrain data in one way or another. The official WM script for importing splatmaps probably tries to do something similar as well, but a) it's old and b) it's javascript.

    No problem, I understand. I've got my own hacky solution already in place anyway, it's just that I'm sure your's would have been better ^^.


    I wonder, what is the exact difference between the terrain shader and the mesh shader? Is there a reason why you couldn't enable the mesh shaders to be usable with the terrain data? If that was possible that might solve all the things we're currently talking about and would also give me the possibility of easily changing the splatmap at runtime again.
     
  13. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    It's my own restriction really. The Unity Terrain engine (as far as I can tell) hides stuff like when it is doing the additive render (so >4 textures) in the Distingo editor, keeping the values in Distingo and the Terrain Engine lined up. It's not that things can't be done, it's just that in some cases is it worth opening up a Pandora's box of pain lol

    If I get this working, and as I am bending my rule for the subtance shaders as it is, ill see if I can add a splatmap to the Distingo shaders for unity terrain.
     
    Last edited: Jun 13, 2016
    Martin_H likes this.
  14. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    Hello Distingo users, I have been working on the 1.4 update and have spotted a bug, it's to do with the near far uv mapping on the occlusion textures, it's fixed in my dev build and will be in 1.4 update.

    I have also been looking at integrating Substance materials into Distingo, and it seems I can't do this with the Unity Shaders, but I can with the Mesh Shaders, it's a shame and it looks pretty cool, I will get a screen shot up soon.

    Also, the creators of World Creator have been in touch with me and we have struck up a partnership where we are promoting and supporting each other, as I have with the Gaia Which is great, more coverage for us asset developers :)
     
    Martin_H likes this.
  15. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    So, here is a pic of the Mesh shader using a Substance Material, now this does not have to be a substance material, it could be any (PBR) material and Distingo will pull the textures out of it as best it can.


    I know, I know, not very useful terrain Substance Materials, but I am using it to test with.

    This is what the editor for the padded texture channel looks like

    Hope you will find this useful, those that use Mesh terrains at the very least :/

    Another angle
     
    Martin_H likes this.
  16. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535
    Does that mean we could use substances like this https://www.assetstore.unity3d.com/en/#!/content/7940 without needing any 3rd party packages? Also, since you have a partnership going with World Creator and Gaia, would you also consider working with Terrain Composer? I really like Distingo, and have done since I first bought it, really simple to use and with great results, and hope to be able to continue using it if TC2 is released.
     
  17. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    I don't know about that Substance asset, but as it's free Ill get it and give it a go and let you know. The Substance materials I am using to test with are from here.

    I will not be including ANY substances in the Distingo build.
     
    jonfinlay and Martin_H like this.
  18. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    Looks like they work.
     
  19. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    Just pushed latest documentation here.
     
    jonfinlay likes this.
  20. tequyla

    tequyla

    Joined:
    Jul 22, 2012
    Posts:
    335
    Hello NemoKrad :)

    Could you please let me know the relevant files (or folders) needed for using Distingo : only scripts folder and shaders folder always ?

    i use Distingo in standalone or with Gaia.

    ++++
     
    Last edited: Jun 19, 2016
  21. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    To use Distingo you need all the items in the Scripts and Shaders folder, on build you need to have ALL the shaders in the additional shaders list as described in earlier posts and the documentation :)
     
  22. bigd

    bigd

    Joined:
    Feb 14, 2014
    Posts:
    40
    Hi - current owner of VTP here. Any way we can use height-based blending with Distingo? Apologize in advance if you've answered this before. Thanks
     
  23. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    As Distingo stands at the moment no, but the VTP guys where creating a patch so you could combine Distingo and VTP, but I have not heard from them in a while.
     
  24. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    Normal settings seem to work a lot better now!

    1.4 documentation might be confusing for people regarding which shaders to add in Settings -> Graphics, because the shader names are different from the file names. Also, it lists 32 total, but in the latest package it seems there are 26 total (including default unity shaders)?

    Hopefully that helps,
     
    NemoKrad likes this.
  25. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    Thanks, yes I screen shot that from my build never checked the list, ill try and get some time to sort that out. I hear what you are saying about the shader names too, alas Unity uses the internal shader names as opposed to the shader file names. Each shader type is actually a number of shaders so hard to give them all names that relate to the shader types, but again Ill see if I can simplify that too.
     
    Martin_H likes this.
  26. Deleted User

    Deleted User

    Guest

    I have recently bought this, I imported it and got a few errors, you already replied to one on the GAIA forum ;)
    But, I'm still getting one error with AQUAS. AQUAS has a underwater effect, and it needs global fog. Everytime I import Distingo it creates a error and to fix the error, I need to delete the effects folder and import the new effects and then open globalfog and change a line, which is annoying because I have to do it every update, but I don't mind it. But if you don't mind, can you please update the effects folder in Distingo? - I'm sure a lot of us use AQUAS! :)
     
  27. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    Yes, AQUAS is great, when you import Distingo, all you really need is the Scripts and Shaders folder in the Distingo folder, the other bits are just there so you can run the Demo scenes that come with it.
     
  28. Deleted User

    Deleted User

    Guest

    Ohhh, I get it now, my bad! - Thanks! :)
     
  29. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    No, not at all, Unity assets come with all sorts of bits and bobs, we all tend to just pull the lot into our projects. I tend to create a new project, install it there first, have a play and a look at the asset and if I can't figure out what's needed, ask. Might be worth me putting the "MUST HAVE" bits in the documentation too.
     
  30. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    Is there anyway to instantly add the required shaders? Is there a project setting file maybe?
     
  31. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    Nope, you have to do it manually, though, someone (@Martin_H ?) posted on the other page a way of being able to grab the folder I think and it adds them all for you. Not tried it myself.
     
  32. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    It looks like Distingo adds the terrain shader only to the currently active Terrain. If I have multiple terrains this doesn't seem to work. Might try to change the code to work with the terrain it is attached to.
     
  33. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    Yes, I plan to sort that out for a future update.
     
  34. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
    I just bought this package. I have made custom slat maps from real world satellite data. I am using Unity Terrains In the Unity Terrain Material slot I can go to the material dropdown and select Custom Shader so I have two questions.

    1. Can I use your Mesh shaders with the slot for a Splat Map for my custom splat maps based on satellite images on Unity Terrains.

    2. Can I use Triplanar Shading with Unity Terrains?

    I also saw the above couple of posts and need clarifying.

    3. I have 36 terrains in total. I get the gist of them saying it only can be added to one terrain at a time. I do not mind adding it 36 times but it is worded as though it can only be used on one terrain only. Can you clarify this?
     
  35. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    I think you can, but it's very heavy on performance, so I guess you won't want to.

    Afaik you can use mesh shaders only on meshes and terrain shaders only on terrains. But you can get your splatmap into the terrain through other means.

    I can't answer the question as I've only ever used 1 terrain (but several meshes) but I think you'll hit the following problem and want to give you a heads up:
    So, maybe have one active to tweak settings and then comment it out or something like that. I also thought it should be possible to just pseudo-time-slice it by calling it only in random intervalls from the update loops, so that it still does update, but on average only once a second instead of every frame.
     
  36. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
    Thanks for the heads up on Update loop in edit. I have been searching for methods to simplify getting the splatmaps into the terrains but came up short for a simple method so far. If you have any simple method let me know. It looks like the Terrain Asset itself has a splatmap under it's hierarchy but I do not want to just drop in a new one under that, remove thew original and eff up days of effort. I haven't even checked the API to see if I can create a simple editor script as I have enough on the table getting all the trees, vegetation, photographing real world dirt, cliffs, forest ground cover, plants etc. and hand making tileable terrain textures and plant leaf and bark texture maps for it.
     
  37. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    I've only done a quick hack for testing and have switched to just using meshes. This is the relevant part of the code from my script, but no warranties! I think it overwrites the splatmap in the terrain data permanently! But I don't know for sure since I never authored one manually in the editor. So... better make a backup :).
    For that to work you'd need to add the script to a terrain, drag the splatmap from the terrain in the hierarchy into the splatmap slot of the script in the inspector, and also drag in the texture you want to replace it with. They need to have the same resolution, or else it will mess up! And for directly reading/editing textures that way, there seemed to be some settings you need to make first. As far as I remember you have to set the texture compression format to "automatic truecolor" and enable read/write. Try these settings:



    Code (csharp):
    1. public class MTerrainTextureReplacer : MonoBehaviour {
    2.  
    3.    public Texture2D terrainSplatmap;
    4.    public Texture2D newSplatmap;
    5.    private Terrain terrain;
    6.  
    7.   void Start () {
    8.  
    9.      terrain = gameObject.GetComponent<Terrain>();
    10.      ReplaceAllTextures();
    11.  
    12.    }
    13.  
    14. void ReplaceAllTextures() {
    15.      if (terrain) {
    16.  
    17.        if (terrainSplatmap != null && newSplatmap != null) {
    18.      
    19.          Color[] Pixels = newSplatmap.GetPixels(0,0,newSplatmap.width, newSplatmap.height);
    20.          terrainSplatmap.SetPixels(Pixels);
    21.          terrainSplatmap.Apply();
    22.        }
    23.  
    24.      }
    25.  
    26.    }
    27. }
    28.  
     
    Last edited: Jun 28, 2016
  38. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    @NemoKrad, I'm curious how easy it would be to release a toggle or some kind of extra script that would allow more than 4 unique distingo layers (so more independent control of 5-8... etc)?
     
  39. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    It isn't, I have no way of knowing when the Unity Terrain engine is calling the additional passes to then pass the extra Distingo data, that's why I am afraid we are limited to the first 4 texture channels :(
     
    Flurgle likes this.
  40. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    1. No, I have tried to stay away from altering the Terrain Engine scripts settings as much as possible.
    2. Yes you can.
    3. In the initial versions multiple terrains have not been an issue, but I have had a few reports that the later versions are not playing well with multiple terrains, it's something I am looking at and hope to have in the next update.
     
  41. TheEndersWAR

    TheEndersWAR

    Joined:
    Jan 8, 2015
    Posts:
    58

    Distingo's awesome!
     
  42. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    @TheEndersWAR that's very cool. What's going on in this scene? Is it a procedurally generated thing? Do you have more screenshots?
     
  43. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    Very nice, feel free to post a review on the store if you havent already :D
     
  44. TheEndersWAR

    TheEndersWAR

    Joined:
    Jan 8, 2015
    Posts:
    58
    oh crap lol, I forgot :O I been soo busy :/ @Flurgle Its made partially with world creator(''Maps only 42% done''), this scene is also apart of my game Project:Venus (''HellBound'') whats happening in this scene is gonna be a explorable tutorial section that will be in the very first chapter of my game, it will also be my testing map for multiplayer :D
     
    NemoKrad likes this.
  45. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    So, I've got this grid of 8 x 8 terrain meshes that I want to texture with 1 instance of Distingo. I've managed to copy the shared material from 1 tile at runtime to all the other tiles and I manged to set the texturescale of the splatmap to 0.125/0.125 to correctly map accross all tiles. The tiles themselves each have their uv coordinates in size of the the 0..1 range, but shifted by +1 times their index.
    What I can't manage to get to tile correctly is the global blend- and occlusion-texture. When I doubleclick the material on the meshrenderer I don't even see those. How can I access them to make them tile correctly?

    Edit: I found a way to abuse the triPlanarMultiplier value to scale the global blend texture, but that feels like a bad hack.
     
    Last edited: Jun 30, 2016
    NemoKrad likes this.
  46. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    To be fair, it all is at the moment, sounds like you are being inventive with the workarounds.

    Using a single instance over multiple terrains will be tough as they each have their own uv data that will not be shared across the mesh's within the shader, so your "hack" is probably the only way to do it.
     
    Martin_H likes this.
  47. Mixality_KrankyBoy

    Mixality_KrankyBoy

    Joined:
    Mar 27, 2009
    Posts:
    737
    Getting this error :

    Shader error in 'Nature/Terrain/Distingo Standard Specular': failed to open source file: '../../PBR Standard/Occlusion/DistingoTerrainSplatmapCommon.cginc' at line 51 (on d3d11)

    Compiling Vertex program with LIGHTMAP_OFF DIRLIGHTMAP_OFF DYNAMICLIGHTMAP_OFF UNITY_HDR_ON _TERRAIN_NORMAL_MAP
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING

    Note I am using Map Magic for terrains. Though this is a different error than you note in your documentation. I do have Lightmap Static off.
     
  48. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    OK, that error is saying it's failing to open the include file, is it in the folder it specifies and is it in a readable state?
     
  49. Mixality_KrankyBoy

    Mixality_KrankyBoy

    Joined:
    Mar 27, 2009
    Posts:
    737
    It was yes. I deleted Distingo and re-imported and this cleared the error.
     
    NemoKrad likes this.
  50. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    Ahh, brilliant news :)