![]() |
|
Updating Materials after Initialized - Printable Version +- AB4D Forum (https://forum.ab4d.com) +-- Forum: Products Forums (https://forum.ab4d.com/forumdisplay.php?fid=4) +--- Forum: Ab3d.DXEngine (https://forum.ab4d.com/forumdisplay.php?fid=11) +--- Thread: Updating Materials after Initialized (/showthread.php?tid=4302) |
Updating Materials after Initialized - siik - 11-22-2021 Hi, Is there any way to change a DX material after it has been initialized? By default we utilize PBR materials for scene nodes. I'd like to be able to change individual/all nodes to use VertexColorMaterial - so effectively replacing the PBR material I use when I initialize the scene. Then I'd like to go back to PBR later. I have tried the following but it doesn't seem to work: Code: if (_CalculatedMaterials.TryGetValue(node, out VertexColorMaterial vertexMaterial))(Note that the call to SetUsedDXMaterial() has already been done before we add nodes to the scene too). It seems there is something very similar in CustomFog Example in the demo which I was following. I must be missing something :( Thanks RE: Updating Materials after Initialized - abenedik - 11-22-2021 One DXEngine's material can be assigned to one WPF's material. For your use case, you would need two WPF materials and two DXEngine materials and then change the Material from one WPF's material to another, for example: Code: var pbrMaterial = new PhysicallyBasedMaterial() { /* ... */ }; |