Surface Manager and Terrain

gdespaux

New member
Using a terrain created with Gaia 2 in Unity 2019.4.1, with URP 7.4.1

I have Surface Manager setup with the proper textures and surface effects for Grass, Dirt, and Sand. My terrain has a Terrain Collider, and my character has the Footstep Surface Impact assigned in the Character Foot Effects component.

I get footstep sounds, but it only ever plays the generic Fallback Sound that is set in the Surface Manager. It doesn't seem to read the proper textures from my terrain. I tested by creating a primitive cube and assigning a material with the same texture as the terrain, and when running across it the proper Surface Effects and sounds play.

I thought my character was setup incorrectly, so I drug Nolan from the Demo scene into my scene, but he also only plays the generic Fallback sound (He of course plays the correct sounds when running across the Cube object instead)

What am I missing?
 

Justin

Administrator
Staff member
Does a terrain without Gaia work? I haven't used Gaia in awhile so am unsure what shaders it uses for the terrain. There may need to be some type of integration with the Surface System.

I have been meaning to do an integration with CTS and Vegetation Studio Pro so this would also be a good opportunity. If anybody has gotten the terrain system working with Gaia it would be helpful to know what you did.
 

gdespaux

New member
I tested it with a non-Gaia terrain and it does work.

That's frustrating, I wasn't sure Gaia actually changed the terrain shaders/material.

How can I go about trying to debug? Would I just be searching to see what keyword/reference the shader uses to refer to the texture and modify the raycast code?
 

FullMe7alJacke7

New member
I am also experiencing the same issues described above, I'm on the newest version of packages and using 2019.4.0f1

Was really hoping to add that immersion but I do appreciate your post helping me quickly nail down the root cause.
It probably would of taken me forever otherwise..... As it is I already spent 2+ hours on it thinking I did something wrong lol.


Unfortunately I have not figured out a solution yet. :(
 

nathanj

Member
Hey,

I've never used Gaia but I had a similar issue with CTS a while ago. Basically, you need to make sure that the Textures in your terrain manager array match that of your CTS manager


From:
 

gdespaux

New member
Hey,

I've never used Gaia but I had a similar issue with CTS a while ago. Basically, you need to make sure that the Textures in your terrain manager array match that of your CTS manager


From:

Thanks! I'll see if there's any discrepancy with mine. I'll try to add some debug lines and see what texture it actually is detecting at the moment too. Maybe we'll get this fixed for everyone!
 

Justin

Administrator
Staff member
This is related to the surface manager not picking up the custom material used by Gaia (and CTS). I am starting to get back to adding more integrations and will let you know after I add support for them.
 

gdespaux

New member
I've implemented my own fix. The problem here is that SurfaceManager checks through various surface types to try and find an impact. It checks for Terrain colliders last, so absolutely anything else will play a sound first. This is fine in and of itself, but the first check it does is for a "SurfaceIdentifier" and it tries really hard to find one, iterating through a collider's children and checking the parent as well. Again, not a big deal, but it doesn't take into account that it could be a terrain object that it has detected.

Basically, because Gaia uses Terrain GO as a parent for many spawned items, Opsive's SurfaceManager was picking one to use as a surface impact. You can either remove all children from your terrain and put them somewhere else (Not ideal if you continue to use Gaia) or you can change this line in SurfaceManager to check for terrain colliders:

Line 336-338:

C#:
if (collider == null || collider.GetType() == typeof(TerrainCollider)) {
    return null;
}
 
Top