Substance Terrain Tool

Discussion in 'Assets and Asset Store' started by Jerc, Oct 27, 2011.

  1. Arcanor

    Arcanor

    Member

    Joined:
    Nov 4, 2009
    Messages:
    108
    Works fine for me in Unity Pro 4.0.

    Jerc, any possibility of a patch that includes 8 materials, as suggested by UnLogick above? Also, what about the possibility of multiple terrains in a single scene... any way that could be added?
  2. Arcanor

    Arcanor

    Member

    Joined:
    Nov 4, 2009
    Messages:
    108
    Sorry for the follow-up post, but this is an important decision for my new project before I get started designing the terrain. Maybe others would have advice for me on this.

    First of all, I love substances! I bought the big substance database, as well as B2M (both 1.6 and the recent 2.0). They look fantastic, and I want to use them on my Unity terrain in my new game. This Substance Terrain Tool makes this possible.

    I also really would like to have multiple Unity terrains in a single scene, because I'm making an exploration type RPG and need a very large and detailed map. This is currently possible without any problems, but ONLY IF I use standard textures. This seems like a huge compromise in that I would be unable to use the beautiful substances that I've purchased.

    Since I'm unwilling to do without substances for my terrain(s), I've got some choices:

    1. I could use multiple mesh terrains (i.e. NOT Unity terrains), and stream those in as needed as a player gets close enough to see them. This would have the advantage of using as many substances as I like by using separate meshes for each one individually. However, I'd miss out on all the optimizations and customization capabilities of Unity terrain.

    2. I could use one single REEEEALLY large (as in 500 square miles minimum) Unity terrain. This seems a bit unwieldy, and then I'd be limited to only 4 substances for the entire landscape. I could then stream assets in as needed. Some of those assets could be smaller mesh terrains, maybe even with additional substances. However this method seems less extensible if/when I decide to add a new area to the map. Also, I don't know how well such a large terrain would perform.

    3. I could try to hack the Substance Terrain Tool myself to allow for multiple terrains per scene. However, I wonder if this is even possible, given that Jerc hasn't come back with a solution yet.

    Advice anyone?

    Or @Jerc - do you anticipate adding multiple terrains per scene some time soon? That would solve my biggest problem right now.

    Thanks!
  3. Arcanor

    Arcanor

    Member

    Joined:
    Nov 4, 2009
    Messages:
    108
    Sooo... how are people doing this? Is it possible to use Substances for large terrain worlds or is this just a crazy dream I had?

    Or maybe there's an update coming soon that will make it possible?
  4. SevenBits

    SevenBits

    New Member

    Joined:
    Dec 26, 2011
    Messages:
    1,956
    In Unity 4, can't you just assign the substance to a material and do it that way, like you would a bitmap? Or am I mistaken?
  5. Arcanor

    Arcanor

    Member

    Joined:
    Nov 4, 2009
    Messages:
    108
    I don't think it's possible to use materials with Unity Terrains. Only textures. That's the purpose of the Substance Terrain Tool. It makes it possible to paint Substances on your terrain instead of plain textures.
  6. makeshiftwings

    makeshiftwings

    Member

    Joined:
    May 28, 2011
    Messages:
    1,505
    I don't think there's an easy way to do it currently, but while you're waiting, you could manually export the textures from each substance (particularly the diffuse and bump textures) and assign those to the multiple terrains. It's not quite as nice as being able to add the actual substance but it will at least look pretty similar to what you'll get if the substance terrain tool is updated later.
  7. Marco Sperling

    Marco Sperling

    Member

    Joined:
    Mar 5, 2012
    Messages:
    187
    I am not totally familiar with Unity 4 terrain shading, yet. But from what I've read and tried out so far you get the possibility to throw your own material onto a terrain object. So in theory you can assign individual materials to all of your terrain objects.
    This is great in a way that it enables you to selectively change properties of said materials.
    So what exactly is hindering you, Arcanor, from picking a terrain, selecting its material and setting its shader properties all from code?
    You can easily grab the output from a procedural material and assign that texture to a shader property (tex2d sampler). At least that's what I did prior to Unity 4 in our project using the Shader.SetGlobal...() functions.
    Unity4 should make it as easy as this I guess:

    Code (csharp):
    1. public class TerrainSetup : MonoBehaviour
    2. {
    3.     public ProceduralMaterial Substance0;
    4.  
    5.     private Texture _diffuse0;
    6.     private Texture _normal0;
    7.  
    8.     void Start()
    9.     {
    10.         _diffuse0 = Substance0.GetTexture("_MainTex");
    11.         _normal0 = Substance0.GetTexture("_BumpMap");
    12.  
    13.         renderer.sharedMaterials[0].SetTexture("_MainTex", _diffuse0);
    14.         renderer.sharedMaterials[0].SetTexture("_BumpMap", _normal0);
    15.     }
    16. }
    You'd have to be careful with the naming of the outputs from your substance and with that of the shader properties of course.
    Other than that you should be able to pick any terrain shader out there that supports firstPass and addPass for rendering up to 8 textures.
  8. DesertRaven

    DesertRaven

    Member

    Joined:
    Jul 15, 2012
    Messages:
    75
    @Jerc, are you planing on answering Arcanor 's questions from last week PLEASE!
  9. Jerc

    Jerc

    New Member

    Joined:
    Sep 24, 2010
    Messages:
    299
    Hi all, sorry for the delay, it seems that the unity forum search feature is not working as it should and I didn't see your last posts.

    I need to take a look at the new terrain in Unity4 and see what needs to be rewrote in my script to support the new system.
    About having multiple terrains, I need to check again, but I remember that it was kinda complicated.
    I'm sorry I've been swamped by work these last few months but I hope I'll have some time in January to get back to work on the terrain tool, make it easier to use, update it for 4.0 and hopefully add support for multiple terrains.
  10. nsxdavid

    nsxdavid

    Member

    Joined:
    Apr 6, 2009
    Messages:
    211
    @jerc It's been three weeks. Ping! :)
  11. DesertRaven

    DesertRaven

    Member

    Joined:
    Jul 15, 2012
    Messages:
    75
    Awesome, would you be able to make a written step by step tutorial for the then updated tool? I don't want to be greedy, but maybe with a sample scene with free sample substance materials? Thanks R
  12. Jerc

    Jerc

    New Member

    Joined:
    Sep 24, 2010
    Messages:
    299
    I swear I will try to find some time to update the script next week ! :)
  13. BadgerDK

    BadgerDK

    New Member

    Joined:
    Nov 2, 2012
    Messages:
    10
    I'd love to know about multiple terrains as well ;)
  14. Arcanor

    Arcanor

    Member

    Joined:
    Nov 4, 2009
    Messages:
    108
    I bet Allegorithmic would sell quite a few more Substance packages in the Unity Asset Store if this terrain tool were working with 8 substance materials per terrain, with multiple terrains per scene, and fully supported Unity 4... just sayin'. ;)
  15. pkid

    pkid

    Member

    Joined:
    Jul 10, 2009
    Messages:
    195
    +1
  16. stephnx

    stephnx

    New Member

    Joined:
    Mar 18, 2009
    Messages:
    7
  17. nsxdavid

    nsxdavid

    Member

    Joined:
    Apr 6, 2009
    Messages:
    211
    I'm not sure what @Jerc and Allegorithmic's priorities are anymore. Substance is completely broken in 3ds Max 2013, it's only half functional on Unity 4.

    Perhaps Substance is just going to be abandoned technology. The lack of attention to the actual use of it (vs. the tool chain) just gives one no confidence in using it.

    David
  18. Arcanor

    Arcanor

    Member

    Joined:
    Nov 4, 2009
    Messages:
    108
    That would be extremely disappointing for such an awesome tech as Substances.
  19. Jerc

    Jerc

    New Member

    Joined:
    Sep 24, 2010
    Messages:
    299
    Rest assured that our priority is to make sure that substance works as good as possible on all engines and platforms. I don't want to blame anybody in particular here but just want to clarify the situation.

    On the 3ds Max side, we are pretty much tied to what Autodesk allows us to push for every new release and by 3dsMax architecture. We are currently working on a plugin on our side to bypass these limitations and be able to deliver updates as often as we can without having to wait for the next 3dsMax version to come out.

    On the Unity side, a few things are broken that will be fixed in the upcoming 4.1 (in a few days, along with the mobile support) and we are hard at work to make sure we fix the remaining bugs.

    The Substance tools development and the integrations development are handled by different people, and both teams are working hard to make sure we go in the right direction.

    Then for the Terrain tool, it's a plugin I wrote a few months back to address the fact that the Unity terrain system can't support substances (there is nothing we can do about it for now on our side unfortunately) and I know it really needs an update for 4.0. I'm sorry I couldn't find time to update it yet and truly want to do it, I just had no time 'at all' these last few months for this.
    Last edited: Mar 7, 2013
  20. Arcanor

    Arcanor

    Member

    Joined:
    Nov 4, 2009
    Messages:
    108
    Thanks for the update Jerc. Your words are at least a bit reassuring that you've not abandoned the technology. But more specifically, do you have any timeline for updates to this Terrain tool? When will it become your top priority, if ever? Will it ever support 8 (or 12) substances and multiple terrains, or should we expect to wait until Unity itself changes and this tool becomes irrelevant?

    Right now I'm experimenting with the Relief Terrain Pack (http://forum.unity3d.com/threads/161235-RTP-Relief-Terrain-Pack-with-geometry-blend-on-AssetStore) and using Bitmap2Material 2.0 (which I purchased as well) in the Substance Player application to create simple textures procedurally from the many Substances which I've already purchased, and then importing each of the generated sub-textures individually into the RTP on my terrain. This is a bit of a pain because it requires that I use my creative tools outside of Unity and then bring them in, rather than being able to adjust the substances in real time while looking at my scene.

    Will there be a better workflow for me coming soon?
  21. Jerc

    Jerc

    New Member

    Joined:
    Sep 24, 2010
    Messages:
    299
    You can expect some news on the terrain tool next week. I will have a few days allocated to that task.
  22. Arcanor

    Arcanor

    Member

    Joined:
    Nov 4, 2009
    Messages:
    108
    Thanks Jerc. I hope the week goes well. :)
  23. SevenBits

    SevenBits

    New Member

    Joined:
    Dec 26, 2011
    Messages:
    1,956
    Cool. I hope these bugs are fixed. Being able to use substances instead of bitmaps on terrain would be huge, especially since you can use substances on pretty much everything else without discrimination.

    By the way, will it be possible to use terrain substances with custom terrain shaders, or just the ones that ship with Unity...?
  24. Jerc

    Jerc

    New Member

    Joined:
    Sep 24, 2010
    Messages:
    299
    Yes, using a custom terrain shader is actually an easier way of making substances work with the terrain system since it's actually the shaders shipped with Unity which are the cause of the problem.
  25. SevenBits

    SevenBits

    New Member

    Joined:
    Dec 26, 2011
    Messages:
    1,956
    Okay, great news. What would one need to be added to a shader to provide this compatibility? Do substances work with a standard input as a shader property or is something special required?
  26. Jerc

    Jerc

    New Member

    Joined:
    Sep 24, 2010
    Messages:
    299
    Any custom shader should work with no additional step required (you need to use a custom material though, not the proceduralmaterial created automatically when importing the substance).
  27. SevenBits

    SevenBits

    New Member

    Joined:
    Dec 26, 2011
    Messages:
    1,956
    Ah, okay, thank you.
  28. Jerc

    Jerc

    New Member

    Joined:
    Sep 24, 2010
    Messages:
    299
    Alright so I started revamping the script, here is a beta version. It works with Unity 4.1, and you don't need the PRO version anymore for it to work.

    Tweaking the substances is still pretty slow as I have to physically write the texture on the hard drive for every tweak, as Unity's terrain script won't take anything else than a real texture file as Diffuse. I don't think there is any way to bypass that...

    Also for now, sometimes you have to click twice on the update buttons to update properly the textures, I will continue working on it next week, if you find any other issue please report them to me in this thread.

    Attached Files:

  29. SevenBits

    SevenBits

    New Member

    Joined:
    Dec 26, 2011
    Messages:
    1,956
    Is this still Unity 3.5 compatible, or has that been dropped?
  30. Jerc

    Jerc

    New Member

    Joined:
    Sep 24, 2010
    Messages:
    299
    It's using some new features from 4.1 to bypass the render-texture and allow non-pro users to use it so it's only compatible with 4.1 for now. I'll add both options later on when it's stable and finalized.
  31. Arcanor

    Arcanor

    Member

    Joined:
    Nov 4, 2009
    Messages:
    108
    I was able to get the new script to work, but only after clicking the Update buttons SEVERAL times each (like 5 or more times).

    Now I'm seeing the substances on the terrain, but Desert Sand sample substance is showing up as overly bright, nearly white.

    ** nevermind about the brightness, I turned down the intensity of the light and it looks fine now.
    Last edited: Mar 16, 2013
  32. Arcanor

    Arcanor

    Member

    Joined:
    Nov 4, 2009
    Messages:
    108
    I'm also noticing that the new script requires the Substance to be Format RAW, instead of the default Compressed. Is this just for the Beta testing purposes? Will this cause larger file sizes, and if so, will that be a potential performance issue when using many substances in a scene?
  33. Jerc

    Jerc

    New Member

    Joined:
    Sep 24, 2010
    Messages:
    299
    The raw format is needed for reading the substance output and baking the diffuse a a PNG when modifying the terrain textures. But you can set it back to compressed before baking your final package.

    I'll try to find what is going on with the refresh being registered wrong.
  34. angelcaf

    angelcaf

    New Member

    Joined:
    Apr 18, 2013
    Messages:
    7
    Hello,
    I am using the latest version of the substance terrain tool from the Assets Store.
    My target platform for my unity project is the WebPlayer and I get the following error when I import the tool from the assets store:

    Assets/SubTerrain/SubTerrain.cs(136,24): error CS0117: `System.IO.File' does not contain a definition for `WriteAllBytes'

    I suspect the reason is the target platform because switching to "standalone" fixes the problem.
    Any insight on how to fix this for the WebPlayer?
    thanks in advance!
    Last edited: Apr 18, 2013
  35. megisto

    megisto

    New Member

    Joined:
    Dec 25, 2009
    Messages:
    80
    Hi. Yesterday the script had work just fine. Even on my 3.5 pro version. But today after updated the substance material the texture were just gray.

    I tried to reinstall from scratch, but it don't works. I can see the texture but it is gray, without bump and specular.
  36. OhKerod

    OhKerod

    New Member

    Joined:
    Apr 27, 2013
    Messages:
    3
    Hello,

    I try to figure out a normal map rendering problem with substance...I only have texture applied on my terrain .The bump seemed to not work.
    I followed the instructions found on the pdf and i tried to create my terrain in a new unity project but the same problem remains...
    May i have forgotten something ?

    Thanks for your help...
  37. Dogcomplex

    Dogcomplex

    New Member

    Joined:
    Jul 10, 2012
    Messages:
    12
    I take it this is dead? No updates april and both the asset store as well as the link for Unity 4 is still broken, asset store's splats are white and the unity 4.x ones are black.

    :(


    *Edit

    Scratch that, the tool works but the substances don't work with it so something with the substances have changed? I tried it with the two that are included with the tool and it worked as it should. Not sure what that means but I guess i'll have to look into the substances further.
    Last edited: Sep 2, 2013
  38. Arcanor

    Arcanor

    Member

    Joined:
    Nov 4, 2009
    Messages:
    108
    Try setting your substances to RAW format (instead of the default Compressed) as we discussed back in March, above. I think Jerc made some changes to the script to require that for some reason, although I've not peeked inside the script myself.
  39. houndie

    houndie

    New Member

    Joined:
    Nov 25, 2010
    Messages:
    146
    I think I did try that without success however I will double check tonight.
  40. houndie

    houndie

    New Member

    Joined:
    Nov 25, 2010
    Messages:
    146
    So yea I re-looked and I retested changing the option from compressed to both 16bit as well as truecolor and neither worked. I did not see an option for RAW format, not sure if that got taken out of Unity 4.x or not.
  41. r-dotfunky

    r-dotfunky

    New Member

    Joined:
    Sep 11, 2012
    Messages:
    9
    Has anyone been able to get this to work in Unity 4.x?

    I've gone through all the pages in this post and for the life of me it's just not working. Total bummer if that's the case - I would really like substances on my terrains!
  42. bigzer

    bigzer

    Member

    Joined:
    May 31, 2011
    Messages:
    159
    I've tried many different solutions out there to get substances on a terrain and untill now I found out they are all crap.
    Also note that this solution not only has issues but also almost don't make sense; you lose the small size advantage of substances because they are baked and stored in a texture... So if you plan to use this on webplayer don’t bother all the giant pain in the *** and use the substance player to export to texture manually, the dinosaure and not convenient way...

    This is such a disappointment; substances on terrain would be really great in many ways. I can't believe we have to jump through so many hoops to get only a half solution for this utter most basic need...

    Sad panda :(
  43. adamz

    adamz

    Member

    Joined:
    Jul 18, 2007
    Messages:
    438
    Anyone get this to work on Unity 4.3.3f1?