bryanedds / Nu

Repository hosting the open-source Nu Game Engine and related projects.
MIT License
1.05k stars 152 forks source link

Consider adding Keyed Materials to World. #725

Closed bryanedds closed 3 weeks ago

bryanedds commented 5 months ago

Instead of having baked-in but user-adjustable materials now, maybe we really do want something more like Unity where there is a simulation-wide dictionary of materials that are shared among entities. This could enhance usability in many cases making adjusting one material affect all entities that refer to it. We'd also need some UI / API to clone up new materials as well.

I'm guessing the material dictionary would hang off the WorldExtension type, and be populated when an Assimp.Scene is loaded. I'm guessing that the key of each material would be, in part, its assimp material name and... maybe the assimp scene asset tag it originated from? I don't know if that's adequate tho since it seems like it could make sense to share material across scenes...

Then of course, instead of having facets like StaticModelSurfaceFacet have Material and MaterialProperties properties, they'd just refer to a keyed material. However, if a keyed material itself is changed, how is that to be serialized?

bryanedds commented 5 months ago

I guess user-configured material settings would be in a file similar to and at the same folder level as Overlay.nuol and AssetGraph.nuag. Maybe Materials.numat. Would have to get its own imgui window with custom UI.

bryanedds commented 4 months ago

Considering how gracefully the ESP system turned out, I'm wondering if this type of system is still as valuable...

bryanedds commented 3 weeks ago

Closing this as the ESP works well enough to cover the needs provided for by this feature.