Jump to content

[1.12.x] Textures Unlimited Recolour Depot


Recommended Posts

3 minutes ago, Shadowmage said:

I'm not seeing the problem?  The maximum deviation from gray will be +0.5 (white) or -0.5 (black), thus 50%.  Your main textures should never be very far from flat gray in portions that are masked for recoloring.

my point is that the mask map is 100%, the spec map is 75%, and the recolor selection is 100%; but the result is about 50%.

Link to comment
Share on other sites

35 minutes ago, Electrocutor said:

my point is that the mask map is 100%, the spec map is 75%, and the recolor selection is 100%; but the result is about 50%.

 

IDK about your math (edit: actually, your calculations line up with my calculations now that I've re-read what you posted; are you saying that is -not- what is happening in-game?). I've included examples below where I've replaced all variable names with your constants.  The output from manual calculation through the code lines up with the quick sample calcs I had done.


For those inputs, in standard mode, the output should be 1.0 * 1.0 + (0.75 - 0.5) = 1.25f (or ~319i)  (oversaturated, will be clamped to 1.0 by lighting engine)
For those inputs, in tinting mode, the output should be 1.0 * 1.0 * 0.75 = 0.75f  (or ~192i)

All of the extra math regarding the 'm' variable only happens when the (mask.r + mask.g + mask.b) < 1.  With a 'full' R or G or B mask for a pixel, the math should be simplified as-per above.

The shader code with variable names replaced with constants from the above example.  Top sample is for 'standard' mode, bottom example is for 'tinting' mode:

//standard mode example
fixed4 _MaskColor1 = (0,0,0,1)  //this is the 'main' user selected color, corresponds to the 'red' mask
fixed4 _MaskColor3 = (0,0,0,0)
fixed4 _MaskColor2 = (0,0,0,0)
fixed3 mask = (1,0,0)
fixed4 spec = (0.75,0.75,0.75,0)  //rgb = spec texture input, a = metal(unused in example)
// the variable 'm' controls how much of the base texture color is used, and how much comes from the user-selected color
// the brighter the colors in the mask, the more that the outputs are controlled by the user colors.  Duller (or black) mask, means the outputs are controlled only from the texture samples
fixed m = saturate(1 - (1 + 0 + 0));// = 0
fixed3 userSpec = 1 * 1 + 0 * 0 + 0 * 0; // = (1,1,1)
fixed3 baseSpec = (0.75,0.75,0.75) * 0;// = (0,0,0)	
fixed3 detailSpec = ((0.75,0.75,0.75) - (0.5,0.5,0.5)) * (1 - 0);// = (0.25,0.25,0.25)
output = saturate((1,1,1) + (0,0,0) + (0.25,0.25,0.25).r; // final output = 1.25,1.25,1.25

//tinting mode example
fixed4 _MaskColor1 = (0,0,0,1)  //this is the 'main' user selected color, corresponds to the 'red' mask
fixed4 _MaskColor3 = (0,0,0,0)
fixed4 _MaskColor2 = (0,0,0,0)
fixed3 mask = (1,0,0)
fixed4 spec = (0.75,0.75,0.75,0)  //rgb = spec texture input, a = metal(unused in example)
// the variable 'm' controls how much of the base texture color is used, and how much comes from the user-selected color
// the brighter the colors in the mask, the more that the outputs are controlled by the user colors.  Duller (or black) mask, means the outputs are controlled only from the texture samples
fixed m = saturate(1 - (1 + 0 + 0));// = 0
fixed3 userSpec = 1 * 1 + 0 * 0 + 0 * 0; // = (1,1,1)
fixed3 baseSpec = (0.75,0.75,0.75) * 0;// = (0,0,0)	
fixed3 detailSpec = (0.75,0.75,0.75) * (1 - 0);// = (0.75,0.75,0.75)
output = saturate((1,1,1) * (0.75,0.75,0.75 + (0,0,0)).r; // final output = 0.75,0.75,0.75

 

Edited by Shadowmage
Link to comment
Share on other sites

1 minute ago, Shadowmage said:

 

IDK about your math.. (are you calculating for the right mode?  Different code for each). I've included examples below where I've replaced all variable names with your constants.  The output from manual calculation through the code lines up with the quick sample calcs I had done.


For those inputs, in standard mode, the output should be 1.0 * 1.0 + (0.75 - 0.5) = 1.25f (or ~319i)  (oversaturated, will be clamped to 1.0 by lighting engine)
For those inputs, in tinting mode, the output should be 1.0 * 1.0 * 0.75 = 0.75f  (or ~192i)

All of the extra math regarding the 'm' variable only happens when the (mask.r + mask.g + mask.b) < 1.  With a 'full' R or G or B mask for a pixel, the math should be simplified as-per above.

The shader code with variable names replaced with constants from the above example.  Top sample is for 'standard' mode, bottom example is for 'tinting' mode:


//standard mode example
fixed4 _MaskColor1 = (0,0,0,1)  //this is the 'main' user selected color, corresponds to the 'red' mask
fixed4 _MaskColor3 = (0,0,0,0)
fixed4 _MaskColor2 = (0,0,0,0)
fixed3 mask = (1,0,0)
fixed4 spec = (0.75,0.75,0.75,0)  //rgb = spec texture input, a = metal(unused in example)
// the variable 'm' controls how much of the base texture color is used, and how much comes from the user-selected color
// the brighter the colors in the mask, the more that the outputs are controlled by the user colors.  Duller (or black) mask, means the outputs are controlled only from the texture samples
fixed m = saturate(1 - (1 + 0 + 0));// = 0
fixed3 userSpec = 1 * 1 + 0 * 0 + 0 * 0; // = (1,1,1)
fixed3 baseSpec = (0.75,0.75,0.75) * 0;// = (0,0,0)	
fixed3 detailSpec = ((0.75,0.75,0.75) - (0.5,0.5,0.5)) * (1 - 0);// = (0.25,0.25,0.25)
output = saturate((1,1,1) + (0,0,0) + (0.25,0.25,0.25).r; // final output = 1.25,1.25,1.25

//tinting mode example
fixed4 _MaskColor1 = (0,0,0,1)  //this is the 'main' user selected color, corresponds to the 'red' mask
fixed4 _MaskColor3 = (0,0,0,0)
fixed4 _MaskColor2 = (0,0,0,0)
fixed3 mask = (1,0,0)
fixed4 spec = (0.75,0.75,0.75,0)  //rgb = spec texture input, a = metal(unused in example)
// the variable 'm' controls how much of the base texture color is used, and how much comes from the user-selected color
// the brighter the colors in the mask, the more that the outputs are controlled by the user colors.  Duller (or black) mask, means the outputs are controlled only from the texture samples
fixed m = saturate(1 - (1 + 0 + 0));// = 0
fixed3 userSpec = 1 * 1 + 0 * 0 + 0 * 0; // = (1,1,1)
fixed3 baseSpec = (0.75,0.75,0.75) * 0;// = (0,0,0)	
fixed3 detailSpec = (0.75,0.75,0.75) * (1 - 0);// = (0.75,0.75,0.75)
output = saturate((1,1,1) * (0.75,0.75,0.75 + (0,0,0)).r; // final output = 0.75,0.75,0.75

 

This is what I am saying... it should be 1.25 saturated to 1.0, which is 100%; but in-game it shows as about 50%.

Link to comment
Share on other sites

43 minutes ago, Electrocutor said:

This is what I am saying... it should be 1.25 saturated to 1.0, which is 100%; but in-game it shows as about 50%.

One major problem with your theoretical example -- the Stock Mk2-inline cockpit texture set is using 'tinting mode'.  Thus the expected output with a user input of 1.0f/255 on the slider and a specular input of 0.75f/191i from the texture, would be ~0.75f/~191i.  (1.0f * 0.75f = 0.75f)

I have set the SSTU tank in the below image to the value of 191 for the specular slider.  The MK2 cockpit I set the main(R) recoloring specular slider to 255.   Seems to match the MK2 cockpit quite well, which would indicate that the outputs from the shader are exactly as expected for tinting mode.

l735SyR.png

 

Edited by Shadowmage
Link to comment
Share on other sites

21 minutes ago, Shadowmage said:

One major problem with your theoretical example -- the Stock Mk2-inline cockpit texture set is using 'tinting mode'.  Thus the expected output with a user input of 1.0f/255 on the slider and a specular input of 0.75f/191i from the texture, would be ~0.75f/~191i.  (1.0f * 0.75f = 0.75f)

I have set the SSTU tank in the below image to the value of 191 for the specular slider.  The MK2 cockpit I set the main(R) recoloring specular slider to 255.   Seems to match the MK2 cockpit quite well, which would indicate that the outputs from the shader are exactly as expected for tinting mode.

 

 

I feel really stupid now, sorry. It was in a different cfg, so finding tinting_mode would of course fail. just remove tinting_mode and the thing works fine.

Link to comment
Share on other sites

11 minutes ago, Electrocutor said:

I feel really stupid now, sorry. It was in a different cfg, so finding tinting_mode would of course fail. just remove tinting_mode and the thing works fine.

No worries; I was just concerned that the math was broken for some reason and had some fixing work to do.  Glad to hear that is all it was :)

Link to comment
Share on other sites

Hello again @Manwith Noname! As always, excellent mod - having a lot of fun recoloring things with it!

I don't want to list this as a bug, but your mod seems to conflict on ~3 parts (that I can find) when run in tandem with Stockalike Station Parts Redux.  Running KSP 1.4.5 x64 on Win 7 x64, on a test KSP install with only these 2 mods, and Making History.

I don't know if there's anything you can do about it (It might be better brought up with Nertea) but I wanted to bring it to your attention regardless in case you can think of something.

1HPni1o.png

Edited by Chimichanga
Link to comment
Share on other sites

How.....strange. I'll investigate.

 

Edit:

@Chimichanga Nertea patches the stock parts to replace their models. You can find it in the patches folder and the SSPXr_StockPartReplacements.cfg. Nothing I can do from my side really other than write a module manager patch to work around their module manager patch.

Edited by Manwith Noname
Link to comment
Share on other sites

@Chimichanga

Try making a config with this...

@PART[crewCabin,cupola,Large_Crewed_Lab,dockingPort2]:FOR[ZZZZZZ_NEEDSMOARZEDS_ZZZZZZ]:NEEDS[StationPartsExpansionRedux]
{
	!MODULE[KSPTextureSwitch],* {}
	!MODULE[SSTURecolorGUI]
}

I haven't tested it and it's a bit of a backwards way to go about it....but it's the first thing that comes to mind without rewriting my own config entries.

Edited by Manwith Noname
Link to comment
Share on other sites

  • 2 weeks later...

Truly a great mod.  I've run into an issue, if you have a sec to look at.  Otherwise ignore!  :lol:

Spoiler
Album cn1Wl7J.png will appear when post is submitted

Putting it into Bob Ross mode takes it out of ultra black and lets you see some of the texture with a charcoal grey coat of paint.  Even when you put it into white paint mode...

I forgot to mention that only 3 parts are affected: Mk1Cockpit, Mk1CrewCabin, and Mk2Cockpit.  They appear grouped together in your cfg but I wasn't sure that had anything to do with it.

Thanks for the mod!

Edited by Igniteous
Edit: Forgot to add the parts affected
Link to comment
Share on other sites

@Igniteous

I suspect this is caused by some sort of mod conflict. Black parts mean the defined texture was not found or there is a lack of defined texture. From my experience, this is usually me being a numpty and having a typo in the config but...

Spoiler

2E36278C35CFBEA501317AA999A44044821F0CFF

If you can tell me what other mods you have that are perhaps using module manager to apply patches to stock parts I can look further. Something is changing the name that appears at the top of the right click menu for example. I can see what I suspect is tweakscale too so I'll check that.

Link to comment
Share on other sites

Very, very nice! This mod have only on issue: We can't apply a color setting to every parts, you have to do it manually. If we can, say me how, I'm feeling dumb ^^

 
Edited by Coca992
Link to comment
Share on other sites

 

On 10/8/2018 at 2:27 AM, Manwith Noname said:

@Coca992

You are correct, you have to assign the desired texture set and any colouring manually to each part. If you have not made use of them so far you can speed the process up by making use of the store / load colour / pattern buttons.

are you planning to add a button to do it? anyway, I've made somme cool things with it!

5cYR0pC.jpg

yBuXC29.jpg

ygcgYGO.jpg

Edited by Coca992
Link to comment
Share on other sites

6 hours ago, KSPFanatic102 said:

Not sure if this is a bug or intentional, but while recolouring using the stock recolour, i can only colour the parts partially, while the other part remains pure black.

Using DX9 by any chance?

3 hours ago, Coca992 said:

are you planning to add a button to do it?

Not something that @Manwith Noname has control over -- that is all done through the plugin code, so you would need to submit your feature request here -- https://github.com/shadowmage45/TexturesUnlimited

Link to comment
Share on other sites

17 hours ago, Zarbon44 said:

Do you have plans to add support for Tantares/LV?

I'm open to getting things up and running for mods. I'll have a look but I've sort of taken a breather so when 1.5 drops I'm not completely bored of mapping out masks and writing configs.

 

16 hours ago, KSPFanatic102 said:

Not sure if this is a bug or intentional, but while recolouring using the stock recolour, i can only colour the parts partially, while the other part remains pure black.

https://imgur.com/a/JjBcyHA

Heh, well, it's certainly not right. This is really odd because not all the part seems to be affected. If it's not caused by DX9 as Shadowmage asks, can you give me a list of the mods you have installed so I can investigate? 

 

13 hours ago, Coca992 said:

are you planning to add a button to do it? anyway, I've made somme cool things with it!

As above, I'm just making use of features in Textures Unlimited, this is only a config and texture pack. The real heavy lifting is done by TU. Love that car though.

Edited by Manwith Noname
Link to comment
Share on other sites

4 hours ago, Manwith Noname said:

I'm open to getting things up and running for mods. I'll have a look but I've sort of taken a breather so when 1.5 drops I'm not completely bored of mapping out masks and writing configs.

 

Heh, well, it's certainly not right. This is really odd because not all the part seems to be affected. If it's not caused by DX9 as Shadowmage asks, can you give me a list of the mods you have installed so I can investigate? 

 

As above, I'm just making use of features in Textures Unlimited, this is only a config and texture pack. The real heavy lifting is done by TU. Love that car though.

https://imgur.com/a/44Ajc4Q Here you go.

14 hours ago, Shadowmage said:

Using DX9 by any chance?

Not something that @Manwith Noname has control over -- that is all done through the plugin code, so you would need to submit your feature request here -- https://github.com/shadowmage45/TexturesUnlimited

dxdiag says i am using DX12

https://imgur.com/0VtPQmV

Edited by KSPFanatic102
Link to comment
Share on other sites

2 hours ago, KSPFanatic102 said:

dxdiag says i am using DX12

That is what version is installed on your computer.

What version do you use for KSP?  Do you launch the program with any -force-GLXXXX command line switches, or -force-d3d11 switches?

(the default for KSP is DX9, so if you aren't using the above switches when launching the game... it is running in DX9 mode on windows, or open-gl on linux/mac)

Link to comment
Share on other sites

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...