Shaders, Shading, Shadows?

All about making tracks for MX Simulator
Post Reply
ColtonD719
Posts: 631
Joined: Tue Jun 21, 2016 4:15 am
Team: Privateer
Location: Oregon
Contact:

Shaders, Shading, Shadows?

Post by ColtonD719 »

Hi all,

Forgive me if this is documented somewhere, but I've scoured the boards and have only been able to gather a vague idea of how lighting works in the game, specifically in regards to how the track itself appears.

Primarily, I'd like to know what exactly the difference is between shading.ppm, shadingx2.ppm, and shadows.pgm, and what the purpose is for each. Ultimately, I'd love to know any best practices for shading the terrain in my tracks.



Below are my notes for each file. I haven't tested all these thoughts; much of it has been gathered from pieces here and there in the forum. Please correct me where I'm wrong, and feel free to clarify!

shading.ppm - From what I've gathered, this defines the primary shading of the terrain. It can be generated by the game from the info in the lighting file, and terrain.png, as well as any terrain edits made in the track editor. I assume if you play with erode turned on, this file is updated by the game based on the terrain deformation (though the updates are discarded if the track is not saved). I am also able to edit this file directly in Photoshop, etc. However, this can cause matching issues if the game tries to update parts of the map (like if I make terrain edits in the editor, or, I assume, if erode is turned on). Does this mean I should avoid editing this file directly?

shadingx2.ppm - Similar to shading.ppm, but now intended for people playing with the shaders graphics option turned off. This file is ignored for tracks with dynamic lighting when shaders are turned on. Otherwise, it appears in game as a layer in "Overlay" blending mode. When generated by the game, and in most open tracks I've looked at, it is essentially a half-brightness version of shading.ppm. I am very unclear on the purpose of this file.

shadows.pgm - A grayscale image usually used to define the shadows of objects (i.e, statues and billboards) on the terrain. This does not seem to be generated or updated by the game. It seems to appear in game as a layer in "Multiply" blending mode. I've noticed some tracks ignore this file, and have object shadows placed in their shading.ppm/shadingx2.ppm files. It seems to work fine in game, but I assume it might cause problems if, say, erode was turned on and the game started overwriting the shading in those areas. I'm guessing keeping the shadows in this separate file would prevent such problems?



I come from the old MCM2 days where we put our textures and shadows all in one big image. I'm trying to get my head around the MXS system, which is much more complex, but seems to allow for lots of new possibilities. Any links or explanations would be much appreciated!

Thanks!
ColtonD719
Posts: 631
Joined: Tue Jun 21, 2016 4:15 am
Team: Privateer
Location: Oregon
Contact:

Re: Shaders, Shading, Shadows?

Post by ColtonD719 »

Now that I've been working with them more, I think I'm getting a handle on how these things work.

It appears that with shaders turned on in the graphics settings, shading.ppm gets updated essentially in real time. So, any external editing I do to this file gets replaced with the game's shading. So, I should leave this file alone and let the game do it's thing, based on my lighting file.

Is shadingx2.ppm only for those running the game without shaders?

shadows.pgm seems to be the way to go if I want to do any lighting tweaks, such as ray cast shadows, etc. In game it blends nicely with shading.ppm, taking on the color of the ambient light in the shadows. I've also noticed that it casts a shade over decal norms, essentially hiding their effect. This totally makes sense, but is interesting to note nonetheless. It also works nicely with erode turned on, as it appears unaffected by the changing terrain.
Post Reply