Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
141 stars 2 forks source link

Add MaterialPropertyBlocks for color properties #1451

Open XDelta opened 9 months ago

XDelta commented 9 months ago

Is your feature request related to a problem? Please describe.

Having several of effectively the same material but with very small changes in color (Albedo, Emissive, Specular) currently requires a new material for each case. With the addition of a MaterialPropertyBlock for the color properties, these materials could be the same singular shared material.

Describe the solution you'd like

The addition of a ColorPropertyBlock in some form, either handling all of the above or multiple separate PropertyBlocks

Describe alternatives you've considered

Having many duplicate materials with very minor, single property differences. They would not be de-duplicated as they are distinct different materials.

Requesters

_deltawolf kulza

shiftyscales commented 9 months ago

"Having several of effectively the same material but with very small changes in color (Albedo, Emissive, Specular) currently requires a new material for each case."

What is the actual problem here, @XDelta?

Identical materials that are managed (in the assets slot) are de-duplicated as an optimization step.

If you need them to not be de-duplicated/stay separate even if they use the exact same properties, you should be placing the material on the object itself, or somewhere outside of the assets folder where it won't be managed.

XDelta commented 9 months ago

Similar to the existing MaterialPropertyBlocks that allow using the same material for multiple different things when only a minor change is required. The currently existing ones allow swapping the MainTexture using MainTexturePropertyBlock or both MainTexture and MaskTexture properties using MainAndMaskTexturePropertyBlock. The original single material remaining the same and untouched. Having additional ones for the color properties greatly expands the usefulness of these property blocks.

shiftyscales commented 9 months ago

I see- I discovered the mentioned components and explored them in-app. So they can be used as a mechanism for (probably among other things) randomizing aspects of a material while still keeping only one actual material in-use. Thanks. This was an area I knew nothing about prior as I'd never used these components at any point prior.

stiefeljackal commented 2 weeks ago

Seeing that adjusting the color properties such as Albedo and Emissive (and their equivalents) via writing or driving are one of the most commonly things done to materials, having a color property block can really cut down on the number of copied instances of the same material where only said color property is different. Therefore, as this will reduce the additional allocation of materials and provide performance benefits especially for worlds that make heavy use of driving or writing color properties, may I request that this be placed under the Performance Optimizations roadmap?