Jump to content

Modders Notes 1.9.0


JPLRepo

Recommended Posts

Here’s some notes and details from the team with regards to the changes that come with KSP  1.9.0

Atlas Terrain Shader (Ultra Detail Shader)

Quick Guide:

I want to use the fancy new shader on a celestial body that doesn't support it. Teach me how!

1. (Offline) Create a texture map detailing the texture indices and strengths of the textures to be shown on the celestial body. (Rules are provided below.)

2. (Runtime) Find the PQS component for the celestial body that you want to change the shader on. Create a new GameObject, attach a PQSMod_TextureAtlas component to it, then parent the new game object to the PQS object.

3. (Runtime) Use ScriptableObject.CreateInstance<CBTextureAtlasSO>() to create a new CBTextureAtlasSO object, then call CBTextureAtlasSO.CreateMap(MapSO.MapDepth.RGB, texture) using the texture created in step 1 to use your texture map. Assign the new CBTextureAtlasSO object to the textureAtlasMap variable of the PQSMod_TextureAtlas component created in step 2. This will ensure that your texture map is used to specify the positions of the textures on the surface of the celestial body.

4. (Runtime) Create Texture2DArray objects of the textures and the normal maps to be used in the material by using KSPUtil.GenerateTexture2DArray(int textureSize, List<Texture2D> textureList, TextureFormat format, bool createMipMaps). Information about the operation can be found here: https://docs.unity3d.com/ScriptReference/Texture2DArray.html

5. (Runtime) Create a new material using the command new Material(Shader.Find("Terrain/PQS/PQS Triplanar Zoom Rotation Texture Array")) and assign the Texture2DArray objects created in step 4 to the _AtlasTex and _NormalTex properties of the material. Fill in the other properties on the material as desired.

6. (Runtime) Assign the new material to both the highQualitySurfaceMaterial and the surfaceMaterial variables of the PQS component for the celestial body. The PQSMod_TextureAtlas component will ensure that all the necessary data is transferred across to the shader when the planetary surface is displayed.

I like your textures! I only want to change where they're used on Kerbin!

We appreciate the compliment! Just do steps 1 and 3 in that case.

I think that you did an excellent job with the way that the textures are mapped to the biomes on Kerbin! I only want to change the actual textures!

You're going to make us blush if you keep flattering us! Just do steps 4 to 6.

Texture Map Authoring Rules:

Two textures per pixel and the strength of each can be specified so that the artist can control blends between the textures. This is done through an RGB texture (the alpha channel isn't used) with the following rules:

R: This value corresponds to the texture array index of the first texture. We multiply the texture index value by 10 to avoid errors and make it easier to author, so array index 0 will be 0, array index 1 will be 10, array index 2 will be 20, and so on.

G: This value corresponds to the relative strength of each of the textures. So a full value of 255 means that it will only display the texture referenced in R, a value of 127 means that it will display half of the texture referenced in R and half of the texture referenced in B, and a value of 0 means that it'll only display the texture referenced in B, for example. It blends between the values, so use whatever strength makes the most sense for a nice blend between textures!

B: This value corresponds to the texture array index of the second texture. We multiply the texture index value by 10 to avoid errors and make it easier to author, so array index 0 will be 0, array index 1 will be 10, array index 2 will be 20, and so on.

A: Not used, so don't create an alpha channel.

Other Items

KSP now uses only one single camera rendering in DX11. Due to improvements done by Unity with regard to rendering using DX11 (Z order reversal amongst other things) KSP now only uses “Camera 00” when rendering in flight, mapview, tracking station and KSC scenes. This improves performance significantly and exponentially depending on what graphics settings you are using. We are unable at this time to do single camera rendering on OpenGL platforms.

 

Added Per Kerbal PhysicMaterial Accessors for Modders so you can adjust each kerbals bounciness using KerbalEVA.SetPhysicMaterial, KerbalEVA.ResetPhysicMaterial.

 

The KSP Assembly version is now set correctly on game start so KSPAssemblyDependency will work for KSP versions.

 

Added events for Action Groups in flight visibility changes so mods can handle any UI changes they need to in each mode.

onGUIActionGroupFlightShowing - Fired when the Action Group Editor is about to open in flight.

onGUIActionGroupFlightShown - Fired when the Action Group Editor is finished opening in flight.

onGUIActionGroupFlightClosed - Fired when the Action Group Editor is closed in flight.

 

Added Pause/UnPause events when the action groups show/hide in flight.

Fires OnGamePause and OnGameUnpause.

 

Fix PQS.radiusMax not including some noise PQSMods in its calculations. Should now mean that PQS.radiusMax is no longer below any vertex in most cases.

 

New PartModule called ModuleResourceDrain for the new stock resource drain part can be used like any other PartModule by modders.

Link to comment
Share on other sites

6 hours ago, zer0Kerbal said:

so now that /SquadExpansions/xxx/Ships/xxx is a thing - does that mean KSP will look for .craft files elsewhere in GameData?

Ooof... wait... I still have issues figuring out which place to put .craft files, when adding them to my game... since KSP has /KSP_<install/Ships/, *and* /KSP_<install>/saves/Ships/ ... :P vOv

Link to comment
Share on other sites

10 hours ago, Stone Blue said:

Ooof... wait... I still have issues figuring out which place to put .craft files, when adding them to my game... since KSP has /KSP_<install/Ships/, *and* /KSP_<install>/saves/Ships/ ... :P vOv

first one is for the training ships / second one is for player ships. the first one can show in the second one if a check box is checked in the game settings tab IIRC.

Link to comment
Share on other sites

  • 2 weeks later...
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...