Adding a secondary texture to a model #99
-
|
I have been using wasabias threes_dart and I have a terrain that I created with blender with many different groups and I apply a secondary texture based upon the group name eg if its a wall, the ground, the ground outside like below: but this code doesnt work in three_js so I use the three_js THREE.GroupMaterial but when I run this code I get the following error I am wondering what I might be doing wrong and if there is a way to add a secondary texture to an existing model like in three_dart? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 2 replies
-
Beta Was this translation helpful? Give feedback.
-
|
Thanks for looking into it. I've updated to 0.2.5 but unfortunately I'm not seeing the secondary texture but it is no longer raising an error. Initially saw I saw a lot of flickering when I added a secondary texture but this reduced when I used
after assigning the groupMaterial to the mesh, though the flickering still appears occasionally. I've attached a video showing it flickering. Untitled.video.-.Made.with.Clipchampsmall.mp4 |
Beta Was this translation helpful? Give feedback.
-
|
Hi @forthtemple, I have fixed the issue in the newest update. Please use three_js: ^0.2.5. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for offering to help. The blender file I use is terrain.blend under the directory I convert the blender file to OBJ format to be loaded into my game because OBJ preserves the mesh names which I use to set the secondary textures. I found for glb files the mesh name isn't preserved. The terrain.obj file is under the directory: The full code I use for three_dart to add the secondary texture is as follows: |
Beta Was this translation helpful? Give feedback.
-
|
Hi @forthtemple , The renderer in three_dart and three_js is now completely different. So there could be something I missed when updating the renderer. The error looks to be related to that or if you are using a shader material that has an issue. I changed the objects material property from being a dynamic to only accept Material classes. This was more for users experience, so using Group material fixes this issue. If you could provide an example of the model I could look to see how to resolve the issue. |
Beta Was this translation helpful? Give feedback.
I solved it. If I add
like in the code below it works and get secondary textures: