Thank you all, but.........Glass

Halfwolf

Member
Hi all, Thank you to those who have helped me so far. I'm now getting buildings into my route, all looking good. However now I'm trying to sort out glass. I have got glass into the game but it has no reflection or shine. I'd like the windows to look like windows really.
I've tried various materials, m.pbrmetalmasked , m.glass and m.onetex. No satisfactory results. I've taken screenshots but can't attach to this thread :unsure:

Thank you all in advance.
G
 
If you are working with PBR textures exclusively, then m.glass is the only material that really does glass properly. It allows per-pixel blended transparency, meaning you can have glass with interesting visual features like dirt, cracks, etc. You can use normal maps to further enhance those features, such as making the dirt spots look like lumps instead of simply a 2D stain. The PBR roughness parameter controls how smooth/shiny the glass is, and this too is on a per pixel basis. The emissive parameter can give you nightmode windows. I think it’s really worth the time spent learning how to create with m.glass.
 
If you are working with PBR textures exclusively, then m.glass is the only material that really does glass properly. It allows per-pixel blended transparency, meaning you can have glass with interesting visual features like dirt, cracks, etc. You can use normal maps to further enhance those features, such as making the dirt spots look like lumps instead of simply a 2D stain. The PBR roughness parameter controls how smooth/shiny the glass is, and this too is on a per pixel basis. The emissive parameter can give you nightmode windows. I think it’s really worth the time spen
If you are working with PBR textures exclusively, then m.glass is the only material that really does glass properly. It allows per-pixel blended transparency, meaning you can have glass with interesting visual features like dirt, cracks, etc. You can use normal maps to further enhance those features, such as making the dirt spots look like lumps instead of simply a 2D stain. The PBR roughness parameter controls how smooth/shiny the glass is, and this too is on a per pixel basis. The emissive parameter can give you nightmode windows. I think it’s really worth the time spent learning how to create with m.glass.

Are there any good tutorials to learn that from?
 
Are there any good tutorials to learn that from?
I don’t know of any tutorials about m.glass, but I only needed what was in the Wiki, some practice, and a question or two on the Forum. If I could learn it, anyone can.

And m.notex (meaning “no textures”) is a very basic material that is coded into the mesh file itself and therefore doesn’t use any texture maps (images, normal maps etc.). It’s simply a uniform RGB colour value and some parameters like opacity and specular strength. Computationally very cheap, useful in some circumstances. I’m not sure if it will be supported in future editions of Trainz. Again, refer to the Wiki on m.notex.

Regarding screenshots in forum posts, you cannot “attach” them directly from your own computer. You first need to upload them to some hosting site and from there, copy a link to the uploaded image. Then in your forum post, click on the “insert an image” icon. It is currently the icon to the left of the smiley icon in the post’s toolbar. It looks like a single picture of a mountain. Clicking it will open a dialog box into which you can paste the link. Close the box and the linked image will appear in your post, at the position of your mouse cursor.

On the hosting site you might see a number of different types of link to copy - some types work on the forum, others don’t. The type I always use is called a “direct link”.

There are many third-party image hosting sites (I currently use Imgur.com) but there is also an internal N3V thing called Trainz Gallery. I can’t advise on it because I have never used it, but I’ve seen some recent discussions about it not working correctly.
 
Last edited:
I don’t know of any tutorials about m.glass, but I only needed what was in the Wiki, some practice, and a question or two on the Forum. If I could learn it, anyone can.

And m.notex (meaning “no textures”) is a very basic material that doesn’t use any texture maps (images, normal maps etc.). It’s simply a uniform RGB colour value and some parameters like opacity and specular strength. Computationally very cheap, useful in some circumstances. I’m not sure if it will be supported in future editions of Trainz. Again, refer to the Wiki on m.notex.

Regarding screenshots in forum posts, you cannot “attach” them directly from your own computer. You first need to upload them to some hosting site and from there, copy a link to the uploaded image. Then in your forum post, click on the “insert an image” icon. It is currently the icon to the left of the smiley icon in the post’s toolbar. It looks like a single picture of a mountain. Clicking it will open a dialog box into which you can paste the link. Close the box and the linked image will appear in your post, at the position of your mouse cursor.

On the hosting site you might see a number of different types of link to copy - some types work on the forum, others don’t. The type I always use is called a “direct link”.

There are many third-party image hosting sites (I currently use Imgur.com) but there is also an internal N3V thing called Trainz Gallery. I can’t advise on it because I have never used it, but I’ve seen some recent discussions about it not working correctly.
OK thanks.
 
When you submit a PBR asset with FBX mesh files into Content Manager, it generates .trainzmesh files from the FBX’s and also texture.txt files corresponding to the materials on the mesh. These are configuration files for textures. However, CM only creates basic texture.txt files, so you need to check and update/correct them to ensure they are complete. Or with some experience, you can create them from scratch yourself and place them, along with the FBX files when you first submit the asset to CM. In that case, I think CM accepts your version of the texture.txt files.

For example, a typical PBR parameters file, parameters.png, will have RGB channels for the Primary image plus an Alpha channel. Its corresponding parameters.texture.txt will need to mention both, with lines of text that look like this;

Primary=parameters.png
Alpha=parameters.png
Tile=st

This is telling Trainz to include both the RGB channels and the Alpha channel in the texture, and allow it to be tiled in both the horizontal direction (s) and vertical direction (t).

CM’s initial guess might not mention the Alpha for example, so that’s why you need to manually check and correct them, or create them yourself.

Other types of file that make up PBR materials need different lines in their corresponding texture.txt files. For example, normal map files without Alpha channels have texture.txt’s that look like this;

Primary=normal.png
Tile=st
NormalMapHint=normalmap

I’m sure the Wiki has more on this, but you can also learn a lot from just opening up PBR assets made by other people and looking at the image maps and texture.txt files they use.
 
Last edited:
Ok thanks, I understand that bit now. My txt files are showing alpha so I don't need to mess with that. It keeps saying its a uniform colour and rejecting it. I'm am going to get this sorted, hopefully this year. I'm making some great looking buildings, I just need them to have glass ..

Thanks again, I know, I'm a pain :confused:
 
Changing the colour of just 1 pixel makes it technically non-uniform and kills that error, yet still looks uniform. Patience grasshopper, the journey will have many twists and turns, but may be shorter than you think.
I've currently got no idea how to select and change a single pixel . :unsure:
 
Oh dear, this is becoming a rabbit hole. I should have said “as little as 1 pixel” needs to change colour to make it non-uniform. Or you could simply use a non-uniform image to begin with. That’s any image in which not every pixel has the same RGB value.

The larger point here is that if you are going to make any progress in Trainz content creation, especially with PBR textures, you will need a decent graphics program. One that allows you to;
- manipulate the RGB and Alpha channels of colour images right down to the pixel level.
- handle Layers
- read and save images with formats like 24 bit JPG, 32 bit BMP, TGA and especially PNG.
- operate in different “colour spaces”, namely sRGB and Linear RGB space.

And of course you will need to know how to use the program, a learning curve in its own right.

I happen to use a very old version of Photoshop, so I describe things in Photoshop terms, but there are freeware programs like Paintshop Pro, GIMP, etc. that I think can do the job but they probably use different names for the same things. I hope you can translate what I mean if you don’t have Photoshop.

So! Assuming you have such a program, use its Colour picker tool to sample the uniform colour image. It tells you the RGB values. Let’s say it's a blue with RGB = 100, 150, 200. Now with that colour active, choose the Brush or Pencil tool. Change the RGB a little, for example to 101, 150, 200. Set the brush size to 1 pixel, paint that new colour somewhere in the image and save it. Even such a minimal change will make the uniform image non-uniform.
 
Last edited:
Oh dear, this is becoming a rabbit hole. I should have said “as little as 1 pixel” needs to change colour to make it non-uniform. Or you could simply use a non-uniform image to begin with. That’s any image in which not every pixel has the same RGB value.

The larger point here is that if you are going to make any progress in Trainz content creation, especially with PBR textures, you will need a decent graphics program. One that allows you to;
- manipulate the RGB and Alpha channels of colour images right down to the pixel level.
- handle Layers
- read and save images with formats like 24 bit JPG, 32 bit BMP, TGA and especially PNG.
- operate in different “colour spaces”, namely sRGB and Linear RGB space.

And of course you will need to know how to use the program, a learning curve in its own right.

I happen to use a very old version of Photoshop, so I describe things in Photoshop terms, but there are freeware programs like Paintshop Pro, GIMP, etc. that I think can do the job but they probably use different names for the same things. I hope you can translate what I mean if you don’t have Photoshop.

So! Assuming you have such a program, use its Colour picker tool to sample the uniform colour image. It tells you the RGB values. Let’s say it's a blue with RGB = 100, 150, 200. Now with that colour active, choose the Brush or Pencil tool. Change the RGB a little, for example to 101, 150, 200. Set the brush size to 1 pixel, paint that new colour somewhere in the image and save it. Even such a minimal change will make the uniform image non-uniform.
Ah ok, now I'm with you. I have Gimp so I'll spend some time playing with that. I'm using Blender 4.0 to create the buildings, and they work well together, or so I've heard.
 
I also was having a hard time get the material m.glass to work as desired in game. The solution for me was NOT as simple as having the PBR typical albedo, parameter, and normal textures. While in Blender Shading. I had to add an environmental texture and a separate image texture having the alpha channel. In Editor Type, under the Add, Texture dropdown menu you will file Environmental Texture. Add it and another image texture, which has the alpha channel layer. Noodle connect the Environmental Texture Color to the Subsurface Color of the Principled BSDF, and noodle connect (the colored line) your image (containing the alpha) texture from the Alpha point to the Alpha point of the Principled BSDF. Your albedo texture Color point is noodled to Base Color (my albedo has NO alpha channel), Parameter texture Color to Roughness, and Normal to Color of the Principled BSDF. The albedo texture has just the three basic Red, Green, and Blue layers, with no alpha. The normal texture should be or can be just a completely flat. In my case, it's Red, Green, Blue was R:126, G:125, B:255. My parameter was also just a flat surface with R:99, G:189, B:255. I did have to play with the RGB to get the color transparency as desire.

Note: My albedo, parameter, normal, and environmental textures were all .png type files. My add image texture containing the alpha channel or layer was a .tga file. I use a .tga so I can confirm or make sure the alpha channel is present by using PEV's free Images2TGA Application (Program).

BTW another free imaging or paint program is paint.net. I use it to make my normal textures.
 
I also was having a hard time get the material m.glass to work as desired in game. The solution for me was NOT as simple as having the PBR typical albedo, parameter, and normal textures. While in Blender Shading. I had to add an environmental texture and a separate image texture having the alpha channel. In Editor Type, under the Add, Texture dropdown menu you will file Environmental Texture. Add it and another image texture, which has the alpha channel layer. Noodle connect the Environmental Texture Color to the Subsurface Color of the Principled BSDF, and noodle connect (the colored line) your image (containing the alpha) texture from the Alpha point to the Alpha point of the Principled BSDF. Your albedo texture Color point is noodled to Base Color (my albedo has NO alpha channel), Parameter texture Color to Roughness, and Normal to Color of the Principled BSDF. The albedo texture has just the three basic Red, Green, and Blue layers, with no alpha. The normal texture should be or can be just a completely flat. In my case, it's Red, Green, Blue was R:126, G:125, B:255. My parameter was also just a flat surface with R:99, G:189, B:255. I did have to play with the RGB to get the color transparency as desire.

Note: My albedo, parameter, normal, and environmental textures were all .png type files. My add image texture containing the alpha channel or layer was a .tga file. I use a .tga so I can confirm or make sure the alpha channel is present by using PEV's free Images2TGA Application (Program).

BTW another free imaging or paint program is paint.net. I use it to make my normal textures.
Thanks I'll give that a go.
 
Back
Top