Giter Club home page Giter Club logo

texturereplacer's Introduction

TextureReplacer

logo

TextureReplacer is a plugin for Kerbal Space Program that allows you to replace stock textures and customise your Kerbals. More specifically, it can:

  • replace stock textures with custom ones,
  • assign personalised skin and suit textures for each Kerbal,
  • assign suits based on class and experience level,
  • toggle between EVA suit and IVA suit without helmet in breathable atmosphere,
  • add reflections to parts and helmet visors and
  • change bilinear texture filter to trilinear to improve mipmap quality.

Special thanks to:

  • RangeMachine for contributing reflection shaders and maintaining the mod in my absence.
  • rbray89 who contributed a reflective visor shader and for Active Texture Management and Visual Enhancements where some code has been borrowed from,
  • Tingle for Universe Replacer; studying his code helped me a lot while developing this plugin,
  • taniwha for KerbalStats that was optionally used by this plugin for gender determination and role-based suit assignment,
  • Razchek and Starwaster for Reflection Plugin where I learnt how to implement reflections,
  • sarbian for fixing an issue with non-multiple-of-4 texture dimensions,
  • therealcrow999 for testing and benchmarking this plugin,
  • Ippo343 for contributing KSP-AVC configuration,
  • JPLRepo for contributing DeepFreeze compatibility fixes,
  • Proot, Scart91, Green Skull and others for creating texture packs and
  • Sylith and Scart91 for giving others permissions to make derivatives of their texture packs.

Instructions

General Textures

General replacement textures are of the form

GameData/**/TextureReplacer/Default/<internalName>

where <internalName> is the texture's internal name in KSP or path of a texture inside GameData/ (plus .dds/.png/.jpg/.tga extension, of course).

Examples:

GameData/**/TextureReplacer/Default/
  kerbalHead                              // teeth and male head
  kerbalHeadNRM                           // teeth and male head normal map
  kerbalGirl_06_BaseColor                 // female head
  kerbalGirl_06_BaseColorNRM              // female head normal map

  orangeSuite_diffuse                     // default IVA suit (veteran)
  paleBlueSuite_diffuse                   // default IVA suit (non-veteran)
  orangeSuite_normal                      // default IVA & EVA suit normal map
  whiteSuite_diffuse                      // default EVA suit
  EVAjetpack                              // default EVA suit jetpack
  EVAjetpackNRM                           // default EVA suit jetpack normal map
  EVAjetpackEmmisive                      // default EVA suit jetpack emissive

  ESASuite_diffuse                        // default ESA suit
  ESASuite_normal                         // default ESA suit normal map

  slimSuitDiffuse_white                   // slim suit (white)
  slimSuitDiffuse_orange                  // slim suit (orange)
  slimSuitDiffuse_blue                    // slim suit (blue)
  slimSuitNormals                         // slim suit normal map

  me_suit_difuse_orange                   // vintage IVA suit (veteran)
  me_suit_difuse_low_polyBrown            // vintage IVA suit (non-veteran)
  kerbalMainNRM                           // vintage IVA & EVA suit normal map
  me_suit_difuse_blue                     // vintage EVA suit
  EVAjetpackscondary                      // vintage suit jetpack
  EVAjetpacksecondary_N                   // vintage suit jetpack normal map

  futureSuit_diffuse_whiteOrange          // future IVA suit (veteran)
  futureSuit_diffuse_whiteBlue            // future IVA suit (non-veteran)
  futureSuitMainNRM                       // future IVA suit normal map
  futureSuit_diffuse_orange               // future EVA suit
  futureSuitMainNRM                       // future EVA suit normal map
  futureSuit_emissive                     // future EVA suit emissive
  ksp_ig_jetpack_diffuse                  // future EVA suit jetpack
  EVAjetpackNRM                           // future EVA suit normal map

  kerbalVisor                             // IVA helmet visor
  EVAvisor                                // EVA helmet visor

  cargoContainerPack_diffuse              // Small cargo backpack
  cargoContainerPack_NRM                  // Small cargo backpack normal map
  cargoContainerPack_emissive             // Small cargo backpack emissive

  cargoContainerPack-standalone_diffuse   // Small cargo backpack
  cargoContainerPack-standalone_NRM       // Small cargo backpack normal map
  cargoContainerPack-standalone_emissive  // Small cargo backpack emissive

  Storage_Diffuse                         // Big cargo backpack
  Storage_Normal                          // Big cargo backpack noraml map

  StorageSlim_Diffuse                     // Slim big cargo backpack
  StorageSlim_Normal                      // Slim big cargo backpack normal map

  backpack_Diff                           // Parachute backpack
  backpack_NM                             // Parachute backpack normal map
  canopy_Diff                             // Parachute canopy
  canopy_NR                               // Parachute canopy normal map

  NavBall                                 // HUD & IVA NavBall
  NavBallEmissive                         // HUD & IVA NavBall emissive

  GalaxyTex_PositiveX                     // skybox right face
  GalaxyTex_NegativeX                     // skybox left face
  GalaxyTex_PositiveY                     // skybox bottom face rotated by 180°
  GalaxyTex_NegativeY                     // skybox top face
  GalaxyTex_PositiveZ                     // skybox front face
  GalaxyTex_NegativeZ                     // skybox back face

  moho00                                  // Moho
  moho01                                  // Moho normal map
  Eve2_00                                 // Eve
  Eve2_01                                 // Eve normal map
  evemoon100                              // Gilly
  evemoon101                              // Gilly normal map
  KerbinScaledSpace300                    // Kerbin
  KerbinScaledSpace401                    // Kerbin normal map
  NewMunSurfaceMapDiffuse                 // Mün
  NewMunSurfaceMapNormals                 // Mün normal map
  NewMunSurfaceMap00                      // Minmus
  NewMunSurfaceMap01                      // Minmus normal map
  Duna5_00                                // Duna
  Duna5_01                                // Duna normal map
  desertplanetmoon00                      // Ike
  desertplanetmoon01                      // Ike normal map
  dwarfplanet100                          // Dres
  dwarfplanet101                          // Dres normal map
  gas1_clouds                             // Jool
  cloud_normal                            // Jool normal map
  newoceanmoon00                          // Laythe
  newoceanmoon01                          // Laythe normal map
  gp1icemoon00                            // Vall
  gp1icemoon01                            // Vall normal map
  rockyMoon00                             // Tylo
  rockyMoon01                             // Tylo normal map
  gp1minormoon100                         // Bop
  gp1minormoon101                         // Bop normal map
  gp1minormoon200                         // Pol
  gp1minormoon201                         // Pol normal map
  snowydwarfplanet00                      // Eeloo
  snowydwarfplanet01                      // Eeloo normal map

It's also possible to replace textures from GameData/ if one specifies the full directory hierarchy:

GameData/**/TextureReplacer/Default/
  Squad/Parts/Command/Mk1-2Pod/model000  // Mk1-2 pod texture
  Squad/Parts/Command/Mk1-2Pod/model001  // Mk1-2 pod normal map

Note that all texture and directory names are case-sensitive!

Reflections

Reflections are shown on visors of Kerbals' helmets and on parts that include TRReflection module that can be used like in the following example adding reflections onto the windows of Mk1-2 pod:

MODULE
{
  name = TRReflection
  shader = Reflective/Bumped Diffuse
  colour = 1.0 1.0 1.0
  interval = 1
  meshes = FrontWindow SideWindow
}

There are several parameters, all optional:

  • shader: Most shaders should be automatically mapped to their reflective counterparts. In some cases, however, there are no reflective version of a shader, so you will have to manually specify appropriate shader.
  • colour: Reflection is pre-multiplied by this RGB value before added to the material. 1.0 1.0 1.0 by default.
  • interval: Once in how many steps the reflection is updated. 1 by default.
  • meshes: Space- and/or comma-separated list of mesh names where to apply reflections. Reflection is applied to whole part if this parameter is empty or non-existent. You may find logReflectiveMeshes configuration option very helpful as it prints names of all meshes for each part with TRReflection module into your log.

One face of one reflection cube texture is updated every reflectionInterval frames (2 by default, it can be changed in a configuration file), so each reflective part has to be updated six times to update all six texture faces. More reflective parts there are on the scene less frequently they are updated. interval field on TRReflection module can lessen the update rate for a part; e.g. interval = 2 makes the part update half less frequently.

Personalised Kerbal Textures

Skins and suits are assigned either manually or automatically (configured in the GUI while configuration files can provide initial settings). "Random" assignment of skins and suits is based on Kerbals' names, which ensures the same skin/suit is always assigned to a given Kerbal. Additionally, special per-class suit can be set for each class.

Skin textures reside inside Skins/ directory, each in its own subdirectory:

GameData/**/TextureReplacer/Skins/[<subDir>/]<skin>/
  kerbalHead    // Head texture
  eyeballLeft   // Left eyeball
  eyeballRight  // Right eyeball
  pupilLeft     // Left pupil
  pupilRight    // Right pupil

Directory name should have an extension containing letters that convey additional information about that skin:

  • 'm' male,
  • 'f' female,
  • 'e' hide eyes (for skins that have eyes drawn on texture),
  • 'x' excluded from automatic assignment, can only be assigned manually.

E.g. skin GameData/TextureReplacer/Skins/MySkin.fx will be assigned to females only and only if explicitly selected (by CustomKerbals in a config file or later in the in-game GUI).

Suit textures' names are identical as for the default texture replacement except that class level variants of suit texture are possible. Each suit must reside inside its own directory.

GameData/**/TextureReplacer/Suits/[<subDir>/]<suit>/
  kerbalMain                   // IVA suit (veteran)
  kerbalMainGrey               // IVA suit (level 0)
  kerbalMainGrey1              // IVA suit (level 1)
  kerbalMainGrey2              // IVA suit (level 2)
  kerbalMainGrey3              // IVA suit (level 3)
  kerbalMainGrey4              // IVA suit (level 4)
  kerbalMainGrey5              // IVA suit (level 5)
  kerbalMainNRM                // IVA suit normal map
  kerbalVisor                  // IVA helmet visor

  EVAtexture                   // EVA suit (level 0)
  EVAtexture1                  // EVA suit (level 1)
  EVAtexture2                  // EVA suit (level 2)
  EVAtexture3                  // EVA suit (level 3)
  EVAtexture4                  // EVA suit (level 4)
  EVAtexture5                  // EVA suit (level 5)
  EVAtextureNRM                // EVA suit normal map
  futureSuit_emissive          // EVA suit emissive (future suit only)
  EVAvisor                     // EVA helmet visor
  EVAjetpack                   // EVA jetpack
  EVAjetpackNRM                // EVA jetpack normal map
  EVAjetpackEmmisive           // EVA jetpack emissive

  cargoContainerPack_diffuse   // EVA cargo backpack
  cargoContainerPack_NRM       // EVA cargo backpack normal map
  cargoContainerPack_emissive  // EVA cargo backpack emissive

  backpack_Diff                // EVA parachute backpack
  backpack_NM                  // EVA parachute backpack normal map
  canopy_Diff                  // EVA parachute canopy
  canopy_NR                    // EVA parachute canopy normal map

The veteran and level textures are optional. If a level texture is missing the one from the previous level is inherited. If the veteran texture is present it is used for all levels on veterans.

Directories may optionally have a suffix containing any combination of the following letters (in an arbitrary order):

  • 'm' to make the suit male-only,
  • 'f' to make the suit female-only,
  • 'x' exclude form automatic assignment,
  • 'S' if containing textures for the slim suit model,
  • 'V' if containing textures for the vintage suit model (Making History),
  • 'F' if containing textures for the future suit model (Breaking Ground).

Configuration File

NOTE: All options that can be configured in the GUI are saved per-game and not in the configuration files. Configuration files only provide initial settings for those options.

Main/default configuration file:

GameData/TextureReplacer/@Default.cfg

One can also use additional configuration files; configuration is merged from all *.cfg files containing TextureReplacer { ... } as the root node. This should prove useful to developers of texture packs so they can distribute pack-specific skin/suit assignment rules in a separate file. All *.cfg files (including @Default.cfg) are processed in alphabetical order (the leading @ in @Default.cfg ensures it is processed first and overridden by subsequent custom configuration files).

Normal Maps

Unity uses grey normal maps (RGBA = YYYX) to minimise artefacts when applying DXT5 texture compression on them. When a normal map has a NRM suffix Unity converts it from RGB = XYZ (blue) to RGBA = YYYX (grey) normal map unless it is in DDS format.

In short: you should supply blue normal maps when a texture has NRM suffix and is in PNG format (JPEGs and TGAs are not recommended for normal maps) and grey normal maps for textures in DDS format or without NRM suffix.

Grey normal maps can be created by saving the standard blue normal maps as DDS with DXT5nm compression or by manually shuffling channels: RGBA -> GGGR.

Notes

  • Use DDS format for optimal RAM usage and loading times since DDS textures are not shadowed in RAM and can be pre-compressed and can have pre-built mipmaps.
  • Try to keep dimensions of all textures powers of two.
  • The planet textures being replaced are the high-altitude textures, which are also used in the map mode and in the tracking station. When getting closer to the surface those textures are slowly interpolated into the high-resolution ones that cannot be replaced by this plugin.

Known Issues

  • Switches between suit types (standard, vintage and future) done via stock GUI will only be reflected in TextureReplacer's GUI after the next scene load.
  • (KSP bug) Head meshes have mismatched tangents and/or binormals along the back of the head, where the texture is stitched together.
  • Clouds from EVE are not reflected at certain altitudes.

texturereplacer's People

Contributors

ducakar avatar hebarusan avatar ippo343 avatar tellion avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

texturereplacer's Issues

Compilation issues

Hey there. I wanted to play around with the source code, and noticed that I couldn't invoke Array.Fill with the current libraries (had to revert to foreach); and that the Reload function for the Mapping class appears to not be constructed correctly. Please advise. Thanks!

Backpack UV mapping issue

When using TextureReplacer to replace the backpack, it appears the UV map gets squished to a 1 pixel at the far right of the image. For this test, I created a 2k texture map with the first 2046 columns all white. I tested it in a clean install so should not be due to installation issues given that other textures appear to have imported correctly. This is from my post on your forum from last month, but can provide log files if that may assist.

(https://imgur.com/LLp4oa7)
(https://imgur.com/slvB4RJ)

bug with helmets

after upgrading to 2.4.1 became helmets as in the screenshots
screenshot0
screenshot1

Framerate drop

Using this mod, I built an 8 part rocket, took it off, splashed it down in the water off of KSC. EVA'ed in IVA suit, 110+ FPS. Switched to EVA suit, FPS drops to 20. Switch back, 110 FPS. Removed mod, EVA in EVA suit, same scenario, 110 FPS. There appears to be a huge framerate hit somewhere in what you're doing with the EVA suit.

HeadSettings available in TR

I've noticed that TRR had an option to change eyeball color. Is this available in TR and more specificly can it be available for specific class of Kerbals like for the suits?

I'm kinda confused as why there was a TRR also...

Thanks

Custom suitcombos incorrect texture with TR

TR seems to be mangling custom suits using the recently added stock feature (suitcombo definitions - tested with Phoenix Industries mod). Is there a way to get these working together? Alternatively, would it be possible to introduce an option to have TR don't touch the suits in any way and let it handle the skins only?

Suit mangling in TR 4.5.1 & KSP 1.12.2

There is a break condition that leads to scrambled suits in TR 4.5.1 & KSP 1.12.2. So far I have only seen this with Bill, Bob & Jeb.

  • Fresh install of KSP 1.12.2 & add TextureReplacer (I have v4.5.1 installed via CKAN)
  • Start a save; do not change the faces. Confirm that Suit Personalization is off
  • Go into the Astro complex & change the suits away from default for all 4 Kerbals. Use a different suit model so the Kerbal looks different in the list.
  • Create a test ship & put it on the launch pad. EVA (equip helmet if not equipped) & confirm the suit is what you selected.
  • Recover ship. 
  • Go into Astro complex & note all 4 suits look like the default suit. Click on the hanger to bring up the suit menu & you will see it switch to what you had previously selected.
  • Launch another test ship & EVA. Note again the suit looks normal.
  • Go into VAB & select the Crew tab (add a pod if no ship is loaded). Note that 1 or more of the suits in the list of Kerbals AGAIN look like the default.
  • Select a Kerbal showing a 'default' suit. Launch ship & EVA. Note that suit is corrupted. (pic links below)

Suit back
Suit front

Futuristic Helmet not reading Emissive texture

Take a look at these pictures

https://i.imgur.com/g2Z4RXn.png

as you see I have few places on the suit's front side with emission, this is working, but the same texture is not adding up to helmet

https://i.imgur.com/jDXV1yz.png

the leaf icons on the helmet has conterpart in the emissive texture, but they are not lighting up

https://i.imgur.com/0Ia1ode.png

looks like the helmet is reading the emissive texture from the internal texture in assets file from squad?

ArgumentException: An element with the same key already exists in the dictionary.

ArgumentException: An element with the same key already exists in the dictionary.
at System.Collections.Generic.Dictionary`2[UnityEngine.Shader,UnityEngine.Shader].Add (UnityEngine.Shader key, UnityEngine.Shader value) [0x00000] in :0

at TextureReplacer.Reflections.load () [0x00000] in :0

at TextureReplacer.TextureReplacer.LateUpdate () [0x00000] in :0

(Filename: Line: -1)

Full Log: https://www.dropbox.com/s/o8t53u7hrv5nsi5/output_log11.zip?dl=0

Skybox Will not workin 1.12.2

Ok my skyboxes that i have a 8 year old one for universe replacer works in 1.11.2 and my more recent one for texture replace that is like i dont know how old but there both milky way skyboxes mean the real night but brightend meaning there not what our eyes see
Screenshot_759
this is from 1.11 but it wont in 1.12 i know both them dont work in 1.12 because i tested this one in this ss is a .dds my other one is a .png

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.