SkinnedMeshDecals icon indicating copy to clipboard operation
SkinnedMeshDecals copied to clipboard

About the Setup

Open RokuAce opened this issue 2 years ago • 2 comments
trafficstars

Hi, thanks for providing this amazing tool. Unfortunately our team don't have much knowledge about HDRP and Shader, so I would like to know more regarding the setup.

What we'll like to do is when particles hits character's collider, it draws decal on mesh on where it hit. It's different than what the tool was originally designed for. I guess what we have to do is:

  1. Make a special shader for the character. It has a AlbedoTexture for base color and a DecalColorMap Texture for Rendering Decal. In shader graph AlbedoTexture goes to BaseColor, but where is DecalColorMap Texture going to be plugged in? image

  2. Make a particle system, add a script so that when particle hits collider, it calls PaintDecal.instance.RenderDecal.

  3. We don't have to set up another camera for rendering.

Is our understanding correct? Please let us know. Thank you. Regards.

RokuAce avatar Aug 21 '23 05:08 RokuAce

Yeah you've got the setup and process 100% correct, besides maybe one thing. It's called _DecalColorMap with the underscore. You'll have to double check that it's actually referenced as that on the shader.

To answer where you're supposed to plug in the _DecalColorMap, you can do simple blending with the shader graph. Chances are that you could use the alpha channel of the _DecalColorMap as a lerp with the original color so it blends on top.

naelstrof avatar Aug 21 '23 05:08 naelstrof

Now that I'm up I can show a screenshot. Here's a very basic shader setup:

image

Though you can get really really creative. For example, you could use _DecalColorMap as a mask to reveal a high-res repeating texture. Or use shader shenanigans to generate an infinite plane of noise, normals, and whatnot.

My favorite so far is to adjust the blending when rendering decals to make a sort of SDF-- Then use some smooth steps to define an "edge" of the decals. This allows it to pool up, and creates really blobby splats. However you need to understand the render pipeline pretty well to execute this.

naelstrof avatar Aug 21 '23 18:08 naelstrof