Sunday, February 18, 2018

Update on PBR

 
After reading some more on PBR I found a mistake I was doing.
 
The paint textures should use RGB numbers from 30 to 240. That is RGB of (0,0,0) is no good should be (30,30,30) or (50,50,50) for dark colors. For light (255,255,255) is bad, (240,240,240) is good.
The number do not have to be the same, (30,45,76) is also good just do not go under 30. Same with light colors do not go over 240.

Note: you may need to use 255 on things like railheads, wheel treads, or other highly polished metals.
 
Why? On the dark colors you need the 0-30 for shadows and on light you need 15 for highlights.
This has been the same in Trainz form day one, a black loco using an RGB of (0,0,0) shows no detail and looks bad. For light colors I had to use RGBs of (230,230,230) for a white car to look right.
 
 
Note: I have updated to Blender 2.79 today and so far no changes needed.

Wednesday, February 14, 2018

Things to look out for in FBX

 

First in your config.txt the mesh should be name.trainzmesh look out for typos, .trinsmesh or .trainmesh will not work.
 
 
Remember the FBX file has your mesh in it and can be opened and used, so delete it before you make your CDP.
 
 
From Blender, check your size on export, default is like 10x bigger.
 
From Blender, check that you have Y forward and Z up.
 
From Blender, when you export to FBX everything exports, all layers, all hidden, and all cameras and lights. (This has been fixed in Blender 2.79a to work the same as XML)
 
FBX only works at trainz-build  4.5 and up.
 
PBR only works in FBX and trainz-build  4.6 and up.


Saturday, February 10, 2018

 

m.pbrmetalmasked
 
 
This is the same as m.pbrmetal but adds an Alpha Channel to the paint texture in slot 1.
 
This is used for making holes or hiding part or all of the mesh. This is what you use to make the mesh part for ANR, replaces m.onetex . Note there is a bug in build 91493, if you use ANR with m.onetex and use m.glass your ANR number will show up on the glass part.
 
Have used for making self-cleaning gratings.
 
Made the same as m.pbrmetal but with Alpha for transparency.
 
 
m.glass
 
 
This is used for making glass. I used it to make window glass, it has the same set up as m.pbrmetalmasked.
It uses the same 3 Textures as m.pbrmetalmasked. No idea what is deferent. For glass windows you do not need most of the data it can have, my normal and bump maps are flat.

Here are what I used:
slot1:
 
slot2:
 
slot3:
 
 
Other ones m.pbrmetaldetail and m.clutter. I have not used.
  

Friday, February 9, 2018

 

How to Make the Texture

in the last post

 

The following uses Photoshop CS6 but other paint programs should work.
 
Two things you need first:
 
1. A UV map of the mesh:
 
2. A AO map, (Ambient Occlusion) you Bake this from mesh:
 
 
I start with the UV map and the AO map open in PS. Duplicate the AO map layer to the UV map so you have two layers, close the AO map.
 
 
 

 
Note that the layer is named Background and locked.
 

Next change the Background Layer to a Channel, this unlocks it.
 
 
Now add one more Layer and move it to the bottom.
 
I have renamed the layers and made the AO one active and visible and added an Alpha Channel.
 
Next you need to get the AO map into the Blue Channel. Start with the above and go to Channels.
 
Now you fill with black, it should look like this:
 
Do the same with Green Channel.
 
Here you see the AO map is now in the Blue Channel but it should have a white background, Color Select black and fill with white.
 
 
 
 
 

Next set up Layers like this:

 
Then like this:

Channel like this:

Fill with white or gray:
 
 
Channels look like this.
 
Do the same with other the other Channels. Turn off the UV map or delete it.
 

Tuesday, February 6, 2018

PBR setup

Part 1

name.m.pbrmetal

 texture.005 This is all new and all just data so it will look odd.

 
 
You must use Hardness or none of it will work, do not know if Intensity worked or not.
 
 
 
This is the hard one to make. The RGB channel is not used as is.
 
Red Channel is Emissive this is not a light but it keeps the same color in daylight as at night.
 
Only time of day changed.
 


Green Channel is Roughness this is shiny or dull. Not a lot of control that I can see, more one or the other.
 
Blue Channel is your AO map.
 
Alpha Channel is Metallicity that is, is it shiny metal or not.
 
All of the wheels and axles have just one material, the wheels treads have the Green Channel set to black and Alpha Channel set to white.
 
 
 


Monday, February 5, 2018

PBR setup

Part 1

name.m.pbrmetal

 

texture.004 is the normal and bump. The normal gives an angle and the bump the displacement. The bump is in the Alpha channel and is in gray scale only.

 

 
Set to Normal in Blinder.
 
 
The RGB part is the same normal map we have been making. The Alpha channel has a new use, how high or low it should look, white is max. up and black is max. down.

To do this turn on the Alpha so it is visible and active. In the above it is not visible or active, the RGB is, you need all visible and only Alpha active, then you can paint over your normal line.

 
Here you can see only one panel line has a black line in the Alpha channel.
 

This also gives you parallax that make the flat mesh look like it had deep indent.




 



PBR setup

name.m.pbrmetal

 
 
This is used for painted metal, wood, or plastic. It is made up of 3 textures.
 
 
 
 
On the right you see the 3 textures named
 
texture.003
texture.004
texture.005
 
Blender makes up the names shown but you can re-name them. I think the order is important and is what 3D Max uses as slots.
 
 
texture.003 has the color and is almost the same as the old way but has no Alpha channel.
 
 
 
All you need to set in Blender is "Color".
 
 
This is what a RGB texture looks like as Channels.
 
to be cont. 


Sunday, February 4, 2018

 

FBX and PBR
 
 
FBX works in trainz build 4.5 and up, PBR only in 4.6 and has to be in FBX. The Wiki has most of how to export FBX from Blender, animation is not done yet, only some things work.
 
Things to look out for when exporting is the size and Y forward, the default is 10x size and -Z forward. Also Blender(2.78) will export everything on all layers and hidden, this includes cameras and lights.
 
 
 
 
On the left is a car made with IM and old materials on the right is FBX and PBR. The bogeys are both FBX and PBR. This is in Surveyor of the Developer build witch is not final. Both cars have ANR, LOD and animated wheels.
 
What PBR lets you do is have shiny and dull parts on the same material. The old way you would need to have separate material for each.
 
Each PBR material is made of three textures(number varies). This will take some getting us to as must of the textures are data and do not look like anything and they use channels for data so you need to be able to edit texture channels, something most have not done.
 
I well be doing some of them one at a time.