[FREE]MicroSplat, a modular terrain shading system for Unity Terrains

I have one finished but have not released it yet. However, if all your looking to do is implement mesh based terrains then you can look in the MicroSplatTerrain component and write the equivalent code for a mesh. Essentially as long as that mesh conforms to the same rules as a terrain and you provide the required data to the shader, it will work fine.

I have some planes with custom surf shader on terrains. Would it be hard to add wind effect on these seamlessly?

Click to expand...

One way is to turn on the Terrain Blending feature, and set the blend distance up high. This will cause the terrain texturing to be drawn over your object, texturing it with whatever features the terrain has, including wind. You can paint in the vertex colors to control where the terrain is drawn as well- however, if you don't draw the terrain the wind effect won't persist there.

Another would be to copy the code out of the wind shader and implement it in your own shader.

How heavy do you think is the procedural shading on an old Intel HD 4000? If I use a terrain without micro splat and self shadow it performs at 60fps. With microsplat shaders it went down to 40,with a big spike during the terrain renderer. Didn't have the time to profile it properly as it may still be due to shadowing as well, but I suspect that the problem is the complexity of the pixel shader. Thoughts?

How heavy do you think is the procedural shading on an old Intel HD 4000? If I use a terrain without micro splat and self shadow it performs at 60fps. With microsplat shaders it went down to 40,with a big spike during the terrain renderer. Didn't have the time to profile it properly as it may still be due to shadowing as well, but I suspect that the problem is the complexity of the pixel shader. Thoughts?

Click to expand...

Completely depends on the features used- but try lowering screen resolution to see if your really GPU bound or not. I find it rare for that to be the case in most games.

Oh I did profile with Intel GPA and it's totally gpu bound also because there is just the terrain and nothing else in the scene. I just didn't have the time yet to pin it down to the shadow or the pixel shader. I was just asking about your experience and if you had suggestions in case.

Oh I did profile with Intel GPA and it's totally gpu bound also because there is just the terrain and nothing else in the scene. I just didn't have the time yet to pin it down to the shadow or the pixel shader. I was just asking about your experience and if you had suggestions in case.

Click to expand...

Not without knowing your settings and the data your using (textures, etc)

How would I go about adding the required data to my prefabs so I can use instancing with blendable module?
Do I need to manually create a material for every mesh I want it on, remove the material property blocks and assign the needed Arrays? Do I need to pipe in the Control0 to 3 too? Are these the splat maps?

Also as a follow up, the blendable section doesn't seem to be working with postprocess stack v2 ambient occlusion Scalable ambient obscurance doesn't shadow properly. The AO is being applied underneath, making for weird artifacts. Here's a screenshot:
Ignore the white streak across.
I'm using the defered path, a directional light, no GI, Unity v2018.3.2f1.

Attached Files:

what should I do about this warning? Are Cavity maps needed and for what scenario?

OK now back to our data:

as you can see the terrain rendering takes 8ms, and it's totally due to the pixel shader only (if I disable it it goes down to 0.9ms).

5 textures are sampled (as you can see in the image)

We use two terrains, one it's called vista and all together is much faster. The only difference seems to be the resolution of the Base Texture Res and Control Texture Res, so we are currently investigating if we can lower the resolution of these textures on slower machines

I understand it can be hard to wait, but I would advice a bit of patience.
I don't know why Jason is not responding this last week, but in the time i have been on this forum, i have found his support to be beyond excellent.
You could try the discord channel (link is on page 1 of this thread)

I toyed around with the terrain holes today and created a different script than the one that's linked in the description. For some reason the one in the description didn't work for me (maybe because my gameobject has colliders in the children?). Anyway, here it is in case anyone has use for it:

Code (CSharp):

usingUnityEngine;

/***

* Add empty gameobject.

* Add collider to it, set to IsTrigger.

* Add rigidbody, enable IsKinematic, disable UseGravity.

* Add this script and set gameobject and terrain in inspector.

*/

publicclass EnterHole : MonoBehaviour

{

public GameObject player;

public TerrainCollider terrainCollider;

void OnTriggerEnter(Collider c)

{

if( c.gameObject== player)

{

terrainCollider.enabled=false;

}

}

void OnTriggerExit(Collider c)

{

if(c.gameObject== player)

{

terrainCollider.enabled=true;

}

}

}

Please note it disables and enables the terrain collider for everything, but it was good enough for my sunday morning project. This is how it looks:

He's been active on the One-Batch forum so maybe he's not receiving that there are new replies on this one. It happens to me almost daily that one of the threads that I'm subscribed to doesn't inform me that there are new replies.

He's been active on the One-Batch forum so maybe he's not receiving that there are new replies on this one. It happens to me almost daily that one of the threads that I'm subscribed to doesn't inform me that there are new replies.

Click to expand...

That's why I use the "Watched" link above. The "Alerts" popup doesn't show all.

We use two terrains, one it's called vista and all together is much faster. The only difference seems to be the resolution of the Base Texture Res and Control Texture Res, so we are currently investigating if we can lower the resolution of these textures on slower machines

You only need the cavity map if you are using the erosion or cavity features in the procedural texturing system. Now, why it's taking 8ms can be a number of reasons- first, procedural texturing must be performed before anything else can be sampled, and depending on how many layers your using it can be expensive since it is computed per pixel. Baking the result to a splat map is always going to be faster, but it really depends on your workflow. Beyond that, without knowing your setup, I would check the debug section for how many samples you are doing per pixel, as that will give you an idea of memory bandwidth usage.

The base texture is not really used by MicroSplat- it is however used by the Unity lighting system to compute GI bounce when lighting is baked.

I'm using unity vers-2018.4.0f1, I got weird errors when I imported microsplat;

Binary to YAML conversion: type UInt16 is unsupported

...any idea what's going on?

Click to expand...

Another user reported this, but thats some kind of internal Unity error since UInt16 is a c++ type, not a C# type, and I don't use any uints anyway. Not sure what I can do about this, but it appears harmless.

Try waiting a moment- like, I'm a sole developer and have a right to my life, and am not bound to spend it chained to support forums for the tiny amounts of money I charge for this software. I also had my laptop stolen so am basically responding on a phone. This forum is hardly dead either, you'll see I post just about every day. You want better support, you can pay my hourly rate and put me on a retainer for faster support.

I toyed around with the terrain holes today and created a different script than the one that's linked in the description. For some reason the one in the description didn't work for me (maybe because my gameobject has colliders in the children?). Anyway, here it is in case anyone has use for it:

Code (CSharp):

usingUnityEngine;

/***

* Add empty gameobject.

* Add collider to it, set to IsTrigger.

* Add rigidbody, enable IsKinematic, disable UseGravity.

* Add this script and set gameobject and terrain in inspector.

*/

publicclass EnterHole : MonoBehaviour

{

public GameObject player;

public TerrainCollider terrainCollider;

void OnTriggerEnter(Collider c)

{

if( c.gameObject== player)

{

terrainCollider.enabled=false;

}

}

void OnTriggerExit(Collider c)

{

if(c.gameObject== player)

{

terrainCollider.enabled=true;

}

}

}

Please note it disables and enables the terrain collider for everything, but it was good enough for my sunday morning project. This is how it looks:

Click to expand...

I'll add support for Unity's hole solution when it ships, and likely support it in the core package and depreciate holes for 2019.3 and up (or leave it for people who already have it in place). While my solution has more options and is quite usable, I think the official one will be better for most people.

Oh, I just noticed your using LWRP - I haven't tested instancing over there in a while, so will check that again. SRPs are a royal pain because it's like having to write to several different rendering engines..

I am using Microsplat with Mapmagic. I attempted to turn on Terrain Blending in the shader for Terrain 0,0 and then place an object on the terrain with the Micro Splat Blendable Object component following the instructions provided. However, the component indicates, "Terrain shader is not setup for blending"

I am using Microsplat with Mapmagic. I attempted to turn on Terrain Blending in the shader for Terrain 0,0 and then place an object on the terrain with the Micro Splat Blendable Object component following the instructions provided. However, the component indicates, "Terrain shader is not setup for blending"

Is there a step I'm missing? Thank you.

Click to expand...

Yes, blending requires the terrainData to be generated, which you can do by pushing a button on the MicroSplatTerrain component to generate it. You’ll have to generate this data yourself somehow if map Magic is generating the terrain at runtime.

Yes, blending requires the terrainData to be generated, which you can do by pushing a button on the MicroSplatTerrain component to generate it. You’ll have to generate this data yourself somehow if map Magic is generating the terrain at runtime.

Click to expand...

This is what is happening even if I hit the Update Terrain Descriptor Data button on Micro Splat Terrain component in the Terrain 0,0:

The TerrainBlending example in the MicroSplat folder doesn't have the issue. And, even after I recompile the MicroSplatData folder in that example shaders they don't have the same stream uninitialized warnings that my other scene does.

Adding a blend mat in the Debug of the Micro Splat Terrain component of the terrain for MicroSplat_TerrainObjectBlend seemed to provide partial progress because now I can see the blending shader working.

The TerrainBlending example in the MicroSplat folder doesn't have the issue. And, even after I recompile the MicroSplatData folder in that example shaders they don't have the same stream uninitialized warnings that my other scene does.

The warnings shouldn't cause any issue. You could step through the code in MicroSplatBlendableObject to see if it's grabbing the right terrain and getting the data you expect. It basically raycasts down, finds the MST component on the terrain, and grabs the data the shader needs from that.

Hi,
i have 2 questions about procedural texture asset,
- is there a way to avoid an area or areas to be painted in the terrain?
- is possible to paint manually after create the layers?because i am trying to paint a river and i am not able
thanks

Hi,
i have 2 questions about procedural texture asset,
- is there a way to avoid an area or areas to be painted in the terrain?
- is possible to paint manually after create the layers?because i am trying to paint a river and i am not able
thanks

Click to expand...

There’s no runtime way to combine a pre-generated splat map with procedurals if that’s what your asking. You can however bake the procedurals back to a splat map and paint from there.

Oh, I just noticed your using LWRP - I haven't tested instancing over there in a while, so will check that again. SRPs are a royal pain because it's like having to write to several different rendering engines..

Click to expand...

Hello again!

I appreciate that maintaining all the pipeline must be incredibly time consuming, but we started using microsplat because it declares LWRP support. I list again our current warnings/errors:

SRPs are a giant pain in the ass. Anyway, what version of unity and what version of the LWRP is this on, and what features are on in MicroSplat?

Click to expand...

I was thinking about you today while I was experimenting with HDRP because I remember what you were saying about SRPs. And, I remember thinking, man that guy could actually write his own SRP and tell people he only supports that and it'd probably be better.

Have you ever looked into Unity's samples on developing a custom SRP? It looks pretty straightforward. You get full control of the pipeline. And, when customers ask about how to do xyz on lwrp/hdrp/etc you could just say I only support JBRP. xD

I was thinking about you today while I was experimenting with HDRP because I remember what you were saying about SRPs. And, I remember thinking, man that guy could actually write his own SRP and tell people he only supports that and it'd probably be better.

Have you ever looked into Unity's samples on developing a custom SRP? It looks pretty straightforward. You get full control of the pipeline. And, when customers ask about how to do xyz on lwrp/hdrp/etc you could just say I only support JBRP. xD

Click to expand...

We had a custom SRP at my last job. It’s great if you want that kind of control over the pipeline, but unless you’ve got graphics engineers to maintain and support it it’s not viable for many teams, and certainly not something designed for an asset store based environment. It’s real advantage is customizing it for a specific game, not the kind of thing you’d want to support for all possible games.

Oops...

"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.