Search Unity

Terrain Hole System

Discussion in 'Assets and Asset Store' started by Venryx, May 13, 2013.

  1. Venryx

    Venryx

    Joined:
    Sep 25, 2012
    Posts:
    444
    Yes, that'd be perfect. You can email it to venryx [at] gmail [dot] com.
     
  2. Orami

    Orami

    Joined:
    Mar 12, 2015
    Posts:
    20
    I seem to get strange outputs with your demo scene as well as in my scene. I am getting the black hole issue. I have my own script to disable collisions with the terrain and that always works. So far though it seems like I am stuck at the same point as when I was using the shaders mentioned in the wiki. My point light that follows the player seems to flicker a lot while walking on the terrain and I think this has something to do with the shader as well(works fine with no shader material added to the terrain). I had used the work around that another poster mentioned by making a new material and adding your shader to it, but I am still getting black holes. What could I be doing wrong? If you want to see what I am doing feel free to stop by www.twitch.tv/TOS_Orami

    EDIT: Fixed black holes apparently forgot to add script back after a crash. Now I see skybox even with forward rendoring and that is my only issue currently along with the light issue.

    EDIT: I turned direct X11 3D off and it is rendoring properly now.... I don't know what kind of impact this will have on my final game though.
     
    Last edited: Mar 17, 2015
  3. mars-red

    mars-red

    Joined:
    Mar 14, 2015
    Posts:
    2
    Huge thanks to Venryx, for helping me get this working! The shader errors were only part of my problem, Venryx kindly sent me new versions to try out, and they fixed the errors. The rest of my problem was not fully understanding the usage of THS. I had not set the base map for the Terrain correctly (I missed that, when referring to the demo project), and my transparent texture for "painting" the holes was different than the demo project. Mine showed as completely transparent in the editor, while the one used in the demo showed as black. Looking at both of the texture images closer, the one that didn't work (mine) was RGB, containing nothing but an empty layer... and the one that worked was indexed color, containing a layer populated with the background color. Everything is now functioning quite well in my own project with deferred rendering and DirectX11. I am using Unity 5.0.0f4, personal edition, 64 bit.
     
  4. Frankenthor

    Frankenthor

    Joined:
    Oct 26, 2014
    Posts:
    5
    Hi,

    I have a problem with Unity 5. If I activate the shadows of the terrain, then the hole is still transparent, but I cant see my meshes behind the hole. Without shadows all is working fine.

    the same result in the Demo.

    My settings are:

    Unity 5.0.0f4 Pro
    Dirext11 activated
    forward rendering.

    I hope you can help me.

    Regards
    P@Negaia.com
     
  5. Venryx

    Venryx

    Joined:
    Sep 25, 2012
    Posts:
    444
    Email sent. (with an updated package that I think will fix the issue)
     
  6. Venryx

    Venryx

    Joined:
    Sep 25, 2012
    Posts:
    444
    Okay, the email failed to go through. Apparently the website's mail system can't accept files that large as attachments.

    I've sent a link to the package in a PM.
     
  7. Frankenthor

    Frankenthor

    Joined:
    Oct 26, 2014
    Posts:
    5
    Hi Venryx,

    I will check it out and give you a feedback. Thanks in advance for the good support.

    Peter@Negaia.com
     
  8. Frankenthor

    Frankenthor

    Joined:
    Oct 26, 2014
    Posts:
    5
    Ok I try it - it works!!!!
    Thanks a lot!!!!

    Peter
     
  9. Steelshot

    Steelshot

    Joined:
    Feb 24, 2015
    Posts:
    102
    Hey! I got a problem, when ever I "paint" the
    transparent thingy on the terrain I always get
    the color black... please help me :(

    Note:

    I'm not sure if the "NoShaderMode" should be on a terrain or what

    SOULUTION: Nevermind! Appearently I didn't "See" step # 3
    to which appearently was VERY important to fixing the blackness issue, thanks anyways!
     
    Last edited: Apr 29, 2015
  10. zyguliux

    zyguliux

    Joined:
    Jan 23, 2013
    Posts:
    4
    Hi but it doesn't work with the bump map shader and shadows still visible on the holes if shadows are enabled on the terain preferences... Still can't use it...
     
  11. zyguliux

    zyguliux

    Joined:
    Jan 23, 2013
    Posts:
    4
    That wasn't in the description before people decide to buy it!

    Sad...
     
  12. Venryx

    Venryx

    Joined:
    Sep 25, 2012
    Posts:
    444
    From the Asset Store description found here:
    * If shadows are enabled with Forward rendering, transparent areas still "receive shadows", making the objects behind them darker. You can avoid this by switching to Deferred rendering, or enabling "no shadows mode".

    So switching to Deferred rendering should fix it.

    Also, what do you mean it doesn't work with the bump map shader? Are you using the version included with the package?
     
  13. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    Hey Venryx.. I purchased THS a few months back and am just now starting to play around with it.. I followed the directions in the documentation and it worked like a charm.. Player object ran through the hole with no problems.. Since then, I have repainted the terrain with a normal texture and then repainted the hole to match the size of my cave meshes. At first I thought I was colliding with the meshes not lining up properly. So I turned them off to see if I was at least falling through the hole. The transparency is working, but it is like I am running into glass now.. Any thoughts?

    TerrainHoleIssue-TerrainObject.jpg TerrainHoleIssue-PlayerObject.jpg


    Oh.. This is Unity 5.1.1 in forward render / DX9 on Windows 64
     
  14. Venryx

    Venryx

    Joined:
    Sep 25, 2012
    Posts:
    444
    Hmmm... well the settings seem fine. Have you tried making a simple cube above the hole, and adding the fall-through script to it to see if it falls through? If not for that either, (and not for the default capsule character in the demo--you should probably try that too), then it's probably some detail of your setup that I hadn't thought of while coding the collision-toggling system.

    If the above simple tests fail, I can take a look if you want (either on the scene in question, or a stripped-down copy that still demonstrates the issue). Just email it to venryx [at] gmail [dot] com.

    Oh, one other thing you could try: disabling "auto update transparency map", and setting the texture to a pure white one (er, or was it pure black). Anyway, one of those two will make it consider the entire terrain to be a hole, letting you test whether the problem is with the hole-marking/detection-and-activation, or instead something higher level like the terrain not even being noticed.
     
  15. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    totally weird.. I painted a hole in the level ground behind where my character spawns and if I run to it, I fall through... if I run to the one on my cliff face, I hit "glass".... *scratches head* Well at least I know the mechanics are still working (shader, scripts, etc).. I'll keep playing with it.. Thanks for the quick response!

    EDIT: Repainted my original cave entrance with my cliff texture, placed my cave meshes in place, repainted my THS transparent texture and it magically worked this time.. No clue what my problem was before.

    One thing that I was doing as I was piecing together the cave pieces from Michael O's Underworld pack was disabling the terrain object so I could see and rotate around the cave pieces without constantly clipping through the terrain. Could enabling and disabling the terrain object have caused the issue? I would think when turned back on it should operate exactly how it did before being turned off. I wonder if maybe I should disable the automatic transparency map thing before disabling terrain and turning back on after enabling maybe? Or maybe that is totally coincidental.. *shrugs* All I know is it is working now... Thanks for an awesome asset! :)
     
    Last edited: Jul 8, 2015
  16. stan4u

    stan4u

    Joined:
    Dec 20, 2012
    Posts:
    19
    Hi,
    I've got issues with your plugin. When I paint transparency its all good, but as soon as I get in play mode it appears like cut out and overburn lights. I played a lot and realized that when you hit clear in lightmapping tab it does reset the terrain to state it should be. But then as soon as I select the terrain again in hierarchy it turns bad again. There is no lightmaps in the scene and there is tried also turn off shadows on light. Still does it.
    Tried unity 4.6.3 and 4.6.7 pro.
    What could cause this issue?

    https://dl.dropboxusercontent.com/u/22506069/thsIssue.mov

    Thnaks.
    Stan
     
  17. Venryx

    Venryx

    Joined:
    Sep 25, 2012
    Posts:
    444
    Started writing a response, but then realized you must be using an older version--cause the new versions have the "cut-out mode" option enabled all the time (i.e. you can't change it). This was done because non-cut-out mode had issues in some cases (e.g. not working with some project settings, having transparency issues, etc.), and I was tired of dealing with the help requests with it. (though supporting it for people who bought it before the change is of course fine)

    Anyway, can you send me the Terrain Hole System folder in your project. It's hard to debug a problem when your plugin's latest source code no longer even supports the feature! Thanks. (and sorry for the three-day delay, I've been doing not-Unity-stuff for a few days (I was writing my own book-writing helper software, yay!))
     
  18. stan4u

    stan4u

    Joined:
    Dec 20, 2012
    Posts:
    19
  19. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    I wonder if the new version was only uploaded from 5+. From my understanding from some other asset developers, they have to first export and upload a version built on 4.x before uploading one built on 5.x in order for folks running 4.x to get an update option unless they are dropping support of 4.x.. Not sure if that is the case or not.. But on Unity 5.x I was able to update to 1.2.2
     
  20. Venryx

    Venryx

    Joined:
    Sep 25, 2012
    Posts:
    444
    Yeah, the latest version is 1.2.2. Like Shawn said, it must not show for you since you're using Unity 4, and the latest version was uploaded from Unity 5.

    That actually works out though, since the latest version removes support for smooth-fading/non-cut-out-mode anyway. (It was just too much hassle to always deal with support requests because the fade version didn't work with a particular shader set or project's settings. (the cut-out mode is easier to implement in custom shaders, and it works with a wider variety of settings) I suppose eventually it would be good to add back as an unsupported, unmentioned-in-description option though.)
     
  21. stan4u

    stan4u

    Joined:
    Dec 20, 2012
    Posts:
    19
    are there so many things that are breaking semi transparency ? it's pretty good feature to fade out the terrain to get it island style.
     
  22. Venryx

    Venryx

    Joined:
    Sep 25, 2012
    Posts:
    444
    I don't know the percentages, but I know I was getting enough support requests for shader issues that it was distracting me from my own projects.

    That's largely just my personality. Little things tend to distract me a lot more than most people. A ten minute email can end up meaning a thirty minute effective loss, because it saps my motivation and makes things feel more like work/something-that-needs-upkeep. (For example, today I was planning on programming pretty much the whole day. I was bugged by something not working as I wanted on my tablet though, and have spent pretty much all (over 80%) of my time on it since then--for something most people would search about 20 minutes for, and then either pick the best option, or just give up on the matter. (Which is why I'm a bit mad at myself, at the moment.))

    Anyway, yeah, I didn't really feel it was worth the effort, even if for the majority of cases it worked fine.

    It does impact things a fair bit when someone requests/shows a need for a feature, though (or just provides an example use-case), so there's a fair chance I'll gather the motivation to add it back in at some point (as an "experimental" or "extra" feature, so I don't get as many support requests, though).
     
  23. Vintage_Green

    Vintage_Green

    Joined:
    Mar 27, 2015
    Posts:
    22
    this does not work with the recent Unity releases 5.1 and up just does not work. Even the demo scene doesn't work. Yes there are holes. But the terrain shader replacement screws up all of the terrain shadows makes them not appear at all. I hope there is an update coming.
     
  24. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    Works fine for me in Unity 5.1
     
  25. Orami

    Orami

    Joined:
    Mar 12, 2015
    Posts:
    20
    My background went entirely pink when I updated - still playing with that and the new UI to replace my GUI scripts....
     
  26. Vintage_Green

    Vintage_Green

    Joined:
    Mar 27, 2015
    Posts:
    22
    yeah it turned out I'm an idiot lol, I it works fine.
     
  27. Orami

    Orami

    Joined:
    Mar 12, 2015
    Posts:
    20
    I must have had an old version went through and updated all the assets and it fixed itself. Still works as good as ever.
     
  28. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    845
    How well does this work with Android ?? I seen a review saying they took a hard frame rate hit with mobile, so before think about buying it I need more info. Also I'm using Terrain composer for terrains, which uses Unity terrains so shouldnt be an issue, for does it cause any issues with RTP for PC ??? Just wondering if it works with other assets or causes conflicts that anyone is aware of since this has been around for a few years..

    I plan on using it for a mobile game for making a cave.. Thanks.
     
  29. Venryx

    Venryx

    Joined:
    Sep 25, 2012
    Posts:
    444
    I've never tested it on Android, so I don't know about that. I'm guessing the performance would be fine, though. The shader just adds a check with a transparency map texture to see which pixels should be visible or not. For shader-people, that might be seen as a considerable overhead (as they're thinking of performance internal to the shader/relative to what it would be otherwise), but I think in most Unity projects it won't be noticeable. If it did turn out too costly, you could also revert to an older version of the shader that doesn't use a transparency map texture, although that has more potential "gotcha's"/issues (e.g. the AddPass shader not knowing how much to increase its saturation/brightness to compensate for the fading into the black of the transparency texture, in the pixel-region before where it's actually below the alpha cutoff)

    As for RTP, it only works with it if you merge the shaders. I did this in the past for someone wanting to use it with RTP. RTP has been updated since then, though, so the merged shader wouldn't work for it now.

    I think RTP has its own hole system available, though. It's not as easy to use as this plugin, iirc, but that's probably worth looking into, since I'm pretty busy with my own projects atm and that would solve it without my needing to start another shader-editing task. (In most cases, it's pretty straight-forward, but the occasional headaches are enough I'd rather not go into that right now. If you want to have a go at shader-merging yourself, though (assuming the RTP-only approach doesn't work out), you could reference the ShaderMerging.txt file in my plugin's Documentation folder; it contains the basics of how to perform a merge.)

    So, in short:
    * I believe it would work fine on Android for the average project.
    * Try using the hole system of RTP first. If you see that won't work, we can go from there.
     
  30. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    845
    Well Android, has to be non RTP, since Android is not supported, but PC I actually forgot it had there own hole system, I Used awhile ago and was fine for PC.. But for Android, RTP is not supported..
     
  31. Venryx

    Venryx

    Joined:
    Sep 25, 2012
    Posts:
    444
    Okay. I guess it's up to you whether it's worth trying-and-seeing on Android, performance-wise.

    As for it working on Android in general: someone had an issue with it on Android before, but then I got it fixed, and he said it worked correctly after that. So at one point anyway, it worked fine on Android. (though he didn't say what the performance impact was)
     
  32. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    845
    Ya I seen the same I seen someone else say its poor on android, but thats kinda of an old review. I may give it a whirl and see, because I only need it for Android, since I can use RTP's for PC.
     
  33. philc_uk

    philc_uk

    Joined:
    Jun 17, 2015
    Posts:
    90
    Hi!
    So I have it working in the latest Unity 5.1 Except for - FOG.
    It appears the shader does work with the standard fog in the lighting settings.. any ideas??

    Thanks!
     
  34. Venryx

    Venryx

    Joined:
    Sep 25, 2012
    Posts:
    444
    By your wording, do you mean the standard fog in the lighting panel works, but another fog does not (e.g. image effect based fog)? Or the other way around?

    Either way it's odd, since both fogs worked in Unity 5 last time I checked. I can investigate/recheck that, though, for your project setup. What render settings are you using? (the default, or are you using deferred rendering, directx mode, etc?)
     
  35. philc_uk

    philc_uk

    Joined:
    Jun 17, 2015
    Posts:
    90
    Hi, neither seem to affect it, standard or global. It did work fine in Unity4. Im not doing anything particularly weird.
    I have the terrain transparency attached to my terrain, disable basemap, alpha cutoff 0.5, auto update transparency..
    Using a custom material on it, which has the TRI/THS/Basic shader on it, and I did update to the latest one from the asset store.. I have other terrains and they are affected by fog of course. Must be the shader not using it for some reason in its calcs.
     
  36. Venryx

    Venryx

    Joined:
    Sep 25, 2012
    Posts:
    444
    Looks like you're right. I get the same effect in the latest versions of Unity 5.

    I played around some, and got fog working--in Forward rendering mode at least:
    Code (CSharp):
    1. Shader "TRI/THS/Basic"
    2. {
    3.     Properties
    4.     {
    5.         [HideInInspector] _Control ("Control (RGBA)", 2D) = "red" {}
    6.         [HideInInspector] _Splat3 ("Layer 3 (A)", 2D) = "white" {}
    7.         [HideInInspector] _Splat2 ("Layer 2 (B)", 2D) = "white" {}
    8.         [HideInInspector] _Splat1 ("Layer 1 (G)", 2D) = "white" {}
    9.         [HideInInspector] _Splat0 ("Layer 0 (R)", 2D) = "white" {}
    10.         [HideInInspector] _Normal3 ("Normal 3 (A)", 2D) = "bump" {}
    11.         [HideInInspector] _Normal2 ("Normal 2 (B)", 2D) = "bump" {}
    12.         [HideInInspector] _Normal1 ("Normal 1 (G)", 2D) = "bump" {}
    13.         [HideInInspector] _Normal0 ("Normal 0 (R)", 2D) = "bump" {}
    14.         // used in fallback on old cards & base map
    15.         [HideInInspector] _MainTex ("BaseMap (RGB)", 2D) = "white" {}
    16.         [HideInInspector] _Color ("Main Color", Color) = (1,1,1,1)
    17.    
    18.         // plugin-specific
    19.         [HideInInspector] _AlphaCutoff("Alpha Cutoff", Range(-1, 1)) = .5
    20.         [HideInInspector] _AlphaCutoff_2("Alpha Cutoff_2", Range(-1, 1)) = .5
    21.         [HideInInspector] _TransparencyMap("Transparency Map (RGBA)", 2D) = "black" {}
    22.     }
    23.  
    24.     CGINCLUDE
    25.         #pragma surface surf Lambert vertex:SplatmapVert alphatest:_AlphaCutoff_2 finalcolor:myfinal exclude_path:prepass exclude_path:deferred
    26.         #pragma multi_compile_fog
    27.         #include "TerrainSplatmapCommon.cginc"
    28.  
    29.         float _AlphaCutoff;
    30.         sampler2D _TransparencyMap;
    31.    
    32.         void surf(Input IN, inout SurfaceOutput o)
    33.         {
    34.             half4 splat_control;
    35.             half weight;
    36.             fixed4 mixedDiffuse;
    37.             SplatmapMix(IN, splat_control, weight, mixedDiffuse, o.Normal);
    38.             o.Albedo = mixedDiffuse.rgb;
    39.             //o.Alpha = weight;
    40.        
    41.             /*fixed transApplication;
    42.             if(tex2D(_Splat0, IN.uv_Splat0).a == 0)
    43.                 transApplication = splat_control.r;
    44.             else if(tex2D(_Splat1, IN.uv_Splat1).a == 0)
    45.                 transApplication = splat_control.g;
    46.             else if(tex2D(_Splat2, IN.uv_Splat2).a == 0)
    47.                 transApplication = splat_control.b;
    48.             else if(tex2D(_Splat3, IN.uv_Splat3).a == 0)
    49.                 transApplication = splat_control.a;*/
    50.             fixed transApplication = tex2D(_TransparencyMap, IN.tc_Control).a;
    51.        
    52.             fixed totalOpacity = 1 - transApplication;
    53.             if (totalOpacity > _AlphaCutoff)
    54.             {
    55.                 o.Albedo = o.Albedo / totalOpacity;
    56.                 o.Alpha = 1;
    57.             }
    58.             else
    59.                 o.Alpha = 0;
    60.         }
    61.  
    62.         void myfinal(Input IN, SurfaceOutput o, inout fixed4 color)
    63.         {
    64.             SplatmapApplyWeight(color, o.Alpha);
    65.             SplatmapApplyFog(color, IN);
    66.         }
    67.     ENDCG
    68.  
    69.     Category
    70.     {
    71.         Tags
    72.         {
    73.             /*"SplatCount" = "4"
    74.             "Queue" = "Geometry-99"
    75.             "RenderType" = "Opaque"*/
    76.        
    77.             "SplatCount" = "4"        
    78.             "Queue" = "Geometry"
    79.             //"RenderType" = "Opaque"
    80.             "RenderType" = "TransparentCutout"
    81.         }
    82.         Blend SrcAlpha OneMinusSrcAlpha
    83.         //AlphaTest Greater [_CutoutModeHideAlpha]
    84.         Cull Off // comment out this line to only show the front faces of terrain surfaces
    85.    
    86.         // TODO: Seems like "#pragma target 3.0 _TERRAIN_NORMAL_MAP" can't fallback correctly on less capable devices?
    87.         // Use two sub-shaders to simulate different features for different targets and still fallback correctly.
    88.         SubShader // for sm3.0+ targets
    89.         {
    90.             CGPROGRAM
    91.                 #pragma target 3.0
    92.                 #pragma multi_compile __ _TERRAIN_NORMAL_MAP
    93.             ENDCG
    94.         }
    95.         SubShader // for sm2.0 targets
    96.         {
    97.             CGPROGRAM
    98.             ENDCG
    99.         }
    100.     }
    101.  
    102.     Dependency "AddPassShader" = "Hidden/TerrainEngine/Splatmap/Diffuse-AddPass"
    103.     Dependency "BaseMapShader" = "Diffuse"
    104.     Dependency "Details0"      = "Hidden/TerrainEngine/Details/Vertexlit"
    105.     Dependency "Details1"      = "Hidden/TerrainEngine/Details/WavingDoublePass"
    106.     Dependency "Details2"      = "Hidden/TerrainEngine/Details/BillboardWavingDoublePass"
    107.     Dependency "Tree0"         = "Hidden/TerrainEngine/BillboardTree"
    108.  
    109.     Fallback "Diffuse"
    110. }
    111.  
    As you can see, it's a little messy, and doesn't have a second subshader for the no-shadows-mode; but it works in the Demo scene with Forward rendering, which has the most likely setup. (if you need some feature that was left out, it should be pretty easy to add it into this new version)

    Anyway, let me know if it works. It should be as simple as replacing the "FirstPass.shader" file's contents with the above.
     
  37. philc_uk

    philc_uk

    Joined:
    Jun 17, 2015
    Posts:
    90
    Hi, yep that works better!
    Looks like you might have to make an update for the asset store :)
    Thanks!
     
  38. Orami

    Orami

    Joined:
    Mar 12, 2015
    Posts:
    20
    I'm not sure, but everything went pink again after the newest unity update. I re-imported the THS from the asset store still had the issue swapped out materials on the terrain as well just in case. Anything else I should try? Also removed and added the script back in. (5.2.0f3)
     
  39. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    I haven't updated to 5.2 yet but I would assume maybe Unity did something with the shaders that screwed it up? Wonder if the fix @Venryx worked out for the fog above might fix this too? I'm clueless when it comes to the shader stuff, but definitely sounds like that would be where the issue is... :)
     
  40. Orami

    Orami

    Joined:
    Mar 12, 2015
    Posts:
    20
    Yea. Something changed a lot and it was working perfectly (I) had even promised a new revision by Friday. Shame on me for upgrading Unity.

    Didn't want to sound like V said anything so I edited this with the (I)
     
    Last edited: Sep 10, 2015
  41. Venryx

    Venryx

    Joined:
    Sep 25, 2012
    Posts:
    444
    Yeah, I tend not to update unless there's a listed change that would significantly benefit my current project.

    I've learned that the hard way... It's just not worth updating for every little release, because stuff gets changed along the way and you have to fix little things each time, whereas if you update less frequently with known advantages each time, oftentimes those along-the-way issues will have already been fixed/normalized while you were working on your actual project.

    (That's also how I feel about this current issue with the shader. It's kinda tiring to download the newest version to fix an issue that may not even be there if I just let it wait for a couple months for the next few Unity releases to come in.)

    Can you perhaps downgrade back to the version you had?

    It might also be worth trying the fixed-fog shader 5 posts above this. There's about a 1/3 chance it'll solve the pink color (compilation error) issue as well, since it's based on the code from a newer version of the standard Terrain shader (and so deviates less from the shader-code approach they need to support).
     
  42. Orami

    Orami

    Joined:
    Mar 12, 2015
    Posts:
    20
    Yup I'll probably downgrade since it looks much nicer with your shader than the default. Sometimes the updates are worth it and trying is really the only way to check lol.
     
  43. Jamiechi

    Jamiechi

    Joined:
    Aug 27, 2015
    Posts:
    5
    With v5.2 I get the following errors in AddPass.shader and FirstPass.shader.
    undefined variable "SplatmapApplyWeight"
    undefined variable "SplatmapApplyFog"
     
  44. Orami

    Orami

    Joined:
    Mar 12, 2015
    Posts:
    20
    I can verify that downgrading back to 5.1.3f1 did fix the issue I was having. Something changed in 5.2.x that has messed up a lot of things (even my UI had done some really weird stuff).
     
  45. Jamiechi

    Jamiechi

    Joined:
    Aug 27, 2015
    Posts:
    5
    For now I commented out the lines in the two affected shaders as shown below.
    The Basic demo now works as expected. (And no more pink terrain.)
    (I'm too lazy to revert my installation back to v5.1. I'm sure this will be fixed later as time permits.)
    Thanks.

    Code (CSharp):
    1.  
    2.     void myfinal(Input IN, SurfaceOutput o, inout fixed4 color)
    3.      {
    4.        //SplatmapApplyWeight(color, o.Alpha);
    5.        //SplatmapApplyFog(color, IN);
    6.      }
    7.  
     
  46. philc_uk

    philc_uk

    Joined:
    Jun 17, 2015
    Posts:
    90
    Yeah doesn't work again.. adding in the include file make it compile (I found it online somewhere) however the 'holes' are white..
     
  47. darkcydr

    darkcydr

    Joined:
    Jun 18, 2015
    Posts:
    1
    Fixed the problem in 5.2

    Change the code in all of the "myfinal" functions in each shader to this:
    Code (CSharp):
    1. void myfinal(Input IN, SurfaceOutput o, inout fixed4 color)
    2.     {
    3.         //SplatmapApplyWeight(color, o.Alpha);
    4.         //SplatmapApplyFog(color, IN);
    5.      
    6.         SplatmapFinalColor(IN, o, color);
    7.     }
    (They changed TerrainSplatmapCommon.cginc in 5.2)

    Also comment out anything that says this:
    Code (CSharp):
    1. //Fallback "Diffuse"
    (This is some problem with deferred lighting in 5.2 that made it so you couldn't see objects through the hole)
     
  48. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    845
    does this work for anyone???
     
  49. Venryx

    Venryx

    Joined:
    Sep 25, 2012
    Posts:
    444
    Finally went ahead and updated the package (now confirmed to be working with Unity 5.2.1f1).

    Thanks for the tips, darkcydr. (rather than commenting out the fallback line, however, I ended up changing the first pragma line to this: "#pragma surface surf Lambert vertex:SplatmapVert alphatest:_AlphaCutoff_2 finalcolor:myfinal finalprepass:SplatmapFinalPrepass finalgbuffer:SplatmapFinalGBuffer")

    Note that the update is in review currently, so it will be a few days until it's available through the asset store.
     
  50. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    Any chance submitted with 5.1.3 or earlier? :)