Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Substance Terrain Tool

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

  1. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    Select the substance material (round red icon), in the top right of the inspector, you should see a little gear icon, click on it and you will see the Export option.
     
  2. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
  3. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    Unfortunately it doesn't. Smart Tiles use a specific shader and the Terrain uses another, once we get a fully featured and open terrain system from Unity, it will be possible :)
     
  4. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Thanks for the reply - even though it's bad news. Hopefully, when UT comes up with a new terrain system, it'll also be Voxel based ;-)
     
  5. hay78

    hay78

    Joined:
    Sep 25, 2011
    Posts:
    41
    Hi there

    I've just purchased couple of substance maps and play around with this substance terrain.
    But i'm having problem that it paints "wrong" splat maps

    I'm painting pebbles 001 subtance splat map, but it shows dessert splat map (i actually didn't use dessert substance)

    Anyone could help what the problem is.
    I'm using unity pro btw

    And is it possible to use more than 4 splat maps on single mesh?
     
  6. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    What do you see in the SubTerrain/Resources/ folder ? the splat maps are stored there. If you apply a substance on the SubTerrain script and hit Update it should refresh your splat map.

    You can't use more than 4 substances for now but you can use standard bitmaps to fill the remaining layers.
     
  7. hay78

    hay78

    Joined:
    Sep 25, 2011
    Posts:
    41
    It is now painting the right splat maps, but i still have problem with the normal map.
    In one of the splat maps , it shows the right diffuse map (eg : sand), but the normal map is taken from the other map (eg. rock)


    I actually edited the script , and copy paste function of one of the substance, and it works. I could have 5 maps now instead of 4. Does this cause that problem?
    I would like to try create up to 16 maps, if it's working in unity , will it work once they're build to platforms (IOS, Android, PC, Mac)?
     
  8. Alarna

    Alarna

    Joined:
    Mar 23, 2011
    Posts:
    18
    I have a problem when I update the textures. There is a message:
    Trying to read pixel out of bounds
    UnityEngine.Texture2D:ReadPixels(Rect, Int32, Int32)
    SubTerrain:RenderDiffuse(ProceduralMaterial, Int32) (at Assets/SubTerrain/SubTerrain.cs:95)
    SubTerrainEditor:OnInspectorGUI() (at Assets/SubTerrain/Editor/SubTerrainEditor.cs:29)
    UnityEditor.DockArea:OnGUI()

    I deleted the terrain, made a new scene, exit Unity, but it didn't help. What problem is this?
     
  9. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    950
    Lol, substances costs €1000. Downloaded in the hope we could use it with our own textures, but time was wasted...
     
  10. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    763
    Yeah I really hope they rethink their whole marketting strategy of selling fixed, closed-source procedural textures with no real ability to add a personal touch, while trying to flog a Designer/Editor for $1000 that is the only tool apart from B2M (which costs extra even if you own Designer) that allows you to use your own textures..
     
  11. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    Guys, get your facts right. Designer is priced at $594 if you are a Unity Pro user and Designer Lite is at $350 for everyone :)

    Now about the "closed-source procedural textures", we heard your feedback and are actually preparing a reupload of all our textures which will now include the source files, allowing you to open and modify every texture you bought. This should be live on the asset store in the coming weeks / before the end of the year.
    About B2M, it's really easy to create your own B2M with Designer after a few weeks studying the tool, so with a bit of work you won't have to buy it at all ;)
     
  12. artzfx

    artzfx

    Joined:
    Apr 28, 2008
    Posts:
    572
    Having got my B2M at 50% discount when I purchased Designer, it was not worth trying to create my own B2M. B2M works out of the box. This is awesome tech and I do not begrudge a cent I have spent in purchasing both apps, especially since the http://www.creativetd.com/?page_id=625 videos have become available. Lack of thorough Designer training was my only disappointment up until then.

    Very happy to hear the .sbs file will be included with substance purchases in the future, great news! Besides using them out of the box, having the benefit of opening them up in Designer to learn from and customize will make me want to buy them. :)
     
  13. winterkewl

    winterkewl

    Joined:
    Oct 28, 2011
    Posts:
    53
    How does one control the overall specularity of the terrain after you've added this SubTerrain Script?? Seems like no matter what I try the terrain always looks like shiny plastic?
     
  14. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    You must adjust the specular in the substance if it allows you to. Do you think we should add a multiplier for each layer ?
     
  15. winterkewl

    winterkewl

    Joined:
    Oct 28, 2011
    Posts:
    53
    Yes I think an overall control of Spec and Normal Strength would be most welcome. :)

    FWIW thanks for the tip AND the awesome software though, adjusting the spec in each of the surfaces did ultimately solve my "Too Shiny" problem. :)
     
    Last edited: Nov 21, 2011
  16. smiljan66

    smiljan66

    Joined:
    Jun 9, 2010
    Posts:
    610
    It will be good to have 6 slot for combine 6 materials for terrain even if wil drop down frames , but there is a way to add 2 ,ore slots for material?
     
  17. Yusuf-AKDAG

    Yusuf-AKDAG

    Joined:
    May 13, 2009
    Posts:
    280
    I dont think its possible since you can use max 4 splatmaps on a terrain.
     
  18. pkid

    pkid

    Joined:
    Jul 10, 2009
    Posts:
    201
    I was looking at buying the smart tiles but then I read this thread and it looks like the smart tiles are not compatible with Unity terrain. It was also kind of a bummer to read that you can't use regular bitmaps alongside substances on the terrain even with the terrain tool. I think substances are a great idea in general but all of the restrictions on using them with terrain really reduce their usefulness.
     
  19. azterixny

    azterixny

    Joined:
    Sep 3, 2009
    Posts:
    13
    We are trying to use this for a project with multiple scenes which each have their own look and as such we want to use different splats for each scene. Right now, when we create a new scene and try to use the SubTerrain tools, it updates the core splats in Resources, affecting the terrains of other scenes.

    Is having the same 4 splats across all scenes a limitation of the tool, or is there something wrong with the way we're using it?
     
  20. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    I guess I simply didn't think about multiple scenes when writing the script..

    It can be easily modified if you got a coder available as the script is pretty basic and I would be able to answer his/her question, but we are pretty busy right now so I can't give you an ETA on when I will be able to fix this myself.
     
  21. azterixny

    azterixny

    Joined:
    Sep 3, 2009
    Posts:
    13
    Thanks for the quick feedback. I hadn't dug into the code earlier, wanted to make sure we weren't missing something. You were right... super easy to modify to suit our needs. Let me know if you'd like me to send you the updates.
     
  22. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    Sure, if you're willing to share your modifications, I'll be happy to update the package on the asset store so everyone can take advantage of it.
     
  23. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,204
    Edit:

    This appears to fix it. Change the RenderDiffuse method of SubTerrain.cs to use the terrain name as part of the filename, and use the appropriately generated (now-unique) splat textures.

    Code (csharp):
    1.  
    2.         // Write Diffuse map as PNG    
    3.         byte[] bytes = dif.EncodeToPNG();
    4.         string filename = Application.dataPath + "/SubTerrain/Resources/" + gameObject.name+"_splat" + slot.ToString() + ".png";
    5.         System.IO.File.WriteAllBytes(filename, bytes);
    6.         AssetDatabase.ImportAsset( "Assets/SubTerrain/Resources/" + gameObject.name+"_splat" + slot.ToString() + ".png" );
    7.  
     
    Last edited: Dec 18, 2011
  24. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,204
    I've made some modifications to the scripts and shader to support UV mixing like specified in this post:

    http://forum.unity3d.com/threads/116509-Improved-Terrain-Texture-Tiling

    Is anyone else interested in this? If so, I can post the changes here. I saw Lars had released his own shaders, if you're not using substances.
    My changes are a little different - you can specify how much mixing you want per texture (0.0 to 1.0), and the overall scale:

    Code (csharp):
    1.  
    2.     inv = 1.0 - _Mix.g;
    3.         col += ((splat_control.g * splat1.rgb)*inv) + (splat_control.g *(tex2D (_Splat1, IN.uv_Splat1 * -_MixScale).rgb)*_Mix.g);
    4.     o.Normal += splat_control.g * UnpackNormal(tex2D(_BumpMap1, IN.uv_Splat1));
    5.     o.Gloss += splat1.a * splat_control.g;
    6.     o.Specular += 0.5 * splat_control.g;
    7.  
     
  25. jzhang1

    jzhang1

    Joined:
    Jan 11, 2011
    Posts:
    7
    Hi I'm having some problems with the substances tool for terrains.

    Screenshot 1

    1. I'm explicitly not using a specular shader, so I don't understand why there are specular reflection.
    2. How do I get the terrain shadows to play nicely with the terrain substance? Notice the shadows cast by the mountain is not blending well with the underlying terrain material. (I'm using directional light, hard shadows in case that matters)
    This is actually a really weird behavior because the realtime shadows blend correctly in edit more but does not blend correctly in camera view or play mode.

    Screenshot 2
     
  26. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    There have been a few changes in how substances are handled in Unity 3.5 and the script may not work properly on the Beta. I'll update it as soon as 3.5 is out.

    EDIT : Actually, I know why you have that white specular. The shader is looking for the alpha channel of the splat to get the specular. If you use a shader with no specular, the non existent alpha channel is full white. I'll try to fix it.
     
    Last edited: Jan 30, 2012
  27. Shad

    Shad

    Joined:
    Sep 21, 2011
    Posts:
    61
    I am interested... are the changes what you posted? Or is there more to them?
     
  28. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,204
    There's a lot more to them, have to update the .cs as well. I sent a private message to Jerc requesting permission to post the full changes, but have not received a response yet. I'll post them here as soon as I hear back.

    edit: Just got a PM from jerc that he is updating the package.
     
    Last edited: Jan 30, 2012
  29. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    I am indeed, it's almost done :)

    I have a question for you though, do you guys prefer to mix only the diffuse maps or do you want the normal maps to be mixed too when using the mixing feature ?
    And also, do you want to set the mixing values for each layer or for the whole terrain at once.
    Doing this will make the shader a bit more expensive, but it will look better and give you more control.
     
    Last edited: Jan 30, 2012
  30. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    Here we go, new version on the asset store !

    - Added support for multiple scenes (thanks to azterix)
    - Added texture mixing allowing for better tiling terrain layers (thanks to Jaimi)
    (diffuse mixing is available on all layers, normal map mixing is only available on the first layer)
    - Added specular intensity control
     
  31. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,204
    The mixing values need to be set by layer, because you will have things you shouldn't mix (like bricks). I have an experiment ongoing modifying the mix value based on linearz (more detail up close, less detail far away). I'll post here if I have success.

    edit: that's what happens when you leave your browser open and go to a meeting. When you come back, your reply is out of date.
     
    Last edited: Jan 30, 2012
  32. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    I heard people talking about a limit of 4 materials per scene. This is not so, the real limit is 8 per scene. Of course Allegorithmic will have to change their package to support it. (Before TerrainEdge 3 does it for them).

    You can add support for another 4 bump mapped materials using the add-pass shader. Its not that hard to adjust the current shader to work on the additional pass. The only trouble I had was getting the lighting right, you have to normalize the normal to get correct lighting when you are crossing between passes. (When first pass is 50% and second pass 50%, so you don't get normals of half length.)

    However eight is as far as it goes. If you try to go higher you'll have to share bump maps, so the range 5-8 will use the same bump maps as the range 9-12 (5th=9th, 6th=10th, 7th=11th, 8th=12th). You can still change the diffuse but not the bump maps.



    This is how my add pass shader looks like: Add pass shader. Ofcourse you have to feed the right BumpMap4, BumpMap5, BumpMap6, BumpMap7 into the shader to make it work. But that is done in the same fashion as the first four so no surprises there.

    This shader is based on the early version, so you might wanna upgrade it. I tried grabbing the new of the asset store but I still got the old one.
     
    Last edited: Feb 1, 2012
  33. Rick2012

    Rick2012

    Joined:
    Feb 8, 2012
    Posts:
    3
    Does this plugin officially work with Unity Webplayer as I am having an awful lot of issues when building for web and not getting any bump. I have tried switching between standalone to web player just before I build, I see the IO editor error and sometimes the editor crashes while the player is compressing but the bump is always missing when I test. I'm not having issues with standalone builds until I try building a Webplayer version then from that point there is no bump in the editor either.

    I'm using Bitmap2Material to create the Substance materials that I'm using - would this cause any issues?
     
  34. haozenan

    haozenan

    Joined:
    May 22, 2012
    Posts:
    1
    Hi, I'm tring to use Point Light in Substance Terrain. But I find that the selfshadow is not right, in fact, it's helical or spiral. I think the normal map is uncorrected. The shader which I am using is [TerrainReplacement.shader].
     
  35. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    I'm getting very weird behavior that i can 100% reproduce on my computer.
    Create new project with nothing in it.
    Add a terrain, it looks fine.
    Import substance terrain tool and it immediately looks like that :

    Any tips? i'd really like to put my unity pro/substance designer licences to good use and this tools seemed like just the right way to do it.
     
  36. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    Looks like you have 2 terrains overlapping ? Your initial terrain should not be affected until you add the Terrain tool component on your terrain itself.
     
  37. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    There's nothing but 1 terrain in my project.
    This happens as soon as i include the asset (click import from asset store, terrain goes funky, delete the folder, terrain's back to rendering fine).
    I can 100% reproduce this on my computer when creating a new project and would be glad to demo it by skype if it can help you debug this.
     
  38. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    Here's a link to a video where i reproduce the issue
    https://www.dropbox.com/s/cn6o4f0lurkh1q2/ScreenCapture_30-06-2012 14.30.28.wmv
    As you can see i :
    - Start from a new project with no assets imported to avoid any incompatibilities
    - Add a new terrain, which works fine
    - Import your script and then the terrain looks funky (only when i get within range, i assume the shader does some kind of LOD?)

    I can also confirm that:
    - The issue fixes itself when i remove the full subterrain folder
    - Something definately gets applied because even just removing the replacement shader gets my terrain back to normal, so it definately gets applied even without adding the script to the terrain. Also when removing that shader the terrain firsts turns pink before getting back to normal.

    I'm using unity pro 3.5.2f2
    Here's my nvidia hw/sw info
    https://www.dropbox.com/s/9pha1dqx1wh3zlp/NVIDIA System Information 06-30-2012 14-50-50.txt
     
  39. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    i've found (part) of the problem, i assume it also explains why you're not getting the issue (i'm assuming some drivers are more lenient than others)
    Changing

    half3 col;
    To
    half3 col = half3(0,0,0);
    Gave me the correct textures without most of the garbage (the garbage was likely random unitialized memory).
    Now i'm still getting something messed up but it's definately progress:



    Edit : nevermind, that 2nd issue was caused by me when trying to fix the first :) so just initializing the half3 fixes it, would be good if you could re upload this, i've never worked with any kind of shader before and it wasn't quite obvious to fix for me so that may help other people with the same driver/hw.
     
    Last edited: Jun 30, 2012
  40. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    Ok, thanks for pointing that out, I'll modify and re-upload the package asap.
     
  41. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    I've found something else but i'm unsure if it's something to be fixed on your on unity's side.
    After a certain distance the default shader seems to be applied again, i assume unity uses a separate terrain shader for further items?
    An easy way to see it is to put a substance with your script on the terrain, and scroll back, at some point you'll see your terrain half way painted with the texture and half way with the substance, you'll also notice that this is affected by the distance in the terrain tools.
    It actually doesn't matter much at runtime, but in the editor i often want to scroll far enough away that this is an issue (for height mapping)
     
  42. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    When you go far enough from a terrain, Unity switches to a low resolution unique texture baked from the initial painting. I'm affraid I can't do anything to prevent that.
     
  43. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    I see, i guess it can't be fixed by either of us then.
    Any chance of seeing the 8 substance version mentioned earlier in the thread as part of your script? 4 is a bit limiting (having the whole substance collection i definately have more than 4, or if possible more than 10, i'd like to use on a large terrain!).
     
  44. santelia

    santelia

    Joined:
    Mar 24, 2012
    Posts:
    3
    Just to make a backup of the standard terrain shader before installing Substance Terrain Tool, where can I find the standard terrain shader file?
     
  45. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    The original shader is hard coded, so don't worry. The shader in the Terrain tool only overrides the original while it is actually applied to a terrain in your scene.
     
  46. DesertRaven

    DesertRaven

    Joined:
    Jul 15, 2012
    Posts:
    137
    How does the Substance terrain tool work with the new features in Unity 4? Where they have a slot for a normal map?? Any plans or visions on that yet?

    Raven
     
  47. Zergling103

    Zergling103

    Joined:
    Aug 16, 2011
    Posts:
    392
    Just a notice to everyone thinking about downloading this - MAKE A BACK UP - or don't use it until the bugs are ironed out. It can permanently wreck your ability to create terrains.

    We've had problems with it: On some computers terrains with this plugin do not render correctly - they appear extremely bright, flickery and covered with random squares on some video cards.

    When we suspected that the substance terrain tool was the culprit we tried to remove it, but without success, in that the terrain file itself was corrupted with left-over artifacts like normal maps that wouldn't erase. Not only that, but when we attempted to recreate the terrain, a new terrain by itself without any modifications after it was created had similar artifacts, presumably also from substance terrain tool plugin. We couldn't remove the artifacts despite everything we tried--repainting, removing lightmaps, brushing new geometry onto the terrain, selecting different textures... nothing. It meant that our ability to make terrains was itself corrupted by this plugin and as far as we know the only way to resolve this problem was to revert to a previous back up and re-do everything between then and now.
     
    Last edited: Oct 21, 2012
  48. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    Your issue must come from somewhere else, the script only provide a new shader to override the one that's builtin by default, as soon as you remove this shader file from your project, it will revert to your original terrain shader and there is no way it could still display normal map. Make sure the shader file has been removed properly along with the script.
     
  49. BuildABurgerBurg

    BuildABurgerBurg

    Joined:
    Nov 5, 2012
    Posts:
    566
    Questions:

    1: it says in the user Manual "Important: Tweaking is currently not possible at run time."
    So that means if I wanted a snow buildup at runtime I wouldn't be able to?

    if that is the case then what would be the point of using substances?
    I'm just trying to get my head around the best work flow options.

    2: Are you planing to make it tweakable at runtime? if yes then when do you think it will have this feature?
     
  50. BuildABurgerBurg

    BuildABurgerBurg

    Joined:
    Nov 5, 2012
    Posts:
    566
    This is not compatible with unity 4 right?

    It's not working for me using unity4