Search Unity

[Released] MegaSplat, a 256 texture splat mapping system..

Discussion in 'Assets and Asset Store' started by jbooth, Nov 16, 2016.

  1. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    So that's a no towards edge blending normals with normal meshes? Can only be done with Unity terrains using Megasplat?
     
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    The brush does either mesh vs mesh OR mesh vs terrain.
     
  3. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    He had said that at 0 it introduces artifacts but everything is fine at 1-255
     
  4. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Thanks for clearing that up, I have searched through quite a lot of your videos but have not seen a tutorial showcasing this feature, I might have missed it. Can you please link me to the video?
     
  5. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    I am also really excited to see some more showcase examples of what people have done with this plugin, it's very exciting!
     
  6. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I haven't really done one yet- I think it was briefly mentioned in one of the dev videos, but I haven't done one specifically on it yet..
     
  7. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Oh well I am subscribed to your Youtube so if you do one I will get notified! It's kind of a pretty major feature I am surprised not much gets talked about it.
     
  8. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    I'm trying to understand two things, hope you can help:

    1) We really want to use two-layer mode, as that gives the kind of overlapping textures that we need. In testing, I don't see any noticeable performance impact of that over Single. Is there one? Other reasons not to use it? (Okay, I see below one reason, because of the extra impact on triplanar...any other reasons?)

    2) Are there any tips/tutorials for converting an existing terrain to use two layer mode? Especially coming from World Creator....

    3) For Triplanar: We really need that for one or two texture clusters used on steep slopes, but it looks like a global setting on the shader. Right, no way to enable it only on certain clusters? I found some tips in your reply to an Asset Store review (would be great to get those tips into the documentation :) I'll copy them below. Does it matter how many textures are in each cluster?

    4) When I enable Triplanar on your demo terrain, it looks great. When I enable it on our terrain, all the textures are blurred -- clearly the scale is incorrect on our clusters in this mode, but where/how do I adjust that?

    5) Coming from RTP, I miss the options it has to rough up the terrain at mid-distance (mainly perlin, I think), so it doesn't look so smooth. I can't find a way to do something similar in MS. Tess/Displacement doesn't really do it, and I'll need to keep those settings conservative anyways. Is there a way to do that? EDIT: I guess that's Distance Noise, right? Helps, though not as much as I'd like.

    EDIT: 6) Is there a way to do geometry blending (blending rocks etc into the terrain)?

    thx
    Dave




    _____
    Triplanar is as optimized as it can be; it's not something you can actually optimize, because there is no math/code to optimize in the actual triplanar code. Triplanar texturing is basically just "Sample every texture 3 times, one for each projection, instead of just once". The speed of this is entirely up to your hardware, not my code, because there is very little code involved.

    However, the best way to increase performance when using Triplanar is to reduce the number of samples you need to do for each projection; for instance, use a one layer shader, use normalSAO packing to reduce the number of textures that need to be sampled, turn off parallax, etc. Sample counts are displayed in the debug area and can be used as a guide for performance estimation.

    As an example, here is how trilinear feature combinations can massively increase your sample counts (note that not all samples have the same cost, so it's not a linear difference):

    Lets say we are using a diffuse only shader on a Mesh as our base shader. This shader will perform 3 samples per pixel.

    If we use triplanar, we have to sample each of those textures 3 times. So now we're at 9 samples per pixel instead of 3.

    If we add a NormalSAO map, we're at 6 for UV'd, and 18 for triplanar.

    If we add a second layer, we're at 12 for UV'd, and 36 for triplanar.

    If we add parallax, we're at 18 for UV'd, and 45 for triplanar.

    As you can see, the cost of not using UV coordinates has a significant effect on performance, and should be weighted heavily vs your other feature choices.

    Also, decreasing your texture size may help with performance in Triplanar mode. This is because resampling a texture which is already in the cache is much faster than sampling a new texture. All triplanar samples are clustered such that we sample all 3 at the same time, so smaller texture sizes can increase the chance of that data being in the GPUs cache (though milage tends to vary with this type of optimization).
     
    Last edited: Jul 18, 2017
  9. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Well, two layers means twice as many texture samples (3 sets of samples per texture). If your not seeing a noticeable performance impact, then texture sampling is not your bottleneck. Note you can see how many texture samples your using in the debug tab as you change shader options. In most cases, it's a reasonable assumption that more samples == more cost (but not linearly so).

    The terrain converter always converts the data into a two layer mode- if you're set to a one layer shader, then you'll only see the first layer. In general, I personally find using wider transitions in tools like world creator helps with the conversion; though you can now use the options in the converter to do a lot of these adjustments. I cover the converter a lot in the last few videos, because I did a lot of work on it during those releases.

    To be clear, texture clusters are really an illusion- the shader only works with texture indexes at each control point. The cluster is a creation time feature to select from several texture index options and decide which one goes where (based on noise, angle, height, etc).

    That said, there is no way to enable triplanar just on certain textures. While it's possible to code something like this, it would mean a divergent branch on each pixel in the shader, which can be very expensive if each pixel in a shaded 2x2 section goes a different way down that branch. So weather this would be an optimization or not is going to be entirely dependent on the data in you scene. I generally favor consistent frame rate over "most optimal, but occasionally tanks performance".

    Triplanar has it's own UV scale parameter, which is based on scaling world coordinates. So you need to set that to something, most likely something much smaller than what you set the regular UV scale to. In triplanar, a UV scale of 1 means each texture repeats every unit in unity (meter), so you likely want something like .001 for UV scale.

    Distance and detail noise are a way to rough up albedo luminosity and normals- you can change the texture to get different effects. Tessellation should be used with care as it's generally an expensive feature, and unlike RTP, which uses it to smooth polygon edges in the distance, MegaSplat's is more about close up details. Given tessellation's cost, I don't think using it to smooth out distant terrain is really a great idea- you'd be better off having that terrain just have more vertices initially and not using tessellation, as invoking tessellation (even when it does nothing) adds significant expense.

    Yes, though it's not a simple "Add component and done" kind of thing. There's a normal blending brush in the vertex painter toolset (select the brush the same way you select the megasplat config). It works vs. other meshes or vs. terrains and will allow you to align normals so you don't have lighting seams. If you need a regular texture on the object, you can create an Alpha Layer shader and use the macro texture for your regular textures, and then paint splat maps over that to paint the same texture as the terrain. Finally, you need to have them both use the same UV space so the textures line up (ie: If they are both triplanar with the same UV scale).

    You can see an example of this in the examples folder (though it just uses two splat mapped meshes and doesn't use an AlphaLayer shader).
     
  10. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Thanks for the detailed response, very helpful. I think I'm finally past the steep part of the learning curve with MegaSplat, and it's looking really good now. (I was about to give up, then read all the rave reviews for MS in the Asset Store, and decided I should try one more time to be smart enough to use it.)

    Distance noise is exactly what I was looking for, but I assumed it was a 0-1 range -- 1.75 is perfect for my terrain and actually eliminates the need for triplanar.

    For geometry blending: Would other tools that are specifically designed for that work with MS, or do I need to use the vertex painter (which I had trouble with before, but should probably try again).

    Also, in the latest update, I noticed "Geo Height Texture" but I can't get it to do anything, and there's nothing in the docs about it. How does that work?

    thanks!
    Dave
     
  11. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Geo Height texture is used to create rock striations, usually. Basically, it's a texture mapped along the vertical axis of the terrain to color it. (I'll soon add per-texture properties for this, so you can have it effect certain textures but not others, etc). You just need to assign a gradient texture to it (usually 1x256 or something) and it will tint the terrain. You can adjust the mapping of it as well, to make it tile more or less across the terrain height.

    You can also use a pertexture property to control the amount of distance noise each texture gets, so you could turn it down on all but the rock textures used on the cliff edge, for instance.

    As for mesh/terrain blending, it's not the kind of thing that can be easily made to 'just work' across arbitrary models and shaders and toolkits. There are various solutions on the asset store, but each makes a large set of assumptions about what your doing. For instance, a recently released free one assumes that you want to blend objects at height 0 only (doesn't work anywhere else) and assumes you're using Unity terrain with a standard set of UV coordinates so that the texture's line up. Break any of those assumptions, and it no longer works.

    What MS provides is a pretty low level toolset to help resolve these issues. You can setup two shaders so the texture's end up with the same UVs, and you can blend the normals so the lighting matches. But it's just tools you can use to create that kind of an effect instead of a specific system to solve that specific issue. There isn't really a good way to just solve it for an arbitrary number of options like what MegaSplat provides (multiple UV mappings, etc).
     
  12. Grendelbiter

    Grendelbiter

    Joined:
    Oct 14, 2016
    Posts:
    123
    @jbooth have you had a chance to take a look at the Multi-tile Terrain not tiling correctly?
     
  13. jwilliamsen

    jwilliamsen

    Joined:
    Aug 8, 2010
    Posts:
    56
    I am just now getting into Megasplat and I've noticed something kind of odd: It seems that lightprobes aren't taking into account the surface colors or lighting of the terrain when the Megasplat shader is used ... am I missing something?

    Here are two screenshots - one with a Megasplat terrain, the other with a standard Unity terrain. It seems like the Megasplat version isn't picking up reflected light ...(?)

    reflected with megasplat.JPG reflected with terrain.JPG
     
  14. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I have not- we're shipping our first release candidate for our game, so I've not had a ton of time to work on MegaSplat for the last few weeks. I submitted a patch for the 2017 issue and a few other small fixes which should come this week, and will get to that (and everything else) when I can.

    Unless you are using tessellation or geometry shaders (low poly look), MegaSplat runs inside of a surface shader, so should act the same as a standard shader does (it doesn't have any lighting code in those versions, just uses Unity's system).
     
  15. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    @jbooth -- reference the light map issue with with 5.6 you mentioned earlier:

    Last night I re-baked my scene with Enlighten (which I always use currently), the outside part of the scene has a single directional light that is dynamic. The terrain (tessellated) is marked as lightmap static as I have a day / night cycle and switch to a baked light setup at night.

    Anyways - once the bake had completed the whole terrain was dark, possibly 'in shadow' ... so this would be the same issue right, but with Enlighten on a terrain?
     
  16. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Most likely - I have been looking into it with the progressive lightmapper, but since they change pretty much everything, I can totally see them just not bothering with backwards compatibility of shaders at all.

    This poses a pretty big issue for me, since I either have to split MegaSplat into a 5.4/5.5 and 5.6+ versions, or somehow get both lighting models to work within a single shader using tons of #if directives, something they themselves did not accomplish with the 800+ coders they have. You'd think they'd document these changes, but they don't, and support (even the paid variant) won't answer questions on this with anything but "Look at the compiled code and reverse engineer it".
     
    ZoneOfTanks and WildStyle69 like this.
  17. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    Hi @jbooth

    Don't want to steal the thread, but have you reported the bug? If not, please do it (preferable with a small repro project)

    Best
     
  18. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    Yeah, understand your view here.. even as a user it can be pretty frustrating that things are working one Unity release and gone / changed the next... especially with the lighting, which takes so much time to setup and bake etc.

    Sounds pretty challenging having to support multiple versions of Unity, perhaps it's better to split MegaSplat support for Unity versions, vs. having loads of directives, from a code maintainability perspective. Good luck on your decision and fixing things there!
     
    Goodgulf likes this.
  19. ZoneOfTanks

    ZoneOfTanks

    Joined:
    Aug 10, 2014
    Posts:
    128
    This exactly what I told you. Since MegaSplat works fine in 5.4 & 5.5 you can drop them and concentrate on newest Unity versions. This is what we need - up to date and optimized for Unity 5.6 & 2017.1 ;)
     
    Grendelbiter likes this.
  20. mwituni

    mwituni

    Joined:
    Jan 15, 2015
    Posts:
    345
    Or maybe just don't support 5.6+ ... there's a reason they call new versions the bleeding edge! One often ends up writing fancy new code to support some new feature ... only to find it shelved in next release (or completely refactored).
     
  21. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    Or maybe everyone just ban together and stay with 5.6 until the code can be figured out and Unity gets their $#% together because it sounds like Unity will keep doing this to the developers constantly breaking things no matter what version unless they start realizing they can't proceed into future versions unless they listen to the developers and get things completely documented and fixed first.
     
  22. Goodgulf

    Goodgulf

    Joined:
    Jan 12, 2016
    Posts:
    59
    With all the features already in MegaSplat a separate 5.4/5.5 version (perhaps even feature frozen because of technical limitations at some point?) makes sense to me.

    I'm slowly making the switch from 5.5 (dev/VR machine) to 5.6 (laptop) and stuff is indeed breaking although the 5.6.2 version is not too bad for the stuff I do. However more and more assets are requiring 5.6 now, for example check the list of the June free assets. So although I like @Ascensi 's comment to band together it's not likely to happen. :)
     
  23. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    I agree the 5.6 version would probably be where to stay for now, supporting the older ones is no longer necessary since their over a year old now. I personally don't bother with the lightmapper. I just use a gradient/color ambient lighting mode and it mimics realtime GI with no issues and no cost.

    The newer versions are bound to have new issues like 2017. The issue I don't get is I haven't noticed a significant change between 5.4 - 5.6 so I don't see why changes are being made that don't need to be.
     
  24. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    I wanted to say I just purchased Megasplat and will keep you posted on how I use it. I also saw your post on the BEAST Tessellation shader and what you said about it. Regardless the results looked really well and I wondered if your implementation could look as good?

    He mentioned BEAST was very fast, I know he tested it on a flat plane and you use tessellation with a splat mapping system so how much can you say the performance comparison could be with normal tessellation and your version using Megasplat?
     
  25. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Beast is just the standard shader with tessellation and some incorrect math in it. The quality of his videos is 100% from the textures, as there's nothing particularly interesting about the shader itself. Using the same textures/lighting, MegaSplat looks the same, but without the wrong lighting.

    Beast doesn't do splat mapping at all, it's just the Unity standard shader with an extra 30 lines of code to add tessellation. However, his tangent renormalization (which is incorrect) adds significant overhead that doesn't need to be there. I'm not sure if this makes it slower or faster than MegaSplat, which has to look up many more textures for splat mapping, but honestly it doesn't really matter since beast doesn't really do anything interesting.

    Yes, I dropped a bug in about it a while ago.
     
  26. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So, on 5.6+, etc..

    If you new to this issue, it only affects tessellated shaders or shaders which use the geometry shader. This is because these shaders cannot use the surface shader system and have to be written as vertex/fragment shaders, which requires me to decode a rather large amount of scattered, undocumented, and ugly code, which unity heavily changed in 5.6+.

    My current plan is to release several small maintenance patches in the 1.4 series of MegaSplat while I ship the game I'm currently working on (We're shipping in the next few weeks). For some amount of time after that, I'll maintain a 5.4/5.5 version in case anyone is trying to ship on these versions and runs into a blocking issue. I will not be doing improvements on that branch though.

    On the 5.6+ branch, I'm going to take advantage of this split to make some radical/breaking changes to MegaSplat. There will include:

    - A refactor of TextureArrayConfig. Instead of having one config for each type of texture (normal, etc), one config will generate all of the array. This will include a built in texture packer, which can automatically generate any missing textures for you. I have a working prototype of this already, which includes generating normals, height, ao, smoothness, etc from whichever relivant maps you provide.
    - A likely reduction of texture packing formats. People generally don't understand the tradeoffs here, but I think the likely case is that I will settle on NSAO and MSEO as the two major packing formats, with NSAO+Emissive array as the third option. These will be selected automatically from by the texture packer - if you provide an emissive mask, then it will pack into MSEO, etc..
    - A refactor of pertexture properties to take advantage of HD texture formats available in 5.6+ (EXR, 16bpc texture formats). Per texture properties are a little weird in 5.4, because they are limited to 0 to 1 values - so you end up with things like the way the UV scale works, which is not intuitive. Using a 16bpc format means not being limited to 0-1 values. Additionally, it'll make it easier to add more properties (tint, etc).
    - Some internal refactoring of the shader to reduce register pressure and increase throughput.

    I have some prototypes of all of the above already working, but it will take some time to get it all ported back to into MegaSplat and support all of it's feature set.
     
  27. ZoneOfTanks

    ZoneOfTanks

    Joined:
    Aug 10, 2014
    Posts:
    128
    Wow, just wow! :)
     
  28. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Posted this accidentally in a conversation:
    So I currently use Unity 5.6.0 and one of the first things in your documentation it suggests using a specific version of Unity. Right now what version of Unity do you recommend using for best use with Megasplat?
     
  29. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    5.4 or 5.5 are the best - 5.6 broke texture array serialization in builds until patch 5.6.1p2, so MegaSplat won't work at all in builds made with that version (works in editor fine). They also radically changed the lighting pipeline, so if you're using tessellation and baked lighting, it won't work in 5.6+ correctly. This will eventually be fixed, but if your not using tessellated shaders or "low poly look" then you're fine in any version >= 5.6.1p2..
     
  30. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    That's a bit of a confusing response haha. So are you saying I should upgrade from 5.6.0 to 5.6.1p2 in order to fix the tessellation and texture array bugs?

    Or are you saying I should stay in 5.6.0 because anything above 5.6.1 is bugged for now until further notice.
     
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No, everything is bugged in 5.6 -> 5.6.1.p2 because Unity broke texture array serialization completely in builds. They also changed the lighting pipeline in 5.6, so tessellated shaders currently don't work with baked lighting. I'm working on rewriting the tessellated shaders to use the new pipeline now.
     
  32. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Oh ok. Just wanted to ask since I am painting on a mesh what the default Target Channel should be. Mine defaulted to Uv3 displacement dampening, I don't really want to touch any vertex channel stuff at the moment, I just want to switch to the custom brush tab and paint, does using a the custom brush tab ignore what is selected in the paint channel because it seems confusing that both can technically paint and the paint tab overall appears to be confusing with no option to input a texture like the custom brush tab does?

    I just want basic diffuse and normal map functionality so not sure why it's on displacement mode anyway but there's too many channels listed there, don't want to stuff anything up.
     
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    If you're in the custom tab your painting with the custom brush you selected, which is likely the MegaSplat brush, it doesn't matter what's set in the paint tab. Basically, the MegaSplat texture config is just a brush for the vertex painter (which is open source). The vertex painter allows you to paint any type of information onto meshes, not just what MegaSplat does. MegaSplat uses certain channels for additional information, such as puddles, displacement dampening, etc..
     
    Last edited: Jul 25, 2017
  34. MonkeyPuzzle

    MonkeyPuzzle

    Joined:
    Jan 17, 2016
    Posts:
    119
    [SOLVED]

    "Go into your player settings and turn off automatic API selection, then remove Metal from the list of APIs."

    Hi - Trying to get Megasplat texture graph to work with Unity terrains. I was able to get it going by using the material 'MegaSplat_Example_Terrain,' selecting the terrain, preparing the selection and compiling. This works in the editor, but shows black in published games. I tried changing the texture type to procedural, but then compiling didn't change the terrain. I had problems getting this working before, and you asked me to upgrade to latest patch. However, having issues again, Using Megasplat 1.141 and Unity 2017.

    Do you have any insight into this? Thank you!

     
    Last edited: Jul 26, 2017
  35. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    Ok, then it will hit me (or already have hit me:) )

    Do you care to share the issue # with me?
     
  36. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    What platform are you publishing to? If Unity is selecting an API that doesn't support texture arrays (openGLES2.0, DirectX9) or you are trying to use Tessellation on Metal (Which is the default for OSX builds, but NOT when running in the editor, which uses OpenGL) then this would happen.
     
  37. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Thanks jbooth for the interpolation update, seems to be Unity made a fast approval. One desert cluster, which has 7 the same textures (rotated, scaled, normal modified). The tiling is not visible anymore, this is a big advantage in megasplat! The desert is boring, but this is a real challenge for terrain shader, because the desert cannot be filled with foliage.

    Inf1.jpg
     
    magique, Dwight_Everhart and jbooth like this.
  38. MonkeyPuzzle

    MonkeyPuzzle

    Joined:
    Jan 17, 2016
    Posts:
    119
    [SOLVED]

    "Go into your player settings and turn off automatic API selection, then remove Metal from the list of APIs."

    I am not doing anything fancy. New project. Open Untiy Terrain example. Creat a simple texture graph.


    Works great in editor



    Black when I publish



    System specs:



    Laterst version of MegaSplat and Untiy 2017. (I am finding that the midpoint value for the normals needs to pretty high to see both textures on your terrain)

    Terrains painted with vertex painter work fine.
     
    Last edited: Jul 26, 2017
  39. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Go into your player settings and turn off automatic API selection, then remove Metal from the list of APIs. I am betting that whatever shader settings your using is creating a 4.0 or 4.6 shader model shader, which doesn't work under Metal. Unity runs the editor in OpenGL, but defaults the runtime to Metal, which is pretty annoying if you ask me since Metal only supports a subset of OpenGL and Unity only supports a subset of what Metal supports.

    Note that you can see what shader model your currently using in the debug tab of the material editor. You can also force the shader model to 4.5 if it's running in 4.0, which does work on Metal despite being a higher value than 4.0, which doesn't work on Metal.

    Basically, the introduction of Metal, which doesn't support geometry shaders, and the unity implementation of Metal, which doesn't support tessellation, has broken Unity's shader model system in that the numbers don't make much sense anymore. Making this the default for the runtime is a massive mistake, IMO, as it's only going to cause issues for people.

    I have heard from Unity that they are going to refactor this some time in the future so shaders can declare what they need instead of a simple model number. In some cases, MegaSplat needs more vertex to fragment interpolators and bumps the shader model to 4.0. This was fine until the introduction of Metal, since apparently Unity treats shader model 4.0 as requiring geometry shaders (which apple does not support in Metal, even though your hardware does).

    You can find a large explanation of this situation in the docs. I believe Unity plans to make Metal the default in the Mac editor soon, which will only make this worse..
     
    Dwight_Everhart likes this.
  40. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    1.It looks like the terrain doesn't have per vertex ambient occlusion applied to make the terrain
    look nicer. I can apply this by baking it using the vertex toolset right, which channel would be best for this and there won't be any bugs if I do so right?

    2.Also in the scene sample you are using the Megasplat-Megasplat Shader but when I select it my model is all deformed weird like water and when I play it ripples slowly like water, what's going on?

    3.I can't find the shader that you used in the tutorial so I clicked on the brush_preview_normalsao or something and tried to paint on it with no success....sigh.
    Do I have to create my own Megasplat material or something?

    4.The edges between textures looks really bad. How can I make more of a smooth faded transition?
    I have uploaded a image sample to demonstrate. (Sniooth is meant to say smooth lol)
    The cropper[2] image is a practical example of good smoothing between textures but it was created with Cubiquity which doesn't support normal maps and is depreciated.
     

    Attached Files:

    Last edited: Jul 26, 2017
  41. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71
    So I noticed something today, the parallax on terrain compiled shaders do not appear to work correctly. They stretch as if the height map is scaled larger than the actual texture scale. I tested it on 5.5, 5.6, and 2017 and they all showed the same thing. The mesh parallax shaders work just fine though.

    I also had a cool idea when playing with tessellation and parallax. How about a setting to amplify the parallax when tessellation fades out to give more fluid transitions with tessellation? As the the displacement fades, parallax would be amplified to help preserve the sense of deph/shape.
     

    Attached Files:

  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Vertex Ambient is not currently supported in MegaSplat, as no one has ever asked for it.

    MegaSplat generates shaders- you should start by creating a MegaSplat shader and creating a material for it, not using the example shaders, which might be overwritten with new builds. This is different than most shader packages, which ship with a few shaders you select from. Rather, MegaSplat generates a unique shader based on your options, which is far more efficient and allows for many more options. I'd suggest going through the tutorial on this in the documentation.

    Interpolation Contrast in the Splat section controls this.
     
    Last edited: Jul 26, 2017
  43. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Are you using the latest? I was pretty sure this issue with this was fixed a few versions ago- there's a bug in the Unity shader compiler where viewDir gets sent in the wrong space unless you use it explicitly in the surface function. I now do a:

    Code (CSharp):
    1. o.Albedo *= saturate(i.viewDir+2);
    At the end of the shader to work around this (this effectively multiplies albdeo by one, which has no effect, but works around the bug in Unity which changes the view dir space if viewdir is unused, despite being used in internal functions).

    You can set the parallax fade distance further out than tessellation, but you'll find it doesn't really replace tessellation as the vertices are still going to move as tessellation fades.
     
  44. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    On our terrain (currently 7x7km, but we plan to slice it up), the terrain is black beyond the Base Map Distance. This occurs with and without Macro (Fade to Macro) feature enabled on the MS shader. Any idea why?
     

    Attached Files:

  45. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Add the "FixTerrainDistance" component to the terrains..
     
  46. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Aha! Thanks much!
     
  47. MonkeyPuzzle

    MonkeyPuzzle

    Joined:
    Jan 17, 2016
    Posts:
    119
    [SOLVED - I started with a simple terrain from the examples and got Texture Graph and Terrain Painting working together - and publishing to my MacBook Pro]

    Thanks much for the quick response.

    Thanks tht did it. I do not understand this 100% but it is working. Will disabling this affect metallic shaders?

    Another question. In your texture graph video, it says that once you are done creating a texture graph that you can go in and do manual painting. When I try this, it isn't painting on the surface. I have tried both the vertext and terrain painter.
     
    Last edited: Jul 29, 2017
  48. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461

    No, Metal is a new API from Apple - like OpenGL, DirectX or Vulkan. It has nothing to do with the actual PBR shading system. They decided to do two things different than the rest of the industry:

    1. No geometry shaders support
    2. Completely different tessellation path

    #1 I kind of agree with. Geometry shaders are very slow, and have very limited uses, most of which can be accomplished other ways. So given the slowness, I see why they didn't include them.
    #2 Is basically an optimization, but Unity hasn't shipped a version of their implementation of Metal that works with Tessellation yet. They don't really consider tessellation to be an important feature for most games, though it seems to be important to people on the asset store.

    Unfortunately, when unity implemented their shader support, they decided that shader features would be represented by one number and that greater number values would equal more features. This was a logical assumption at the time - and made some things easier - but has created an issue with these new APIs.

    Basically, saying you require shader model 4.0 also tells Unity that you need geometry shaders (which usually isn't true for MegaSplat), and geometry shaders are not available on Metal. Ironically, if you bump the model to 4.5, then it will start working on Metal, but break on OpenGL (which doesn't support 4.5). Shader model 4.6 works on OpenGL, but not Metal. So basically once you need features above shader model 3.5, it turns into an Apple induced mine field.


    That's odd- the two don't really know anything about each other. First, is this a mesh or a Unity Terrain? And does painting work fine before applying the graph?
     
    MonkeyPuzzle and Dwight_Everhart like this.
  49. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71
    Yup running the latest version.
    Opended up the shader and I couldnt find any reference to that code snipet, Attempted to add It in the Surf program at the end but it didn't seem to do anything ( I am not shader sauvy though).

    I also tried to re-import the package but when I do I get
    Code (CSharp):
    1. Exception: Must set an output directory through SetCompileScriptsOutputDirectory before compiling
    2. UnityEditor.Scripting.ScriptCompilation.EditorCompilation.GetCompileScriptsOutputDirectory () (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:126)
    3. UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CreateScriptAssemblySettings (BuildTargetGroup buildTargetGroup, BuildTarget buildTarget, EditorScriptCompilationOptions options) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:572)
    4. UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CreateEditorScriptAssemblySettings (EditorScriptCompilationOptions options) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:584)
    5. UnityEditor.Scripting.ScriptCompilation.EditorCompilation.GetAllScriptAssemblies (EditorScriptCompilationOptions options, UnityEditor.Scripting.ScriptCompilation.PrecompiledAssembly[] unityAssembliesArg, UnityEditor.Scripting.ScriptCompilation.PrecompiledAssembly[] precompiledAssembliesArg) (at
    Also when I try to set per texture parallax it compiles incorrectly and becomes irreversible because the material window stops displaying the megasplat editor window.

    Code (CSharp):
    1. Shader error in 'MegaSplat/MegaSplat_Example_Terrain': undeclared identifier 'biWeights' at line 1558 (on d3d11)
    2.  
    3. Compiling Vertex program with DIRECTIONAL
    4. Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME

    Edit:

    So I managed to get it working adding
    Code (CSharp):
    1. o.Albedo *= saturate(si.viewDir+2);
    in the SampleLayer method.

    but there still is a problem with these sharped jagged parallax anomalies that strech across hills.
     
    Last edited: Jul 27, 2017
  50. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Can you send/post a screenshot of the material settings (the top section) so I can try to reproduce it?