io_object_mu icon indicating copy to clipboard operation
io_object_mu copied to clipboard

Material property animations are applied to the entire material instead of per gameobject

Open JonnyOThan opened this issue 3 years ago • 3 comments
trafficstars

I was working with SwitchWCover.mu from ASET Props and it uses a material animation to change the SwitchIndicator game object's emissive color between red and green. The animation curves are applied ONLY to this gameobject. After importing in blender, the animation curves are stored on the material itself - which means that when exporting, all gameobjects that use this material are affected by the animation. cfgs.zip

SwitchWCover.zip

JonnyOThan avatar Jun 08 '22 13:06 JonnyOThan

After some googling and experimenting, it turns out this isn't anywhere the nightmare I thought it would be: https://blender.stackexchange.com/questions/176235/per-object-custom-properties-in-shaders provides the info I need for implementing per-object data affecting a shared material, as shown below in my PoC test. The hard part will be designing a reasonable UI/UX for presenting and animating the properties on the object rather than the material.

image image

taniwha avatar Jun 08 '22 14:06 taniwha

I've been thinking about the internal (non-UI) design a bit and ran into the problem of how to allow the property to be specified in the material (eg, _EmissiveColor), but overridden by an object animation property. I've come up with the idea of using two attribute inputs for each property: one to indicate whether the property has a per-object override, and the second for the actual property override. I just tested the idea with a property that does not exist and blender seems to have defaulted the input to 0, which makes that idea feasible.

This is for the in-blender display, of course (otherwise, life would be easy: just have all the material properties on the object and be done with it (but no preview)).

taniwha avatar Jun 08 '22 14:06 taniwha

Would be awesome if you could solve this. I have come across several cases, of parts that need animations (usually emissives :P ) of mat. properties on certain objects only, but i havent been able to get anything working... it seems there are at least two stock MODULEs that can/should be able to do this...but of course...BOTH are broken :(

StoneBlue avatar Jul 02 '22 13:07 StoneBlue