change material on mesh
See original GitHub issueIs it possible to trigger an even that will change the material assignment of the mesh?
I want to swap a phong shader:
phongMaterial = [new THREE.MeshPhongMaterial( { ambient: 0x555555, color: 0x555555, specular: 0xffffff, shininess: 50, shading: THREE.SmoothShading } )];
with this basic material:
basicMaterial = [new THREE.MeshBasicMaterial( { vertexColors: THREE.FaceColors } ),new THREE.MeshBasicMaterial({color: 0xffffff, opacity: 1, wireframe: true} ) ]
when a certain event is triggered I switch using this code:
myMesh.materials = basicMaterial
and switching back:
myMesh.materials = phongMaterial
however when I switch from the phong to the basic the mesh just disappears (it comes back when I switch back)
Issue Analytics
- State:
- Created 12 years ago
- Comments:17 (8 by maintainers)
Top Results From Across the Web
Change Material Mesh - Unreal C++
In this tutorial we will change a static mesh's material on overlap. Create a new actor class and call it whatever you want,...
Read more >How to change Material and its properties at runtime in Unity?
To change the material at runtime, add the following script to a gameObject with a Mesh Render component. using System.Collections;
Read more >How do I change the MATERIAL of this mesh when i press T
So I have this. using UnityEngine; using System.Collections;. // Change renderer's material each changeInterval // seconds from the material ...
Read more >Change material on repeating mesh. : r/unrealengine - Reddit
Create a material or material instance variable within your blueprint. Set it to editable. Then, in the construction script, set the mesh's material...
Read more >Changing Materials on the Fly - Stellar Game Assets
Begin by creating a duplicate material for each material in the mesh renderer that you want to change. · Rename the duplicate to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Try this (there are no more multi-materials, also more complex material must be first one that gets rendered, if you use some vertex colors, they must be present / absent in both materials):
Thanks again! that fixed it ( I had the mesh.dynamic in there from the previous version)