Jump to content

[1.9.x] Textures Unlimited - PBR-Shader, Texture Set, and Model Loading API


Shadowmage
 Share

Recommended Posts

As yet, I've only updated the 'Porkjet Stock' cfg to the new syntax.

Also, the newer versions of TU  shaders compensate for luminosity on metallic (they didn't used to), so I have to remove the _Color 1.75,1.75,1.75 compensation. Usually over-saturation results in a white texture, not black though.

Link to comment
Share on other sites

12 hours ago, Electrocutor said:

Also, the newer versions of TU  shaders compensate for luminosity on metallic (they didn't used to), so I have to remove the _Color 1.75,1.75,1.75 compensation.

I haven't touched the shaders code in quite some time.  Could it be that Unity implemented the luminosity correction in their end of the shader code/rendering system?  (e.g. the shaders that are available for 1.4+ are the compiled from the exact same shader source code).

 

10 hours ago, ItCameFromDuna said:

Anyways, here's the link:

Thanks, will take a look at it and see what I can see.

Link to comment
Share on other sites

2 minutes ago, ItCameFromDuna said:

I think I was still getting this when I briefly tried it in 1.3. Maybe it's my crap Intel integrated graphics?

Could be.  Could also be your install is simply fubar.  You have at least four different copies of module manager, some not even for KSP 1.4...

Non platform assembly: C:\Program Files\Kerbal Space Program\GameData\ModuleManager.2.8.0.dll (this message is harmless)
Non platform assembly: C:\Program Files\Kerbal Space Program\GameData\ModuleManager.2.8.1.dll (this message is harmless)
Non platform assembly: C:\Program Files\Kerbal Space Program\GameData\ModuleManager.3.0.1.dll (this message is harmless)
Non platform assembly: C:\Program Files\Kerbal Space Program\GameData\ModuleManager.3.0.4.dll (this message is harmless)

I noticed big chunks of exception spam from multiple mods.  You don't just have a problem with TU, you have a problem with many of your mods.  (FAR in particular is clogging up the log with tons of exceptions)

 

Please create a new/clean KSP install.  Add module-manager (only one version, the most recent), add TU, and add the stock-conversion patches, and then see where that gets you. 

Also, in the future, please DO NOT use the 'output_log' file (it is utter garbage).  I had asked specifically for the KSP.log file, for very specific reasons.

 

TL:DR;  -- I cannot offer support on a KSP installation that is already broken.  Clean up your install first.

Link to comment
Share on other sites

I only have the one MM installed! And I'm waiting until it updates to reinstall far!! Unless the log is cumulative...? Sorry, I didn't see that request for the KSP.log. Anyways, here's the log you requested: https://www.dropbox.com/s/et1ya0sbx0esxgw/KSP.log?dl=0

Edited by ItCameFromDuna
Link to comment
Share on other sites

1 hour ago, ItCameFromDuna said:

I only have the one MM installed! And I'm waiting until it updates to reinstall far!! Unless the log is cumulative...? Sorry, I didn't see that request for the KSP.log. Anyways, here's the log you requested: https://www.dropbox.com/s/et1ya0sbx0esxgw/KSP.log?dl=0

Thanks, that second log is much cleaner, and makes a bit more sense (the first log you posted was from KSP 1.3.0).  There are still a lot of exceptions from potentially broken mods, but I'm not seeing multiple ModuleManagers at least.


One of the first problems that I'm seeing is that you are running in DX9 mode.  This by itself is enough to cause problems, though it shouldn't result in complete lack of reflections.  For best results, you need to start KSP with the '-force-glcore' command line option ( https://docs.unity3d.com/Manual/CommandLineArguments.html ).

Quote
SM: 30 (Direct3D 9.0c [igdumdim64.dll 20.19.15.4568])


Strangely, it looks like the reflections are enabled in the plugin/configs:

Quote
[LOG 09:53:27.986] SSTUReflectionManager - Loading reflection configuration: 
REFLECTION_CONFIG
{
	enabled = true
	exportDebugCubes = false
	debug = false
	eveInstalled = false
	faces = 1
	interval = 60
	resolution = 128
	name = default
}

 

From looking at the API specs for your video card... there really shouldn't be any problems there; TU should only need DX11/SM3 support, which your card lists as capable/compatible.

Quote

With Intel® Iris® Graphics 5200, 5100
With Intel® HD Graphics 5000, 4600, 4400, 4200

DirectX* OpenGL* OpenCL* Shader Model Support Intel® Quick Sync Video Intel® Wireless Display Intel® Insider™ technology Intel® InTru™ 3D Technology Intel® Clear Video HD Technology
11.1 4.3 1.2 5 Yes Yes Yes Yes Yes

 

At this point there is nothing more that I can do to debug with the information that I have.  There is at least one more test you could run though that might shed some light on where the system is failing. You could try adding the following config file to your gamedata directory.  It will enable some debug features in TU that will allow you to 'see' what the reflection system is seeing.

@REFLECTION_CONFIG[default]
{
	%debug = true
}

After that config is added (and KSP restarted), you should have a new button on the stock app-launcher when in the flight scene; should look like a truck.  Click this to open the TU-debug menu.  From in the TU-debug gui, press the 'Toggle Debug Sphere' button.  A 10m diameter sphere should appear around your craft; this sphere will directly show what the reflection-camera system has captured.  It -should- be a reflection of the environment around your craft if everything is working properly up to that point.  (please post a screenshot of the debug-sphere)

 

I would still highly recommend trying out TU on an otherwise clean installation of KSP, simply to rule out any mod conflicts.  You might be surprised how easy it is for mods to interfere with eachother....

Link to comment
Share on other sites

Ignore previous comments here... I had forgotten to enable reflections -_-.

 

With some bouncing back and forth with blowfish; I present to you Textures Unlimited Variants (concept):

Spoiler
KSP_MODEL_SHADER {
	model = Squad/Parts/Structural/trussGirderL/model

	MATERIAL {
		shader = SSTU/PBR/Metallic
	}
}

@PART[trussPiece1x] {
	MODULE {
		name = ModulePartVariants
		baseVariant = Basic

		VARIANT {
			name = Basic
			displayName = Basic
			primaryColor = #ffffff
			secondaryColor = #ffffff

			TEXTURE {
				_Metal = 0.0
				_Smoothness = 0.4
			}
		}
		VARIANT {
			name = Metallic
			displayName = Metallic
			primaryColor = #c0c0c0
			secondaryColor = #c0c0c0

			TEXTURE {
				_Metal = 0.75
				_Smoothness = 0.75
			}
		}
		VARIANT {
			name = Shiny
			displayName = Shiny
			primaryColor = #c0c0c0
			secondaryColor = #c0c0c0

			TEXTURE {
				_Metal = 0.75
				_Smoothness = 0.9
			}
		}
		VARIANT {
			name = Brass
			displayName = Brass
			primaryColor = #b5a642
			secondaryColor = #b5a642

			TEXTURE {
				_Color = #b5a642
				_Metal = 0.75
				_Smoothness = 0.75
			}
		}
		VARIANT {
			name = Gold
			displayName = Gold
			primaryColor = #d4aF37
			secondaryColor = #d4aF37

			TEXTURE {
				_Color = #d4aF37
				_Metal = 0.75
				_Smoothness = 0.9
			}
		}
	}
}

 

 

Edited by Electrocutor
Link to comment
Share on other sites

Tried a clean install; still no results. I couldn't figure out how to get it into dx11 mode; Command Prompt was giving me errors every time I tried to run the commands. Here's the new log: https://www.dropbox.com/s/et1ya0sbx0esxgw/KSP.log?dl=0

And the screenshot: https://www.dropbox.com/s/atselsby04cm8xg/screenshot178.png?dl=0

 

Link to comment
Share on other sites

11 minutes ago, ItCameFromDuna said:

Tried a clean install; still no results. I couldn't figure out how to get it into dx11 mode; Command Prompt was giving me errors every time I tried to run the commands. Here's the new log: https://www.dropbox.com/s/et1ya0sbx0esxgw/KSP.log?dl=0

And the screenshot: https://www.dropbox.com/s/atselsby04cm8xg/screenshot178.png?dl=0

 

For KSP 1.4.0+ you need to use GLCore, not dx11.

You do so by adding a parameter to the shortcut for KSP: .exe -force-glcore

Link to comment
Share on other sites

29 minutes ago, ItCameFromDuna said:

Tried a clean install; still no results. I couldn't figure out how to get it into dx11 mode; Command Prompt was giving me errors every time I tried to run the commands. Here's the new log: https://www.dropbox.com/s/et1ya0sbx0esxgw/KSP.log?dl=0

And the screenshot: https://www.dropbox.com/s/atselsby04cm8xg/screenshot178.png?dl=0

 

Thank you for your time and effort to do that testing; truly appreciated.  The screenshot of the sphere pretty much confirms what is going on (reflections not being captured properly), and I will dig through the log file to try and find a cause.

One other thing you might try would be figuring out how to run the game using the GL-Core option.

(instructions below assume you are using Windows)

1.)  Locate your KSP executable (KSP_x64.exe).
2.) Right click, and select 'create shortcut'.  A new shortcut should appear in the same folder.
3.) Right click on the new shortcut, and select 'properties'.
4.) In the 'Target:' box, add the following to the end:

-force-glcore

5.) The final 'target' entry should look something like this in its entirety:

"C:\Program Files (x86)\Steam\SteamApps\common\Kerbal Space Program\KSP_x64.exe" -force-glcore

(note, that is using the default steam installation location; your executable may or may not be located differently)
6.)  Launch KSP using the new shortcut you have created.  It should run using the openGL-core graphics API.  This alone fixes several rendering issues, and may or may not solve the issue you are encountering.

 

 

 

 

4 hours ago, Electrocutor said:

Ignore previous comments here... I had forgotten to enable reflections -_-.

LoL, whoops :)  (did that myself recently, spent like 30mins scratching my head wondering why things weren't working...)

 

4 hours ago, Electrocutor said:

With some bouncing back and forth with blowfish; I present to you Textures Unlimited Variants (concept):

Very interesting.  Glad to see that TU and the stock part-variant system aren't wholly incompatible.

On that note, and something I haven't investigated fully yet, there is an 'onPartVariantSomethingSomething' event that I might be able to hook into in order to add specific functionality to deal with the stock part-variant system.  Not quite sure what I would use it for, but it would be an opportunity to have TU run some code (e.g. update materials, shaders, properties, etc) -after- the stock variant stuff had run; with the specific actions being based on the currently active/selected variant.  A kind of 'part-variant-expansion' system, adding new features and expanding on the stock system.   (all just concepts at this point, but might be beneficial in the future)

Link to comment
Share on other sites

22 hours ago, Manwith Noname said:

Is TU compressing PNG files or is it something KSP does?

Nope; TU only grabs the textures that KSP has loaded; it does not adjust the textures in any way.

However I believe that either KSP or Unity added some texture-compression code to all textures in the update to 1.4, but I haven't dug into it much.  I'm only aware of it because of some new messages that show up in the log regarding texture compression.

Link to comment
Share on other sites

@Shadowmage Would you consider allowing wildcards for model=, mesh=, and excludeMesh= ? This would help reduce cfg busywork greatly.

For example, mesh = panel* would cover panel00 through panel 32 without having to specify each and every one, and model = MyMod/* would simply enable TU for all models within a mod.

Link to comment
Share on other sites

1 hour ago, Electrocutor said:

@Shadowmage Would you consider allowing wildcards for model=, mesh=, and excludeMesh= ? This would help reduce cfg busywork greatly.

For example, mesh = panel* would cover panel00 through panel 32 without having to specify each and every one, and model = MyMod/* would simply enable TU for all models within a mod.

Wildcards in model based look-ups -- sure.  As long as it is a simple implementation -- e.g. only a single wildcard, always at the end of a name.

Meshes -- will have to give that one a bit more thought.  A lot more complicated with the white/blacklist functions in place.

Link to comment
Share on other sites

On 3/30/2018 at 5:28 PM, ItCameFromDuna said:

Just finished testing that per Electrocutor's reply. No change, it's still not reflecting anything. You want a third log?

Apologies for the delay.  Far too many things contending for my far too limited time.

I was unable to spot anything in your log from a quick keyword search.  I will be reviewing it in more depth over the next few days to try and see if there is any cause stated in the log.

I have a feeling though that it is going to come down to the graphics chipset you are using not supporting the feature (even though spec-sheets say it should...wonderful Intel gfx...)

Link to comment
Share on other sites

9 hours ago, Warsoul said:
Seems to not working for me, i unziped the folder into the gamedata\ folder but my standar unity shader doesn't work. Any Tuto ?

I have ModuleManager.3.0.6.dll and 000_TexturesUnlimited\ in my gamedata\ folder

 

https://sketchfab.com/models/89ff537215474f588c3ffa317e92ff93

What are you trying to do?  (this mod does NOT make the Unity Standard shader available; it has special KSP compatible versions of shaders that make use of the same PBR rendering pipeline as the Unity Standard shader)

Examples can be found in the mods linked on the front page.  The tutorial is the actual source code -- https://github.com/shadowmage45/TexturesUnlimited/tree/master/Plugin/SSTUTools/KSPShaderTools

(also some minor stuff on the github wiki)

Link to comment
Share on other sites

1 minute ago, Warsoul said:

But how it work ? I select the KSP Bumped Emissive shader ?

Did you look at the examples from the other mods?

You use config files to set the shaders and/or textures to be used for specific models.  You cannot do any of this in the Unity Editor, or through PartTools -- you have to use the config files (due to limitations of KSP and Unity, and how they load shaders).

Link to comment
Share on other sites

Okay, look like they are flat color based value ? We can't input our PBR maps from Substances Painter yet ?

Can we use multiple material per part or it's all flat grey metal Material for the entire mesh ?

Link to comment
Share on other sites

9 hours ago, Warsoul said:

We can't input our PBR maps from Substances Painter yet ?

Yes, you can use the Unity-PBR-Metallic preset in SP, and use the textures it outputs directly.  You will want to use the SSTU/PBR/Metallic shader, and set up the texture slots in the config files appropriately.


The gray /flat color based stuff is for using the 'Recoloring System'.  It is quite a bit more complex than the regular PBR shaders, and requires special texture setups.

 

Once again -- what exactly are you trying to do?  If you tell me what you are trying to accomplish, I can give precise instructions on how to do it.

 

Link to comment
Share on other sites

7Bzn3D8.png

I want to use my PBR Texture Set from substances Painter 2 into KSP to look like this : https://sketchfab.com/models/89ff537215474f588c3ffa317e92ff93

If i understand well;

1- Export Unity 5 Metal PBR maps from SP2018

2- Import Unity 5 Metal PBR maps into Unity 2017.4

3- Input Maps into Ksp\Emissive\Bumped+Specular

4- Add Textures Unlimited shaders to \gamedata

5- Add Metalic .cfg

6- Add Roughness .cfg

That's it ?

Edited by Warsoul
Link to comment
Share on other sites

So I'm running into an issue on 1.4.2 where if I install this and the James Webb Space Telescope, all of my ProbesPlus! Textures stop working. I have a slight suspicion that it's because ProbesPlus! hasn't been updated just yet, can you confirm this? If so it's not a big deal I'll just wait till things get updated to use them together.

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.

 Share

×
×
  • Create New...