naelstrof / SkinnedMeshDecals

An example of rendering decals on SkinnedMesh Renderers in Unity.
MIT License
155 stars 24 forks source link

Usage with ProBuilder Meshes #15

Open Monitor9 opened 1 year ago

Monitor9 commented 1 year ago

Hello, I use SkinnedMeshDecals on simple meshes with MeshFilter and MeshRenderer, as well as on meshes created with ProBuilder. I was able to generate UV2s lightmaps for these meshes, but even with maximum Texel Per Meter, their quality is terribly low. Example: image ProBuilder UV2 creation: image Shader: image Is this due to the fact that the meshes can be very large in size, or did I set something up incorrectly?

Please forgive my poor English, as it is generated by the ChatGpt translation system.

naelstrof commented 1 year ago

Yeah this is an unfortunate side effect of the strategy, large meshes can't possibly get enough resolution. You have a couple of options though:

I hope that helps!

Monitor9 commented 1 year ago

Thank you for your response. I'd prefer not to use the first option, as the standard Unity Decal Projectors on the LTS version don't support layer filtering, and don't filter meshes at all (they project onto everything, and I have a lot of moving props in the game, so they'll be affected). test Can you provide more details on the second option? Perhaps an article or video, as I'm not quite sure what you're referring to.

naelstrof commented 1 year ago

I don't have articles or videos, but an example of what it might look like: image

In essence you'd project a pure red dot as a decal onto the mesh, then use the red channel of the _DecalColorMap as a mask to reveal damaged parts.

Depending on the kind of damage, you can do different things, Red could be gradual damage that removes skin/muscle until it reveals bones. Green could be water wetness (for bodies of water), and Blue could be muddiness/dirtiness.

Just use them as masks to sample underlying triplanar maps, or cool glowy effects, whatever.

Then you'd have no need for traditional decals, because you'd simply author decals as how hurty/wet/muddy they are.