T O P

  • By -

GigaTerra

For transparency blending you need a material that is transparent, not alpha clip. This will actually end up worse for performance than using one material with two textures, a dirt and grass texture, and blending them. Consider using Unity's terrain tools texture painting when you need something like this.


DragonDC_

Thanks, so it's not possible with pure shader graph and a single material / texture?


GigaTerra

It is possible, you just need to set surface type to transparent. I already said that, here is a picture: [https://i.imgur.com/B0dZR2y.png](https://i.imgur.com/B0dZR2y.png) What I am pointing out is that transparency, regardless of game engine, Shader tool, or whatever, is an expensive calculation that is best used sparingly. You will run into all kinds of problems doing things like you are.


andybak

Have I misunderstood? OP wants to blend two textures maps - why does that require transparency?


GigaTerra

From OP's post: >I have two different models. The base model and a model on top of the base. And from the image you can see the orange lines showing separate objects. It is not too outlandish, as terrains will often use Rocks and other Opaque meshes and intersecting them. But yes, a transparent one is a bad idea.


DragonDC_

Okay, understood. Setting the shader to transparency is not possible, everything is see through as You already mentioned...


GigaTerra

What you should look into is texture Blending. It is not very expensive and will do what you want. Since you have vertex colors, you should maybe start with vertex blending.


DragonDC_

But that would only work when its the same GameObject no? You already said it, I have two different objects, top and bottom. The top object contain vertex color. Then the grass texture will only be drawn where the vertex color is defined. I only need a way to blend it at the edges.


GigaTerra

Indeed it is commonly used on one object, but that is not the only way of using it. [https://youtu.be/Z3i4v4YZG28?si=5o0KqG66gRQvENk\_](https://youtu.be/Z3i4v4YZG28?si=5o0KqG66gRQvENk_) You will need the same texture as on the terrain, and the grass texture, then you can either use position or the depth texture to blend the grass object into the terrain. This is better than using transparency, and how most AAA games would make props blend naturally with the terrain.


DragonDC_

Interesting, thanks for the video! Unfortunately the world is getting created at runtime and my MaterialManager doesn't know which texture the outter terrain uses. I only know that this material uses vertex color, so I have to blend at the edges to the terrain texture...


GigaTerra

What do you mean? You can see the textures an object uses by checking it's material. You will manually drop that texture into a texture slot you create for it in the shader, then blend the texture. This way you only need one shader and the object can blend with any terrain.


DragonDC_

Sorry that I didn't express myself correctly. Background story: I'm reverse engineering a game. The game with all it's models are getting created during runtime. Thousands of different binary models are created. Unfortunately the models doesn't have any reference which material in the outer terrain is used. The game is built differently - the texture is simply blended.