Jump to content

KSP2 Part Texturing - Discussion & Resources


benjee10

Recommended Posts

Although I'm holding off on modding proper until we get some more official modding support, curiosity got the better of me and I have started poking at the game to figure out texturing & asset creation techniques for part modding in the future. I thought it would be worth creating a thread for discussion & resources on this. Below are some of my findings, based on my own experience and the work of others who have been hard at work unpicking how the game works.

This is by no means comprehensive & while I have some background in PBR texturing it has not been for Unity or real-time assets specifically, so please do correct any errors you see. 

Most parts seem to be using a modified version of the Unity Standard shader called Standard (Damaged). As expected this is a PBR shader using the MetallicGloss workflow. It has been modified for the purposes of adding the paint feature.

The Channels

Here is a brief breakdown of the maps I've experimented with so far. There are lots of things I haven't explored yet, and frankly have no idea what do. Would be great to get some insight from the devs on how this thing is intended to work. I am using the textures for a WIP T-38 part I am working to illustrate the different maps I've tested. 

Albedo Map, also called baseColour or Diffuse, possibly damageMap as well? Uses suffix _d. RGB map. 

T-38_v1_d.png

MetallicGloss Map, uses suffix _m. This is an RGBA map:

  • RGB controls the Metallicity value of the shader. This should be a b&w map with pure white wherever materials are metallic and pure black where they are non-metallic. There should be no intermediate values; surfaces are either metallic or not. 
  • A - Gloss/Smoothness. This is effectively the shininess of the surface, where black is completely rough/dull and white is completely shiny. This the inverse of a Roughness map, which many other programs use. If you are using Substance Painter it will automatically convert your Roughness channel into a Gloss/Smoothness map (this confused me initially :P )

T-38_v1_m.png 
Note the alpha channel - you may need to open the image in a new tab to see this

Ambient Occlusion Map, uses suffix _ao. Grayscale map.

T-38_v1_ao.png

BumpMap/Normal Map, uses suffix _n. Seems to take openGL normal maps in either a regular blue format or a 'swizzled' AG 'red' format. 

T-38_v1_n.png

Emissive Map, uses suffix _e. Fairly self explanatory, for window lights etc. RGB map. 

T-38_v1_e.png

PaintMask Map, uses suffix _pm. This is what the paint system draws on. It's a packed RGBA map and each channel does something different: 

  • contains the accent color mask. White is paint, black is unpainted. In principle it should be possible to have intermediate values (i.e. semi transparent areas of paint) in the mask but I'm not sure why you would want that, maybe for some subtle wear here and there. The accent paint layer is always drawn on top the base paint mask. 
  • is the base colour mask. Works the same way as the accent colour mask but is drawn below. 
  • is a dirtMap for the paint. It gets multiplied over the colours the user chooses, so you can add wear/grime to this and it will darken the paint so it isn't all one perfect color. 
  • is a smoothnessMap for the paint. It seems like this can be toggled on/off in the shader settings and not all parts make use of it. I haven't experimented with this yet but am assuming it completely overrides the smoothness values of the paint layer. By default it uses the smoothness from the metallicGloss map. 

T-38_v1_pm.png

And this is how all these maps should come together:

Screen_Shot_2023-03-20_at_21.55.41.png  Painted

Screen_Shot_2023-03-20_at_21.55.55.png  Unpainted

Creating the maps

If you are familiar with a PBR workflow, creating most of the above should be fairly standard. You can take a peak at the values the stock parts use to match them. From what I've seen, base albedo for metallic parts seems to be about 0.72, and smoothness about 0.8, but YMMV and things may change with development. 

Creating the paintMask texture is a bit more challenging, since those are not standard PBR maps. In Substance Painter you can generate this map by making user of the user configurable channels. I have created a couple of Substance Painter presets that you can make use of, a project setup preset and an export preset. They use user channels 0-3 as pm Accent, pm Base, pm Dirt and pm Smooth respectively, as shown here: 

Screen_Shot_2023-03-21_at_22.47.26.png

The export preset - Kerbal Space Program 2 - Standard (Damaged) - will give you albedo (_d), metalGloss (_m), emissive (_e), normal (openGL format for now, _n) and paintMask (_pm). 

These are both works in progress and I intend to keep updating them, but hopefully they will be some use to you. 

Previewing paintMask

As the paintMask does not use standard maps or a standard shader, it is not possible to preview it in Unity or in Substance Painter. The best thing to do when painting the maps I have found is to work on a separate layer using a mask, with the colour & metallic channel turned on, and then turn off the colour & metallic channels for that layer before export. 

To check your maps work correctly, you can use Blender. Here is a node setup for previewing the results of your export:

Screen_Shot_2023-03-21_at_23.17.55.png

I will add a downloadable version of this to the drive link above once we've figured out exactly what's going on with normal maps. 

Test Results

@Kemorno was kind enough to help me validate these maps by getting one of my models in-game and providing some tools for manipulating shader values in flight. As mentionned, normal maps are not working correctly yet, so these are without them: 

t38-1.png

With default paint scheme

t38-2.png

Paint opacity set to zero

t38-3.png

Zesty

As you can see the paint map is working as expected! There are some tweaks required to match the look of stock parts but these are purely artistic changes.  

Would love to know what others have figured out and any resources you make use of. I'll try to keep the OP updated with discoveries/useful recourses & let me know if I've made any errors! 

Resource Links

Texture Utilities eXpanded

Substance Painter Presets

Standard Shader material charts

Edited by benjee10
Link to comment
Share on other sites

Stunning! I'm excited to see what artists are able to do with this game!
Btw for anyone who wants to use TUX, its still WIP, progress can be found on the KSP Modding discord!

Edited by Kemorno
Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
On 6/28/2023 at 5:06 PM, cvusmo said:

Lifesaver. Finally understand how this works. Thank you for the preset!

I'm not sure what's happened or why a model I've made doesn't want to apply the paintmap properly.

 

[With _pm]
image.png

Without a _pm

image.pngimage.pngimage.png


I can't figure it out. Not sure what I've done wrong or how I get the paintmap to function properly. It's like _d prevents it from being painted since it's #1 in the hierarchy in substance painter. I'm extremely new to this. Curious if anyone has a fix?

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...