[Mod] Advanced Trains [advtrains] [2.4.3]

yw05
Member
Posts: 379
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.4.3]

by yw05 » Post

nazalassa wrote:
Thu Jun 13, 2024 09:05
It seems that both signals have their influence points set correctly; here are screenshots of the influence points:

screenshot_20240613_104642.png
screenshot_20240613_104701.png

And the HUD:

screenshot_20240613_104714.png
Interesting. It seems like for demo signals there is a bug that prevents the proceed_as_main field of the supported aspects table from being passed on into the signal aspect. Can you try using a different set of signals (e.g. Ks signals)?

User avatar
nazalassa
Member
Posts: 12
Joined: Sun May 26, 2024 14:50
In-game: Nazalassa
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.3]

by nazalassa » Post

yw05 wrote:
Thu Jun 13, 2024 10:54
Interesting. It seems like for demo signals there is a bug that prevents the proceed_as_main field of the supported aspects table from being passed on into the signal aspect. Can you try using a different set of signals (e.g. Ks signals)?
It was, indeed, the demo signal. Problem solved. Thank you for the help!

P.S: what is the difference between a Ks signal and a normal one?

User avatar
Blockhead
Member
Posts: 1881
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.3]

by Blockhead » Post

nazalassa wrote:
Thu Jun 13, 2024 11:35
P.S: what is the difference between a Ks signal and a normal one?
Ks signals have the ability to introduce speed restrictions and shunt routes, which are not features of the freestanding, wallmounted and semaphore signals.

yw05 and I have written about them previously in these posts:
viewtopic.php?p=434003#p434003 (introduces the signals)
viewtopic.php?p=435054#p435054 (corrects me on what the signal colours and flashing means)

The whole Ks set is also documented in the source code at advtrains/advtrains_signals_ks/doc/advtrains_signals_ks.7advtrains.md (web link).
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

Wogster
Member
Posts: 21
Joined: Tue Oct 18, 2022 02:33

Re: [Mod] Advanced Trains [advtrains] [2.4.3]

by Wogster » Post

Okay, I think I have the interlocking sorted out, now I would like to build my own train.

So our domestic trains here in Canada, are typically the LRC cars, and the EMD F40PH-2 as motive power, there were LRC locomotives, but the trains have been in service since the mid 1980's so the engines all were retired a couple of decades ago, they were well known for leaving black trails where ever they went. Looking at existing .png files for locomotives, looks a little complex, anyone know how the images work?

Can one then "borrow" code from another loco, and modify it to work with different images, looks like licence wise it would work. I would likely skip logos and stuff, to keep out of trademark court..... Funny how the LRC cars actually look a lot like the Japanese cars with a different colour scheme, so maybe I can borrow the code, and just mod the images.

yw05
Member
Posts: 379
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.4.3]

by yw05 » Post

Wogster wrote:
Sun Jun 30, 2024 20:08
Looking at existing .png files for locomotives, looks a little complex, anyone know how the images work?
In short: the model for the wagon (which defines its 3D shape) contains information on which part of the image to use for a particular surface ("face") on the model. This is known as UV mapping. Blockhead likely has further knowledge in this field than I do.

Note: In the context of MT modding, this is not always strictly a single image file. Textures (which are what end up being shown on the surface of the wagons) can be created out of texture modifiers, which can adjust the textures or combine them before being displayed. (By the way, the train HUD is actually just a texture string that combines various images together based on different properties of the train.)

Some models additionally have multiple texture slots (or: materials, texture buffers), where the faces are assigned different materials. For such models you need multiple textures for the wagon to be displayed correctly.

Can one then "borrow" code from another loco, and modify it to work with different images, [...]
In terms of having a single model with different textures? Yes. Since the models only define the shape and the UV map for the wagons, you can make the train appear differently by providing different textures. In fact, mods like Dlxtrains already does this to allow users to customize the livery for the wagons, where the wagon is given a different texture when the livery is changed.

Note that in certain cases you need to pay attention to image dimensions, particularly if the mod uses texture modifiers or includes code that changes the textures of the wagon.
Last edited by yw05 on Mon Jul 01, 2024 12:07, edited 1 time in total.

User avatar
Blockhead
Member
Posts: 1881
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.3]

by Blockhead » Post

Wogster wrote:
Sun Jun 30, 2024 20:08
Okay, I think I have the interlocking sorted out, now I would like to build my own train.

Looking at existing .png files for locomotives, looks a little complex, anyone know how the images work?
The images on their own won't make much/any sense until you open the image file in Blender so you can see what faces match up to what pixels. This is, as yw05 notes, called UV mapping. It's the process where x and y coordinates for a 2D texture get mapped into u and v coordinates which are their actual positions on the faces of the 3D geometry. Thankfully if you're just doing an edit of an existing train, the UV map is already in place and you can just reference it from within Blender.
Wogster wrote:
Sun Jun 30, 2024 20:08
Can one then "borrow" code from another loco, and modify it to work with different images, looks like licence wise it would work. I would likely skip logos and stuff, to keep out of trademark court..... Funny how the LRC cars actually look a lot like the Japanese cars with a different colour scheme, so maybe I can borrow the code, and just mod the images.
If you wanted to use the Japanese cars, then you could easily make a copy and edit of that mod from the Basic Trains pack.

First copy out the directory advtrains_train_japan into your mods directory and rename it to a new mod name, like advtrains_train_lrc

You then edit the names of things so it's no longer actually a duplicate: rename all of the texture and model files, rename the mod in mod.conf, and change the code in init.lua to register a wagon with a new original name.

Then you get to editing the actual texture file. It's either guess-and-check or you import the b3d files (advtrains_engine_japan.b3d, advtrains_wagon_japan.b3d, but you already renamed those right?) into Blender and go to the UV Editing tab to see what faces match what pixels.

Edit: Anyone interested should also check out "Post your livery repaints here!".
Last edited by Blockhead on Mon Jul 01, 2024 01:35, edited 1 time in total.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

Wogster
Member
Posts: 21
Joined: Tue Oct 18, 2022 02:33

Re: [Mod] Advanced Trains [advtrains] [2.4.3]

by Wogster » Post

Blockhead wrote:
Sun Jun 30, 2024 22:35
Wogster wrote:
Sun Jun 30, 2024 20:08
Okay, I think I have the interlocking sorted out, now I would like to build my own train.

Looking at existing .png files for locomotives, looks a little complex, anyone know how the images work?
The images on their own won't make much/any sense until you open the image file in Blender so you can see what faces match up to what pixels. This is, as yw05 notes, called UV mapping. It's the process where x and y coordinates for a 2D texture get mapped into u and v coordinates which are their actual positions on the faces of the 3D geometry. Thankfully if you're just doing an edit of an existing train, the UV map is already in place and you can just reference it from within Blender.
Wogster wrote:
Sun Jun 30, 2024 20:08
Can one then "borrow" code from another loco, and modify it to work with different images, looks like licence wise it would work. I would likely skip logos and stuff, to keep out of trademark court..... Funny how the LRC cars actually look a lot like the Japanese cars with a different colour scheme, so maybe I can borrow the code, and just mod the images.
If you wanted to use the Japanese cars, then you could easily make a copy and edit of that mod from the Basic Trains pack.

First copy out the directory advtrains_train_japan into your mods directory and rename it to a new mod name, like advtrains_train_lrc

You then edit the names of things so it's no longer actually a duplicate: rename all of the texture and model files, rename the mod in mod.conf, and change the code in init.lua to register a wagon with a new original name.

Then you get to editing the actual texture file. It's either guess-and-check or you import the b3d files (advtrains_engine_japan.b3d, advtrains_wagon_japan.b3d, but you already renamed those right?) into Blender and go to the UV Editing tab to see what faces match what pixels.
This looks harder then I thought, so I think I will skip it.

User avatar
nazalassa
Member
Posts: 12
Joined: Sun May 26, 2024 14:50
In-game: Nazalassa
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.3]

by nazalassa » Post

yw05 wrote:
Sun Jun 30, 2024 21:42
Some models additionally have multiple texture slots (or: materials, texture buffers), where the faces are assigned different materials.
Due to Blender uncooperativeness, I would be extremely interested in knowing how to add several slots to a model in Blender.

User avatar
Blockhead
Member
Posts: 1881
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.3]

by Blockhead » Post

nazalassa wrote:
Mon Jul 01, 2024 12:40
Due to Blender uncooperativeness, I would be extremely interested in knowing how to add several slots to a model in Blender.
For you, I recommend Nathan Salapat's (Minetest Videos) tutorial series on asset creation with Blender link. As you can see in the playlist link, the 4th episode covers multiple materials.

The idea is applied there to nodes but the Blender workflow is identical; for Advtrains, the only difference is in the fields used in Lua. Instead of mesh and tiles, you use mesh and textures.

The Advtrains example I can give is the linetrack boat; I never actually published the Blend file for that, so I'm attaching it. Sorry the textures aren't included, and I can't attach more than 1 MB of attachments whereas my project files are like 10 MB, but you can re-link the ones from a copy of linetrack (first line how to apply materials in Blender and then you should be able to work that out).
Attachments
BetterFerry.zip
(161.11 KiB) Downloaded 2 times
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

User avatar
nazalassa
Member
Posts: 12
Joined: Sun May 26, 2024 14:50
In-game: Nazalassa
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.3]

by nazalassa » Post

Blockhead wrote:
Mon Jul 01, 2024 15:18
nazalassa wrote:
Mon Jul 01, 2024 12:40
Due to Blender uncooperativeness, I would be extremely interested in knowing how to add several slots to a model in Blender.
For you, I recommend Nathan Salapat's (Minetest Videos) tutorial series on asset creation with Blender link. As you can see in the playlist link, the 4th episode covers multiple materials.
Thanks! Hopefully there will be some new trains soon :)

User avatar
nazalassa
Member
Posts: 12
Joined: Sun May 26, 2024 14:50
In-game: Nazalassa
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.3]

by nazalassa » Post

Blockhead wrote:
Mon Jul 01, 2024 15:18
The idea is applied there to nodes but the Blender workflow is identical; for Advtrains, the only difference is in the fields used in Lua. Instead of mesh and tiles, you use mesh and textures.

The Advtrains example I can give is the linetrack boat; I never actually published the Blend file for that, so I'm attaching it. Sorry the textures aren't included, and I can't attach more than 1 MB of attachments whereas my project files are like 10 MB, but you can re-link the ones from a copy of linetrack (first line how to apply materials in Blender and then you should be able to work that out).
Is there a way to specify an order for the texture slots?

User avatar
Blockhead
Member
Posts: 1881
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.3]

by Blockhead » Post

nazalassa wrote:
Tue Jul 02, 2024 16:58
Is there a way to specify an order for the texture slots?
The order has to match how it came out of Blender. One Blender material slot = one textures slot. I'm not sure if there's a rhyme or reason to how it goes - it may be alphabetical, according to internal IDs from Blender, or any other weird thing that the exporter chooses (or leaves as undefined behaviour). I could try to work it out probably but I've always just edited and reloaded until it's right.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

User avatar
nazalassa
Member
Posts: 12
Joined: Sun May 26, 2024 14:50
In-game: Nazalassa
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.3]

by nazalassa » Post

Introducing Red Comet! It lacks an interior and the inside faces of three on four doors look like they are shaded weirdly though. I can not understand why.
screenshot_20240704_163057.png
screenshot_20240704_163057.png (142.97 KiB) Viewed 264 times
screenshot_20240704_163127.png
screenshot_20240704_163127.png (111.85 KiB) Viewed 264 times

User avatar
Blockhead
Member
Posts: 1881
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.3]

by Blockhead » Post

nazalassa wrote:
Thu Jul 04, 2024 14:32
Introducing Red Comet!

screenshot_20240704_163057.png
screenshot_20240704_163127.png
Nice, I like the profile, it fits well into Advtrains and looks good while still looking like a kind-of realistic profile. Wagons for Advtrains can end up looking kind of "miniature"
nazalassa wrote:
Thu Jul 04, 2024 14:32
the inside faces of three on four doors look like they are shaded weirdly though. I can not understand why.
I think that they are smooth shaded when the rest of the train is flat shaded - help article. Typically trains look better in flat shading but a lot of MBB's older stuff uses smooth shading. Also, you should learn how to view face normals so you can tell which way a face is.. facing. Blender draws both sides of a face but Minetest will only draw one, the side that in Blender the normal is pointing outward from.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

User avatar
nazalassa
Member
Posts: 12
Joined: Sun May 26, 2024 14:50
In-game: Nazalassa
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.3]

by nazalassa » Post

Blockhead wrote:
Thu Jul 04, 2024 15:11
I think that they are smooth shaded when the rest of the train is flat shaded.
[...]
Unfortunately, setting these faces to flat shading did not solve the problem. They are displayed correctly in Blender though.
Blockhead wrote:
Thu Jul 04, 2024 15:11
Blender draws both sides of a face but Minetest will only draw one, the side that in Blender the normal is pointing outward from.
Unless the 'Backface culling' box has been ticked in the material properties.

User avatar
nazalassa
Member
Posts: 12
Joined: Sun May 26, 2024 14:50
In-game: Nazalassa
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.4.3]

by nazalassa » Post

Blockhead wrote:
Thu Jul 04, 2024 15:11
nazalassa wrote:
Thu Jul 04, 2024 14:32
the inside faces of three on four doors look like they are shaded weirdly though. I can not understand why.
I think that they are smooth shaded when the rest of the train is flat shaded - help article. Typically trains look better in flat shading but a lot of MBB's older stuff uses smooth shading. Also, you should learn how to view face normals so you can tell which way a face is.. facing. Blender draws both sides of a face but Minetest will only draw one, the side that in Blender the normal is pointing outward from.
It's getting even worse: the roof and some other faces are now also incorrectly shaded. As previously stated, changing the shading in Blender does not change anything, neither in the viewport nor in the game. In Blender all faces are displayed correctly though.

Upd.: I previously used one mesh for both the exterior and the interior. After separating it into two independent meshes, the faces that were displayed weirdly are now displayed correctly. Perhaps the mis-displaying is due to having too much polygons on a mesh? Or maybe because several materials are used on it? Further research is needed.

Upd. 2: That also solved the problem for the doors.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests