Electrocutor

Electrocutor's Thread

Recommended Posts

On 9/6/2018 at 6:53 PM, IMLL1 said:

What's the difference between the Original Stock TU Patch and the Stock Prokjet TU Configuration File? Also, why do IVA and internal overlay not work with these patches?


 

The IVA issue is because there are some meshes that need to be excluded that I forgot don't exist unless the IVA overlay is turned on.

Originally, the porkjet config was much more complete whereas the original stock cfg was just a blanket for all the stock parts without much time or thought put in.

 

At this point, you can ignore these because the stuff @Manwith Noname provides is a much more polished thing.

Patch 1.5 is going to cause some havoc on all this stuff, so I'm not keen to work on this further until it's out. After which, I'll start working on some TU stuff again (this time with prior author permission).

  • Like 2

Share this post


Link to post
Share on other sites
19 hours ago, Electrocutor said:

The IVA issue is because there are some meshes that need to be excluded that I forgot don't exist unless the IVA overlay is turned on.

 Originally, the porkjet config was much more complete whereas the original stock cfg was just a blanket for all the stock parts without much time or thought put in.

 

At this point, you can ignore these because the stuff @Manwith Noname provides is a much more polished thing.

Patch 1.5 is going to cause some havoc on all this stuff, so I'm not keen to work on this further until it's out. After which, I'll start working on some TU stuff again (this time with prior author permission).

Does the recolor pack allow for regular colors but still shininess?

Share this post


Link to post
Share on other sites
4 hours ago, IMLL1 said:

Does the recolor pack allow for regular colors but still shininess?

As long as you select your 'regular colors' -- sure.  I cannot speak to what the default for any part are -- but the system is extremely configurable to get nearly any color/shiny/metal-ness look you want.

Share this post


Link to post
Share on other sites
6 hours ago, Shadowmage said:

As long as you select your 'regular colors' -- sure.  I cannot speak to what the default for any part are -- but the system is extremely configurable to get nearly any color/shiny/metal-ness look you want.

Ok. Thanks very much!

Share this post


Link to post
Share on other sites

I've updated my PartVariant Guide.

I'm curious for some feedback: would you guys like me to fix the new shiny parts in stock? There is a bug where they forgot to hook up the reflections during flight, so anything that uses the new shader only looks right in the VAB/SPH. I would hope/imagine this will be fixed in a hotfix or something, but if people are impatient I can toss a reflection probe into the dx11 fix so that those parts will at least work for now (only takes about 5 lines of code).

Edited by Electrocutor

Share this post


Link to post
Share on other sites
2 minutes ago, Electrocutor said:

reflection probe into the dx11 fix

Be careful -- the probes don't by default work well with KSPs layered/multi-camera rendering -- things will look odd unless you do some hacks to get all the layers to render properly (e.g. atmosphere will be rendered in wrong place or orientation, skybox not present, z-fighting on the planets when in orbit... all sorts of fun).

Share this post


Link to post
Share on other sites
Just now, Shadowmage said:

Be careful -- the probes don't by default work well with KSPs layered/multi-camera rendering -- things will look odd unless you do some hacks to get all the layers to render properly (e.g. atmosphere will be rendered in wrong place or orientation, skybox not present, z-fighting on the planets when in orbit... all sorts of fun).

It would be a quick fix, mostly to help get the light levels and specular working: the accuracy of the reflections would not be a priority.

  • Like 1

Share this post


Link to post
Share on other sites

Okay, I updated the dx11 fix to also include a reflection probe for now. It's very bare-bones and only includes:

List<KSPLayer> oLayers = new List<KSPLayer>() {
	KSPLayer.Atmosphere,
	KSPLayer.LocalScenery,
	KSPLayer.ScaledScenery,
	KSPLayer.ScaledSpaceSun,
	KSPLayer.SkySphere,
	KSPLayer.Water
};
Spoiler

Before:

6YtSfae.jpg

After:

gKirzCy.jpg

 

Edited by Electrocutor

Share this post


Link to post
Share on other sites

I've added an UnofficialPatch to the OP. I have a lot more it is doing locally, but will only include the things that are mostly bug-free for releases.

 

If someone wants to take some time to check the attachment nodes and rotations for all the stock parts and note any that are wrong, let me know and I will include those fixes into an optional add-on. I don't want them forced because it would break a lot of the stock craft files.

Edited by Electrocutor
  • Like 1

Share this post


Link to post
Share on other sites

> Stock Prokjet TU Configuration File

Porkjet? Projekt?

Edited by Waz

Share this post


Link to post
Share on other sites
1 hour ago, Waz said:

> Stock Prokjet TU Configuration File

Porkjet? Projekt?

You know how long that has been there and I never noticed!

I'll need to redo the cfg's for @Shadowmage new shader; plus it will be much easier to fully support recoloring now. I can also target any of the stock parts that now have a 'White' variant for the same.

  • Like 2

Share this post


Link to post
Share on other sites

UnofficialPatch Updated

  • Improved logic on dx11 shader replacement
  • Greatly improved reflectionprobe fix
    • I am working on getting it to also work with EVE and Scatterer since neither work the same as stock.
Edited by Electrocutor

Share this post


Link to post
Share on other sites
On 10/19/2018 at 11:08 PM, Electrocutor said:

UnofficialPatch Updated

  • Improved logic on dx11 shader replacement
  • Greatly improved reflectionprobe fix
    • I am working on getting it to also work with EVE and Scatterer since neither work the same as stock.

Thanks for the patch!  Noticed that when running Indicator Lights, the Science Jr. currently has a case of Schrodinger's doors in the VAB... are you also seeing this?

MvWRPDY.png

Edited by Chimichanga
  • Like 1

Share this post


Link to post
Share on other sites
28 minutes ago, Chimichanga said:

Thanks for the patch!  Noticed that the Science Jr. currently has a case of Schrodinger's doors in the VAB... are you also seeing this?

 

No, it must be coming from something else you have.

0srG8Rv.jpg

 

Edited by Electrocutor

Share this post


Link to post
Share on other sites

There must be a conflict going on then, because when I removed the UnofficialPatch folder it's fine, but with UnofficialPatch the doors double up... any ideas where to look? I'm about to load up a game without any mods except your patch, will update again soon.

EDIT: Definitely a conflict, just the UnofficialPatch by itself isn't causing this... will investigate further.

Edited by Chimichanga

Share this post


Link to post
Share on other sites
6 minutes ago, Chimichanga said:

There must be a conflict going on then, because when I removed the UnofficialPatch folder it's fine, but with UnofficialPatch the doors double up... any ideas where to look? I'm about to load up a game without any mods except your patch, will update again soon.

EDIT: Definitely a conflict, just the UnofficialPatch by itself isn't causing this... will investigate further.

Would likely be something that does the same thing as this patch for some reason: like how VSR does.

Edited by Electrocutor

Share this post


Link to post
Share on other sites
1 hour ago, Electrocutor said:

Would likely be something that does the same thing as this patch for some reason: like how VSR does.

The conflict is with Indicator Lights

 

Here's the relevant (I hope) module manager config for that part from IL:

@PART[science_module]
{
	// We have to re-specify the model for the stock part, because this is
	// an older part that uses the "mesh =" syntax in its .cfg file instead
	// of the newer "MODEL" syntax. The "mesh =" syntax doesn't allow having
	// multiple models as part of the same part, which would prevent this mod
	// from adding meshes for the indicator lights.
	MODEL
	{
		model = Squad/Parts/Science/MaterialBay/science_module_small
	}


	//-------------------------------------------------------------------------
	// INDICATOR MESHES
	//-------------------------------------------------------------------------

	MODEL
	{
		model = IndicatorLights/Meshes/squareLamp
		scale = 1, 0.4, 0.5
		position = 0, -0.34833, -0.49839
		rotation = 0, 180, 0
	}
	
	MODEL
	{
		model = IndicatorLights/Meshes/squareLamp
		scale = 1, 0.4, 0.5
		position = 0, -0.34833, 0.49839
		rotation = 0, 0, 0
	}
	

	//-------------------------------------------------------------------------
	// CONTROLLABLE EMISSIVES
	//-------------------------------------------------------------------------

	// The add-on meshes that we use to show science content, availability, etc.
	MODULE {
		name = ModuleControllableEmissive
		target = IndicatorLights/Meshes/squareLamp
		emissiveName = indicator
	}

	// The bluish-glowing center part (from the original model)
	MODULE {
		name = ModuleControllableEmissive
		target = Glass
		emissiveName = frontPanel
	}

	// The orangey-glowing side parts (from the original model)
	MODULE {
		name = ModuleControllableEmissive
		target = DoorAssembly
		emissiveName = sidePanels
	}


	//-------------------------------------------------------------------------
	// CONTROLLERS
	//-------------------------------------------------------------------------

	// These first two controllers take care of the add-on meshes.
	MODULE {
		name = ModuleScienceDataIndicator
		emissiveName = indicator
		dataColor = $HighScience
		partialDataColor = $MediumScience
		lowDataColor = $LowScience
		emptyColor = ModuleScienceAvailabilityIndicator
		lowScienceThreshold = 0.25
		highScienceThreshold = 0.8
	}

	MODULE {
		name = ModuleScienceAvailabilityIndicator
		lowScienceThreshold = 0.25
		highScienceThreshold = 0.8
	}

	// Make the blue glowy part pulsate slowly when it has science.
	MODULE {
		name = ModuleScienceDataIndicator
		emissiveName = frontPanel
		dataColor = pulsate(#00FFFF, 2800, 1, 0.4)
		emptyColor = #004040
	}

	// Make the orange glowy part pulsate quickly when it has science.
	MODULE {
		name = ModuleScienceDataIndicator
		emissiveName = sidePanels
		dataColor = pulsate(#FF8000, 777, 1, 0.7)
		emptyColor = #804500
	}
}

I'm guessing it's double-dipping on the mesh/model change.

To anyone running both IL and this patch, the fix is to edit StandardizeModels.cfg, find this section and comment it out:

//@PART[science_module]:NEEDS[Squad]:FIRST {
//	-mesh = DELETE
//	MODEL {
//		model = Squad/Parts/Science/MaterialBay/science_module_small
//	}
//}

 

Edited by Chimichanga

Share this post


Link to post
Share on other sites

One more conflict issue concerning MissingHistory and  PorkJet remodels of the LV-909 Terrier, T45 Swivel, and T30 Reliant engines... they have a shell/shroud around them.  Fix is identical to the above post, comment out the lines in StandardizeModels.cfg,

jfuMqzA.png

Edited by Chimichanga

Share this post


Link to post
Share on other sites
2 hours ago, Chimichanga said:

The conflict is with Indicator Lights

 

Here's the relevant (I hope) module manager config for that part from IL:


@PART[science_module]
{
	// We have to re-specify the model for the stock part, because this is
	// an older part that uses the "mesh =" syntax in its .cfg file instead
	// of the newer "MODEL" syntax. The "mesh =" syntax doesn't allow having
	// multiple models as part of the same part, which would prevent this mod
	// from adding meshes for the indicator lights.
	MODEL
	{
		model = Squad/Parts/Science/MaterialBay/science_module_small
	}


	//-------------------------------------------------------------------------
	// INDICATOR MESHES
	//-------------------------------------------------------------------------

	MODEL
	{
		model = IndicatorLights/Meshes/squareLamp
		scale = 1, 0.4, 0.5
		position = 0, -0.34833, -0.49839
		rotation = 0, 180, 0
	}
	
	MODEL
	{
		model = IndicatorLights/Meshes/squareLamp
		scale = 1, 0.4, 0.5
		position = 0, -0.34833, 0.49839
		rotation = 0, 0, 0
	}
	

	//-------------------------------------------------------------------------
	// CONTROLLABLE EMISSIVES
	//-------------------------------------------------------------------------

	// The add-on meshes that we use to show science content, availability, etc.
	MODULE {
		name = ModuleControllableEmissive
		target = IndicatorLights/Meshes/squareLamp
		emissiveName = indicator
	}

	// The bluish-glowing center part (from the original model)
	MODULE {
		name = ModuleControllableEmissive
		target = Glass
		emissiveName = frontPanel
	}

	// The orangey-glowing side parts (from the original model)
	MODULE {
		name = ModuleControllableEmissive
		target = DoorAssembly
		emissiveName = sidePanels
	}


	//-------------------------------------------------------------------------
	// CONTROLLERS
	//-------------------------------------------------------------------------

	// These first two controllers take care of the add-on meshes.
	MODULE {
		name = ModuleScienceDataIndicator
		emissiveName = indicator
		dataColor = $HighScience
		partialDataColor = $MediumScience
		lowDataColor = $LowScience
		emptyColor = ModuleScienceAvailabilityIndicator
		lowScienceThreshold = 0.25
		highScienceThreshold = 0.8
	}

	MODULE {
		name = ModuleScienceAvailabilityIndicator
		lowScienceThreshold = 0.25
		highScienceThreshold = 0.8
	}

	// Make the blue glowy part pulsate slowly when it has science.
	MODULE {
		name = ModuleScienceDataIndicator
		emissiveName = frontPanel
		dataColor = pulsate(#00FFFF, 2800, 1, 0.4)
		emptyColor = #004040
	}

	// Make the orange glowy part pulsate quickly when it has science.
	MODULE {
		name = ModuleScienceDataIndicator
		emissiveName = sidePanels
		dataColor = pulsate(#FF8000, 777, 1, 0.7)
		emptyColor = #804500
	}
}

I'm guessing it's double-dipping on the mesh/model change.

To anyone running both IL and this patch, the fix is to edit StandardizeModels.cfg, find this section and comment it out:


//@PART[science_module]:NEEDS[Squad]:FIRST {
//	-mesh = DELETE
//	MODEL {
//		model = Squad/Parts/Science/MaterialBay/science_module_small
//	}
//}

 

In fact the fix should be on indicator lights: the MM file should be:

-mesh = DELETE
%MODEL
{
	%model = Squad/Parts/Science/MaterialBay/science_module_small
}

to avoid conflicts with mods that might change the model. the second one shouldn't use % or @ because they want to absolutely add it, whereas the default model should only be added/updated if it doesn't exist already. it's fine though: there are a lot of MM config that's a based on singular mod implementation instead of being designed for cross-mod capability. just one of the things you have to mess with when you build a modded setup.

 

Ideally, people will catch onto the UnofficialPatch and then don't have to worry about it anymore, merely setting up their own cfg's as :NEEDS[UnofficialPatch]

Edited by Electrocutor
  • Like 1

Share this post


Link to post
Share on other sites

In case anyone is interested, here is the fix for the shiny shader and the part I am currently working on:

Spoiler

using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

namespace UnofficialPatch
{
    public class FixReflections
    {
        private EventData<GameEvents.HostedFromToAction<Vessel, Vessel.Situations>>.OnEvent VesselSituationChangedEvent;

        public void Start()
        {
            this.VesselSituationChangedEvent = new EventData<GameEvents.HostedFromToAction<Vessel, Vessel.Situations>>.OnEvent(VesselSituationChangedEventHandler);
            GameEvents.onVesselSituationChange.Add(this.VesselSituationChangedEvent);
        }

        private void VesselSituationChangedEventHandler(GameEvents.HostedFromToAction<Vessel, Vessel.Situations> oSituation)
        {
            if (oSituation.host == null)
            { return; }

            UpdateProbe(oSituation.host, oSituation.to);
        }

        private void UpdateProbe(Vessel oVessel, Vessel.Situations oSituation)
        {
            ReflectionProbe oProbe = null;
            List<KSPLayer> oLayers = new List<KSPLayer>();

            oProbe = oVessel.gameObject.GetComponent<ReflectionProbe>();

            if (oProbe == null)
            {
                oProbe = oVessel.gameObject.AddComponent<ReflectionProbe>();

                oProbe.mode = UnityEngine.Rendering.ReflectionProbeMode.Realtime;
                oProbe.refreshMode = UnityEngine.Rendering.ReflectionProbeRefreshMode.EveryFrame;
                oProbe.timeSlicingMode = UnityEngine.Rendering.ReflectionProbeTimeSlicingMode.IndividualFaces;
                oProbe.nearClipPlane = 0.1f;
                //oProbe.farClipPlane = 5000f;
                oProbe.farClipPlane = float.MaxValue / 1.2f;
            }

            if (oSituation == Vessel.Situations.PRELAUNCH
                || oSituation == Vessel.Situations.LANDED
                || oSituation == Vessel.Situations.SPLASHED
                || oSituation == Vessel.Situations.FLYING
                || oVessel.altitude < 10000)
            {
                oLayers.Add(KSPLayer.LocalScenery);
                oLayers.Add(KSPLayer.Water);

                oProbe.clearFlags = UnityEngine.Rendering.ReflectionProbeClearFlags.Skybox;
            }
            else
            {
                oLayers.Add(KSPLayer.Atmosphere);
                oLayers.Add(KSPLayer.ScaledScenery);

                oProbe.clearFlags = UnityEngine.Rendering.ReflectionProbeClearFlags.SolidColor;
                oProbe.backgroundColor = Color.black;
            }

            oProbe.cullingMask = GetCullingMask(oLayers);
        }

        public static int GetCullingMask(List<KSPLayer> oLayers)
        {
            int iCullingMask = 0;

            foreach (KSPLayer oLayer in oLayers)
            { iCullingMask = (iCullingMask | (1 << (int)oLayer)); }

            return iCullingMask;
        }

        public enum KSPLayer
        {
            Default = 0,
            TransparentFX = 1,
            IgnoreRaycast = 2,

            Water = 4,
            UI = 5,


            PartsList_Icons = 8,
            Atmosphere = 9,
            ScaledScenery = 10,
            UI_Dialog = 11,
            UI_Vectors = 12,
            UI_Mask = 13,
            Screens = 14,
            LocalScenery = 15,
            Unknown = 16,
            EVA = 17,
            SkySphere = 18,
            PhysicalObjects = 19,
            InternalSpace = 20,
            PartTriggers = 21,
            KerbalInstructors = 22,
            AeroFxIgnore = 23,
            MapFX = 24,
            UI_Additional = 25,
            WheelCollidersIgnore = 26,
            WheelColliders = 27,
            TerrainColliders = 28,
            DragRender = 29,
            SurfaceFx = 30,
            Vectors = 31
        }
    }
}

What it currently lacks is that I need for the Skybox to be the Atmosphere layer when on the ground and the SkySphere layer when in space. This seemingly small addition is not cooperating with me, however, as setting a skybox causes the skybox to show up completely black for some reason.

 

Share this post


Link to post
Share on other sites

Real Mercury and Gemini Space Suits...

L7odeJE.jpg

Just need someone to make a proper metal/spec map for me and perhaps a normal with wrinkles.

Spoiler

@PART[kerbalEVAVintage,kerbalEVAfemaleVintage] {
	MODULE
	{
		name = ModulePartVariants
		baseVariant = Shiny
		VARIANT
		{
			name = Shiny
			TEXTURE
			{
				materialName = MissionEditorEVABodyAlternate
				shader=KSP/Bumped Specular (Mapped)
				_SpecMap = 
				_Shininess= 0.95
			}
		}
	}
}

 

 

  • Like 2

Share this post


Link to post
Share on other sites

Question: If I install manwith's Recolour Depot mod, should I install also the Unofficial patch? 
I have not been playing KSP in the last past months and am a bit confused with textures unlimited stand of things.... I am playing 1.3.1 by the way.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now