Mesh node with multiple textures not working

User avatar
Blockhead
New member
 
Posts: 8
Joined: Wed Jul 17, 2019 10:14
In-game: Blockhead

Mesh node with multiple textures not working

by Blockhead » Tue Aug 06, 2019 05:12

Hi! I am trying to create a custom signal set for advtrains based on the Victorian 3-position speed signalling system. These signals have 2 lamps, one atop the other:

Image

I have copied the general idea of the ks signal set, which has one mesh but multiple textures applied. This works fine for the ks main signal, but I can't figure out how to make it work for mine!

The textures are applied correctly in Blender and UV-unwrapped. Important note: I am using Blender 2.8. There are 3 materials: one for each light, and currently they are three different meshes. I have tried them as one mesh with three materials and as three meshes with one material each. The settings are similar for each:

Image

Screenshot blender UV wrapping and material setup

I then export to .obj which I understand minetest (i.e. irrlicht) is supposed to support, but I find that the same texture is applied to all three components. Is a custom export plugin required? I had tried the b3d exporter python script for 2.79 (yes, with 2.79 installed) but it didn't appear in the export menu - regardless, obj should work.

In lua, the textures are defined as a table of 3 textures as property 'tiles' (code excerpt):
Code: Select all
   ...
   RY = {
      asp = {
         main = {free = true, speed = 40},
         dst = {free = false},
         shunt = {free = false}
      },
      tex = {"vss_3pos-texture.png", "vss_lampred.png", "vss_lampyellow.png"}
   }
}) do
   minetest.register_node("vss:home_"..signalType --[[.."_"..rot--]], {
      description = "Victorian Home Signal ("..signalType..")",
      drawtype = "mesh",
      mesh = "threepos-home.obj",
      tiles = siginf.tex,
   ...


This does not work for some reason that I do not understand - because the ks signal set uses the same property 'tiles' and it works just fine! Instead the same texture is applied to the 3 meshes:
Image

Can someone with more expertise please let me know what I'm doing wrong?
Attachments
uvwrap.jpg
Screenshot blender UV wrapping and material setup
(199.04 KiB) Not downloaded yet
vss.zip
Mod source tree - blend file inside in models directory
(589.99 KiB) Downloaded 4 times
screenshot_20190806_145559.png
Signal in game - same texture in 3 places!
(308.91 KiB) Not downloaded yet
 

User avatar
GreenDimond
Member
 
Posts: 1272
Joined: Wed Oct 28, 2015 01:26
Location: SCP-3008
GitHub: GreenXenith
IRC: GreenDimond
In-game: GreenDimond

Re: Mesh node with multiple textures not working

by GreenDimond » Tue Aug 06, 2019 05:58

Without looking at the files (I don't have time at the moment), it looks like you need to export material groups.
Your .obj export settings should look like this:
Image
Default values with Write Materials unchecked (because it just generates a usually useless file) and Material Groups checked. This should use all the material slots.

Once this is done, you may need to swap around the textures in the table to get them in the right spot - they don't like to follow the list order.
Y▹uTube | Mods | Patre●n | Twitter | Minetest Discord | GreenDimond#3232

Hey, you. You're finally awake.
You were trying to view their profile, right? Found the rest of their signature, same as us, and that guest over there.
 

User avatar
Blockhead
New member
 
Posts: 8
Joined: Wed Jul 17, 2019 10:14
In-game: Blockhead

Re: Mesh node with multiple textures not working

by Blockhead » Tue Aug 06, 2019 07:07

Thank you very much! I hadn't seen the export options. They are in the bottom left of the file save dialogue in Blender 2.8. After checking the box the textures applied in a funny order; I simply had to re-arrange their orders and everything worked perfectly (ok, except for a minor UV unwrapping issue which was easy).

Image

Edit: If someone can please add this to the developer wiki page (so I don't have to register there) - it's not mentioned anywhere but it's very important.
Attachments
screenshot_20190806_170310.png
4 signals arranged in order from full speed to stop, working as intended after exporting materials
(457.98 KiB) Not downloaded yet
 


Return to Problems



Who is online

Users browsing this forum: No registered users and 1 guest