Jump to content

Electrocutor's Thread


Electrocutor

Recommended Posts

Kerbal Space Program Framework

Spoiler

KSPF is a comprehensive and organized API to KSP and a non-intrusive extension of its features. The idea being to present a base-level expansion to KSP, but by default have everything be stock and provide other authors with a much more efficient and structured approach to hooking mods into the game.

Download
GitHub

 

Introduction
And so it begins... I have been working on little bits and pieces of a very large KSP project over the last several years. I never completed any of it, and just used it locally for odds and ends. With the seeming interest I have seen for ModulePartVariantsEx, I believe I will use this opportunity to package it as the first component to the release-worthy KSPF. I will add components as I hammer them out or as people request for functionality.

 

License
MIT

 

Guides

 

Contributions

Spoiler

Textures Unlimited

 

Part Variants

 

Game Object Hierarchy

This archive should be useful to any modders that are trying to find out where something is located within the game to be able to modify it. It also lists all the texture names and shaders for everything, so could be useful for TextureReplacer and Textures Unlimited. Note, that it breaks up the hierarchy every 2 depth levels into a new directory to help keep things clean. This means you can only extract it something like c:\kspdata or you'll run out of filesystem character length.

Edited by Electrocutor
Link to comment
Share on other sites

Here's what I love - you list stock as pass 0. Then list it as old, working on redo. You folks that know what you are doing keep commenting on what a mess are the stock textures. I'll take your work for it. What I know is how alive my screen looks now with all stock parts running your old pass 0 cfg. Great work!

hYdaaHU.jpg

Link to comment
Share on other sites

5 hours ago, Red Shirt said:

Here's what I love - you list stock as pass 0. Then list it as old, working on redo. You folks that know what you are doing keep commenting on what a mess are the stock textures. I'll take your work for it. What I know is how alive my screen looks now with all stock parts running your old pass 0 cfg. Great work!

The reason I call it pass 0 is because it is a forced metallic change that is a static assignment. The Porkjet stock config is where I am heading for the config-only options where you choose between Default (how it normally looks in KSP, but where specular is pulled from reflection), DefaultMetal (this sets a uniform metallicy on the part, but uses the original artist's specular to decide how shiny it is or not), Metal (this forces the surfaces to look metallic, regardless of what the artist intended), and Custom (this allows a basic level of customized color tinting).

 

5 hours ago, Cheesecake said:

Is it possible to make a cfg for Procedural Fairings?

Done.

 GaHvEBu.jpg

Link to comment
Share on other sites

What must be changed in Your cfg? I changed the  Sorry, I ment the recoloring GUI from SSTU, not TU.

Quote

KSP_TEXTURE_SET:NEEDS[TexturesUnlimited]
{
    name = ProceduralFairings_Custom
    title = Custom
    recolorable = true

    TEXTURE
    {
        shader = SSTU/PBR/Masked

        PROPERTY
        {
            name = _Color
            color = 1.0,1.0,1.0,1.0 --> is this RGB normalized decimal? I changed it but nothing happened. I need the RGB 93,140,150.
        }
        PROPERTY
        {
            name = TINTING_MODE
            keyword = TINTING_MODE
        }
        PROPERTY
        {
            name = _Metal
            float = 0.0
        }
        PROPERTY
        {
            name = _Smoothness
            float = 0.0
        }
    }
    COLORS
    {
        mainColor = rgb_gray
        secondColor = rgb_gray
        detailColor = rgb_gray
    }
}

Edit: Sorry, I`m an idiot. I found it. Merry Christmas.

EditEdit:
I used the same RGB for SSTU-Tank and PF but they are different. As an example: I used the green presets for both. thats the result:

AZKLVg9.png

Edited by Cheesecake
Link to comment
Share on other sites

 

On 12/24/2017 at 6:31 AM, Cheesecake said:

EditEdit:
I used the same RGB for SSTU-Tank and PF but they are different. As an example: I used the green presets for both. thats the result:

The Masked recolor for these patches uses the TINT mode recolor and not the fully integrated recolor because that requires the pass 3 "proper recolor map". The TINT mostly works against the white or red, blue, and green colored texture places as I just feed the diffuse back into the mask. You can achieve the same result in most cases, but the actual values for colors main, secondary, and detail will be different. For example, if the diffuse used to be white, I usually like to set one of the colors to black to keep it from being washed out.

Main - Red, Secondary - Green, Detail - Blue. Therefore, if you had a diffuse texture with some red or orange parts, then changing the Main color would mostly be the only one that would affect their color. That's why things that are white are affected by all 3.

Link to comment
Share on other sites

On 12/24/2017 at 8:59 AM, CobaltWolf said:

BDB could use them but it'd be a big undertaking.

That depends how you made your models and/or if you have some tools to easily manipulate UVMaps.

By far the best setup if you have the tools is just to create 2 additional UVMaps: MetalGloss (R, A) and Mask (R, G, B).

If you just want things metal and you've made proper specular alpha channel on your textures, then you can just 'turn it on' and it looks fine without any settings at all.

Edited by Electrocutor
Link to comment
Share on other sites

1 hour ago, Electrocutor said:

That depends how you made your models and/or if you have some tools to easily manipulate UVMaps.

By far the best setup if you have the tools is just to create 2 additional UVMaps: MetalGloss (R, A) and Mask (R, G, B).

If you just want things metal and you've made proper specular alpha channel on your textures, then you can just 'turn it on' and it looks fine without any settings at all.

(If you'll excuse the pedantry, the UV map is the 'layout' of the polygons onto the 2D U/V plane, and the images would be texture maps. Figured I'd clarify since I see them used interchangeably a lot and I was confused for a moment reading your reply)

Indeed, pretty much everything in BDB already has fully made specular channels. Would the gloss be specular (whiter = shinier) or roughness (whiter = more diffused specular highlights, making for less intense reflections)?

Link to comment
Share on other sites

So... in case anyone wants to work on these on their own...

The first step is to give all parts the ability to look like default (with specular), default metal, and metal as options.

Here is the start for Bluedog:

Spoiler

@REFLECTION_CONFIG[default]:NEEDS[TexturesUnlimited] {
	%enabled = true
}
@PART[*]:NEEDS[TexturesUnlimited&Bluedog_DB]:HAS[@MODEL:HAS[#model[Bluedog_DB*]]] {
	MODULE
	{
		name = KSPTextureSwitch
		sectionName = Appearance
		currentTextureSet = Bluedog_DefaultMetal

		TEXTURESET {
			name = Bluedog_Default
		}
		TEXTURESET {
			name = Bluedog_DefaultMetal
		}
		TEXTURESET {
			name = Bluedog_Metal
		}
	}
}

KSP_COLOR_PRESET:NEEDS[TexturesUnlimited] {
	name = rgb_gray
	title = RGB Gray
	color = 127,127,127
	specular = 0
	metallic = 0
}

KSP_TEXTURE_SET:NEEDS[TexturesUnlimited] {
	name = Bluedog_Default
	title = Default
	recolorable = false

	TEXTURE {
		shader	= SSTU/PBR/StockMetallicBumped

		PROPERTY {
			name = _Color
			color = 1.0,1.0,1.0,1.0
		}
		PROPERTY {
			name = _Metal
			float = 0.0
		}
		PROPERTY {
			name = _Smoothness
			float = 1.0
		}
	}
	COLORS {
		mainColor = rgb_gray
		secondColor = rgb_gray
		detailColor = rgb_gray
	}
}
+KSP_TEXTURE_SET[Bluedog_Default]:NEEDS[TexturesUnlimited] {
	@name = Bluedog_DefaultMetal
	@title = Default Metal
	@TEXTURE,0 {
		@PROPERTY[_Color] {
			@color = 1.75,1.75,1.75,1.0
		}
		@PROPERTY[_Metal] {
			@float = 0.75
		}
	}
}
+KSP_TEXTURE_SET[Bluedog_DefaultMetal]:NEEDS[TexturesUnlimited] {
	@name = Bluedog_Metal
	@title = Metal
	@TEXTURE,0 {
		@shader = SSTU/PBR/Metallic
		@PROPERTY[_Smoothness] {
			@float = 0.75
		}
	}
}

 

Now this sets them all to defaultly use DefaultMetal which sets all parts to look metallic and how shiny they are depends on the specular value set for that part by the artist. If you follow along with the Bluedog DB mod installed, you'll see that some of the metal parts have good values set on their speculars, such as the Inon-ACS's angle ring; but other bits not so much, such as the black metal bits on the same part and the worn edges. The amount of time the artist spent on making textures will begin to show itself as soon as you drop the pbr shaders into place because the light reflection makes the specular much more noticeable.

CY1Q7wI.jpg

 

In Bluedog's case, I'd rate that these textures are above-average because he has taken the time to not only create a specular layer, but also set basic level variance on it. Usually, I will set the default option as DefaultMetal for the part when this is the case. Now, look at HLR-ASTX probe core. If you switch from DefaultMetal to Default you'll see that aside from losing a bit of luster, there's not much change. Generally, this means that the part does have a specular set (if there is no specular, then the part will like super glossy/polished), but since you cannot see any variance, it is likely that the specular is uniform and this case, since you do not see much light reflection, I would consider the specular value as being too low for being metal. In this case you have two options: if the artist did indeed put specular variance on texture, but the values are just a bit too low, then you can specify a _Smoothness of greater than 1.0; for example 1.5; which acts as a multiplier. If instead you just want to apply a  fixed metallic value to the whole thing, then change to the Metal option, which switches the shader from stock to Metallic, causing the artist's original specular to be completely ignored.

70BLcMr.jpgTDDsCPA.jpgPjGriwf.jpg

 

If I were the author/artist, I would notice that the specular values on the part were originally a bit too low, then adjust the specular values higher in the diffuse texture to make them correct for being metal. Then, simply using the stock pbr shader, it would look fine in the next update. Since in this case I am not, my only choices are to multiply the specular or ignore the specular and set my own uniform specular. The choice you make will ultimately depend on how much time you want to spend. In my case, I just want it to work right now without spending much time and to-heck with the details, so I would simply select this part to use the Metal as the default selection instead of DefaultMetal. This way the default appearance is that of metal, but the option remains that the player can revert it to the artist's intended specular along with non-metal or metal if they choose.

... more to come.

13 minutes ago, CobaltWolf said:

(If you'll excuse the pedantry, the UV map is the 'layout' of the polygons onto the 2D U/V plane, and the images would be texture maps. Figured I'd clarify since I see them used interchangeably a lot and I was confused for a moment reading your reply)

Indeed, pretty much everything in BDB already has fully made specular channels. Would the gloss be specular (whiter = shinier) or roughness (whiter = more diffused specular highlights, making for less intense reflections)?

Okay, so _Metal decides how much diffuse texture to use and how much reflection texture to use. The _Smoothness decides how shiny it is, more shiny means higher light intensity. The fastest solution would be if all the painted color parts of your models were on their own mesh(es) and the metal on their own, and you had a proper specular value set across the whole diffuse. This way you can just set each mesh to a different _Metal value and the rest takes care of itself.

Edited by Electrocutor
Link to comment
Share on other sites

5 minutes ago, Jimbodiah said:

I know the guy that makes that mod, you should ask him. I know he has too much time on his hands anyway.  :wink:

Huh, last time I talked to him he had almost no time and a lot of people PM'ing him asking when their pet projects would be released. :wink: Seems like @Electrocutor's got this handled, in any case.

@Electrocutor indeed, the Inon-ACS was a bit rushed. Parts like the Apollo CM are probably a fair bit more polished.

Link to comment
Share on other sites

14 minutes ago, CobaltWolf said:

Huh, last time I talked to him he had almost no time and a lot of people PM'ing him asking when their pet projects would be released. :wink: Seems like @Electrocutor's got this handled, in any case.

@Electrocutor indeed, the Inon-ACS was a bit rushed. Parts like the Apollo CM are probably a fair bit more polished.

Would you be open to some change suggestions while I go through your parts? For example, if I list out any parts where the Windows are not on their own mesh named Windows?

Edited by Electrocutor
Link to comment
Share on other sites

3 minutes ago, Electrocutor said:

Would you be open to some change suggestions while I go through your parts? For example, if I list out any parts where the Windows are not on their own mesh named Windows?

Unfortunately in some cases that is simply not possible. The Apollo capsule's door window, for example, is entirely textured and there is no way to separate it out to a separate mesh.

Link to comment
Share on other sites

5 minutes ago, CobaltWolf said:

Unfortunately in some cases that is simply not possible. The Apollo capsule's door window, for example, is entirely textured and there is no way to separate it out to a separate mesh.

I'm not a 3d artist, so once you have built a mesh, you can no longer cut out a part of it without a ton of work? I had thought that the original file type for 3d programs would allow you to add/modify/remove bits and parts of meshes that you made before (kind of like texture layers, where you could just highlight a single triangle and delete it.). I know that Ven had created additional meshes on top of his windows that are just a small fully transparent texture and named them all Shine; perhaps he ran into the same problem.

Edited by Electrocutor
Link to comment
Share on other sites

Just now, Electrocutor said:

I'm not a 3d artist, so once you have built a mesh, you can no longer cut out a part of it without a ton of work? I had thought that the original file type for 3d programs would allow you to add/modify/remove bits and parts of meshes that you made before (kind of like texture layers). I know that Ven had created additional meshes on top of his windows that are just a small fully transparent texture and named them all Shine; perhaps he ran into the same problem.

I'm trying to think of how to explain it... Continuing with the Apollo capsule as an example, the forward and side windows are actually modeled in, meaning that I could separate them if I really needed to by separating the edges around the rim. But the round window on the door is not modeled in at all. it's not even a flat surface - it actually sits on top of a bent edge, because models in KSP are made from 24 sided cylinders. There's no clean way to get that window separated unless I start hacking apart the model, adding more geometry, screwing up the mesh normals (creating a lot more work to fix that issue), screwing up the UV map around that window (meaning the map for that part of the capsule has to be redone as well)... it'd be a lot of work.

And, as I was typing this I thought of something else. The whole reason the Apollo capsule is a single mesh instead of separate windows was because it let me use one material for the whole pod, which greatly simplified getting the emissive animation to work. If I were to try and separate the windows, not only would there be a good bit of work in my 3D software, there'd also be a bunch of work in Unity to rebuild the window light animations and reassign them.

Essentially, it comes down to the basic issue that the parts were not made with this kind of conversion in mind, because it wasn't even something on the table at the time they were built. As a result other considerations were priorities, which now make it significantly harder to make the parts play nice.

One thing that you *do* have going for you, is the metal coating on the Apollo capsule in particular is a mirror finish (ignoring for a second all the grunge, grease, burn marks etc on top of it, which are reflected in the specular map), so having the windows and pod be a single mesh isn't exactly as much the end of the world as it could be.

Link to comment
Share on other sites

@Electrocutor

Would you mind looking into two of my old mods and guide me how to do the textures? also, noticed the patch for stock has no transparency map for command pods, how would someone fix that?

my mods are JSat and Stational Constructs

Although @linuxgurugamer started maintaining them, i know he maintains lots of mods and want to help him as much as i can

Edited by Jiraiyah
Link to comment
Share on other sites

28 minutes ago, Jiraiyah said:

@Electrocutor

Would you mind looking into two of my old mods and guide me how to do the textures? also, noticed the patch for stock has no transparency map for command pods, how would someone fix that?

my mods are JSat and Stational Constructs

Although @linuxgurugamer started maintaining them, i know he maintains lots of mods and want to help him as much as i can

I haven't gotten around to updating them, so let me know if you do manage to get it done.

I have no problem with you continuing to develop, and my doing the cfg & basic support

Link to comment
Share on other sites

22 minutes ago, Leandro Basi said:

Excuse my question, but where i can put the cfgs? Author mod´s or Texture unlimited folder?

anywhere within the game data folder will work, they are module manager patches

@Electrocutor

will you help me on this? can't make a decision and don't know what to fine tweak :

this is when i set my part to default_metal

GJ-5iJ55RwynLreeKwuaVA.png

and this when i set it to metal

9kTvdowBQMGsTbEiGhIgCA.png

I like the clearness of the texture from the metal one (second one) but the reflective features of the first one, how can i achieve something like that (maybe default metal with less reflection)?

 

edit : never mind, found it, the metal value under the default metal, but making it up to 0.75 realy makes it close to a mirror lol. here is the final look :

9G629LVWQt2DylrhEgzpYg.png

I'm pretty darn happy with this, damn squad, again, this should become stock feature lol

Edited by Jiraiyah
Link to comment
Share on other sites

ok, now I'm, stuck, take a look at this part on the second mod :

PART
{
	name = JSolidStationTI
	module = Part
	author = Jiraiyah
	
	MODEL
	{
		model = StationalCunstructs/Parts/RingsAndConstrains/SolidRingTypeI
		scale = 1, 1, 1
	}
	scale = 1
	rescaleFactor = 0.02

	TechRequired = heavierRocketry
	entryCost = 70400
	cost = 8233
	category = Pods
	subcategory = 0
	title = Jing Type - 1
	manufacturer = JSpaceCo
	description = Jeb had a dream of a station with something crazy in the middle, a circle? When he told the dream to bob, it was considered that a circular module for every station is a must have. They ate just few snaks and got busy.
	// attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision
	attachRules = 1,0,1,1,0
	mass = 5.2
	dragModelType = default
	maximum_drag = 0.2
	minimum_drag = 0.3
	angularDrag = 2
	crashTolerance = 45
	breakingForce = 800
	breakingTorque = 800
	maxTemp = 3000
	skinMaxTemp = 2500
	emissiveConstant = 0.8
	
	CrewCapacity = 20
	bulkheadProfiles = mk2
	
	fuelCrossFeed = True
	vesselType = Probe
}

and now the patch for the part to rise and shine :

@REFLECTION_CONFIG[default]:NEEDS[TexturesUnlimited] {
	%enabled = true
}

@PART[*]:NEEDS[TexturesUnlimited]:HAS[@MODEL:HAS[#model[JSolidStation*]]]:FINAL {
	MODULE
	{
		name = KSPTextureSwitch
		sectionName = Appearance
		currentTextureSet = JStation_DefaultMetal

		TEXTURESET {
			name = JStation_Default
		}
		TEXTURESET {
			name = JStation_DefaultMetal
		}
		TEXTURESET {
			name = JStation_Metal
		}
	}
}

KSP_COLOR_PRESET:NEEDS[TexturesUnlimited] {
	name = rgb_gray_station
	title = RGB Gray
	color = 127,127,127
	specular = 0
	metallic = 0
}

KSP_TEXTURE_SET:NEEDS[TexturesUnlimited] {
	name = JStation_Default
	title = Default
	recolorable = false

	TEXTURE {
		shader	= SSTU/PBR/StockMetallicBumped

		PROPERTY {
			name = _Color
			color = 1.0,1.0,1.0,1.0
		}
		PROPERTY {
			name = _Metal
			float = 0.0
		}
		PROPERTY {
			name = _Smoothness
			float = 1.0
		}
	}
	COLORS {
		mainColor = rgb_gray_station
		secondColor = rgb_gray_station
		detailColor = rgb_gray_station
	}
}
+KSP_TEXTURE_SET[JStation_Default]:NEEDS[TexturesUnlimited] {
	@name = JStation_DefaultMetal
	@title = Default Metal
	@TEXTURE,0 {
		@PROPERTY[_Color] {
			@color = 1.75,1.75,1.75,1.0
		}
		@PROPERTY[_Metal] {
			@float = 0.75
		}
	}
}
+KSP_TEXTURE_SET[JStation_DefaultMetal]:NEEDS[TexturesUnlimited] {
	@name = JStation_Metal
	@title = Metal
	@TEXTURE,0 {
		@shader = SSTU/PBR/Metallic
		@PROPERTY[_Smoothness] {
			@float = 0.75
		}
	}
}

why it doesn't show up on the part? it works on the first mod but not the second mod why?

Edited by Jiraiyah
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...