godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Add a material flag to set a specific material to not receive decals #9055

Open FoxdanceMedia opened 9 months ago

FoxdanceMedia commented 9 months ago

Describe the project you are working on

A first person horror game in the style of Resident Evil 7 or Amnesia: The Bunker, which features a single unkillable enemy that the player has to manage.

Describe the problem or limitation you are having in your project

This enemy in my game changes shape sometimes and I'm interested in using decals to achieve certain visual effects. There are certain parts of its mesh which use a separate material that should not receive these decals.

I know you can use cull mask to make decals not appear on certain meshes, but I'm not aware of any way to set a specific material to not be able to receive decals, for developers like me who may want to have two separate materials on the same mesh and only have one of them be capable of receiving decals while the other does not.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

I know it's already possible to set a specific material to not cast shadows, so perhaps you could add a similar flag to have a material not receive decals.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

In the inspector there would be an option you could check to make a material not receive decals. I'm afraid I'm not familiar enough with the backend of Godot's editor to describe how I would do this with code.

If this enhancement will not be used often, can it be worked around with a few lines of script?

I believe you could write a custom shader to achieve this, but it would be very convenient if we could disable decals as easily as disabling shadows and other similar material options we have already.

Is there a reason why this should be core and not an add-on in the asset library?

It's a relatively standard feature that is similar to other functionality that already exists in Godot.

FoxdanceMedia commented 9 months ago

I apologize in advance if there's already an easy way to do this, I asked on the Godot subreddit and no one else seemed to know of one.