Jump to content

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


Shadowmage

Recommended Posts

12 minutes ago, Electrocutor said:

Are you unable to reproduce the issue?

I'm not even really sure what problem you are talking about (no screenshots or videos), so I'm not sure what I'm supposed to be replicating.  The only thing even 'questionable' that I see when driving around the KSC in a highly reflective rover, is that the reflections visibly update every ~1 second, and when they do you can see the reflections of the buildings/etc 'jump' a bit.  This is by design, as it is not realistic to have real-time reflection updating, and is also a consequence of the reflection probe being centered on the vessel (and box-projection being disabled).  It is certainly less than optimal, but I'm willing to live with it.

If that is the problem you were experiencing, then yes, I can confirm it.  I cannot (easily) solve it however.  In order to solve it the reflection probes would need to remain stationary, have box-projection turned on, and a series of probes would have to be created in the trajectory of the current craft, and old ones destroyed.  Multi-probe blending would also need to be enabled, which I think needs to be done on a per-mesh basis.

Normal Unity scenes have multiple (non moving) reflection probes in them; it is the movement of the player/craft/camera relative to these reflection probes that gives the illusion of the reflected scenery changing (along with the multi-probe blending).  Simulating this setup in KSP would be... difficult at best.

Link to comment
Share on other sites

2 hours ago, Electrocutor said:

These screens were taken about 10 meters from each other at almost the same time, but one looks like it should be in broad daylight while the other after sunset when everything turns dark.

Apologies, I had not seen the edited/updated post with the screenshots.  Those images do demonstrate the problem quite well; it looks like it has lost the environment map/reflections entirely in the top image (black cockpit window).

The tests that I were doing were using the PBR/Metallic shader; I'll try and setup something similar to your example using the stock conversion shader and see how it goes.  If I still can't duplicate it, we'll have to check logs/setups/etc.

 

On a related note.. those conversions are looking pretty good for being the stock textures underneath it all.  Any thoughts on setting up an official conversion project/mod? (and how to pull it off without actually 'touching' the stock textures?)

Link to comment
Share on other sites

It's actually a mixed bag. Mk0, Mk1, Mk2, and Mk3 parts are already mostly setup with proper alpha specular on the diffuse. Everything else doesn't. So first I'll get those 4 cfgs. As far as my own "mod" there is no point so far as it is strictly a .cfg that you could put up for optional download. After I get the generics in place and have a full list of model/meshes, I will maybe work on making them look better using metallic maps and what have you.

It also occurs to me that Windowshine basically repackages everyone's textures, including stock and tons of mods; so there must be leeway somewhere.

 

Won't it be fun if v1.4 were to package all the Standard subshaders into KSP and we could do anything we wanted like normal Unity.

Edited by Electrocutor
Link to comment
Share on other sites

11 hours ago, Electrocutor said:

Won't it be fun if v1.4 were to package all the Standard subshaders into KSP and we could do anything we wanted like normal Unity.

That would be just my luck.

 

In general news, I've started working on the documentation/examples for the configs and shaders.  It will all be available on the TU wiki -- https://github.com/shadowmage45/TexturesUnlimited/wiki

Still fairly WIP, and likely you've figured out most if it already for your needs... but good to have it available regardless.

Link to comment
Share on other sites

9 minutes ago, RedParadize said:

@Electrocutor I would gladly take your patch if you mind packaging it into a mod. Perhaps its a good start at convincing more people to jump into shadowmage magic boat!

I'm a ways from getting done. If you just want the generic cfg I have so far for turning on metallic for Mk0, Mk1, Mk2, and Mk3; you can grab it here.

https://drive.google.com/open?id=0B_LTOcS7EtOyVEF6WUhPQzN6RzA

Link to comment
Share on other sites

Just now, Electrocutor said:

I'm a ways from getting done. If you just want the generic cfg I have so far for turning on metallic for Mk0, Mk1, Mk2, and Mk3; you can grab it here.

https://drive.google.com/open?id=0B_LTOcS7EtOyVEF6WUhPQzN6RzA


Thanks! Mks are pretty much the only thing I want. I rarely use stock part... I wonder if mods like NFT could be converted trough, that would be awesome.

Link to comment
Share on other sites

Does anyone else experiencing violent explosions/disassembles when staging PF fairings? I've tracked it down to  this add-on, removing it makes everything go back to normal.

Form the log after the explosion:

 

[LOG 23:06:20.928] DragCubeSystem: Rendering procedural drag for KW2mFairingPFE
[LOG 23:06:20.970] DragCubeSystem: Rendering procedural drag for KzProcFairingSide4
[LOG 23:06:20.999] DragCubeSystem: Rendering procedural drag for KzProcFairingSide4
[LOG 23:06:22.631] 11/14/2017 11:06:22 PM,ShipManifest-DfWrapper,Attempting to Grab DeepFreeze Types...
[LOG 23:06:27.175] SSTUReflectionManager vesselCreated() : KzProcFairingSide4 (Vessel) :: KSPShaderTools.ReflectionManager+VesselReflectionData
[LOG 23:06:27.177] SSTUReflectionManager vesselCreated() : KzProcFairingSide4 (Vessel) :: KSPShaderTools.ReflectionManager+VesselReflectionData
[LOG 23:06:27.417] [F: 56999]: KWsrbGlobeVI collided into Launch Pad - relative velocity: 31.24613 - no impact momentum (no RB)
[LOG 23:06:27.418] KWsrbGlobeVI Exploded!! - blast awesomeness: 0.5
[LOG 23:06:27.420] [strutConnector]: Deactivated
[LOG 23:06:27.427] SSTUReflectionManager vesselCreated() : launchClamp1 (Vessel) :: KSPShaderTools.ReflectionManager+VesselReflectionData
[LOG 23:06:27.429] SSTUReflectionManager vesselCreated() : launchClamp1 (Vessel) :: KSPShaderTools.ReflectionManager+VesselReflectionData
[LOG 23:06:27.436] [KWsrbGlobeVI]: Deactivated
[LOG 23:06:27.466] 1 explosions created.
[LOG 23:06:27.567] Flight State Captured
[LOG 23:06:27.567] Saving Achievements Tree...
[LOG 23:06:27.568] Saving Achievements Tree...
[LOG 23:06:27.569] [MessageSystem] Save Messages
[LOG 23:06:27.678] Game State Saved to saves/ISS/persistent
[LOG 23:06:31.206] Packing Dream Chaser Cargo Debris for orbit
[LOG 23:06:31.230] Unpacking Dream Chaser Cargo Debris
[WRN 23:06:38.834] [F: 57387]: Vessel Dream Chaser Cargo Debris crashed through terrain on Kerbin.
[LOG 23:06:38.836] KzProcFairingSide4 Exploded!! - blast awesomeness: 0.5
[LOG 23:06:38.837] [KzProcFairingSide4]: Deactivated

 

 

Thanks!

Link to comment
Share on other sites

9 minutes ago, Drakenex said:

Does anyone else experiencing violent explosions/disassembles when staging PF fairings? I've tracked it down to  this add-on, removing it makes everything go back to normal.

Form the log after the explosion:

 

[snip]

 

 

Thanks!

Interesting....  it really shouldn't be doing anything that would interfere with vessels/staging; all it does is add a reflection-probe to the newly created (staged) vessel.

Does it only occur when PF are used, or can it be triggered with stock fairings / other stock/mod parts as well?

Link to comment
Share on other sites

5 minutes ago, Drakenex said:

Does anyone else experiencing violent explosions/disassembles when staging PF fairings? I've tracked it down to  this add-on, removing it makes everything go back to normal.

Yep, happened to me last night launching a mun fly-by using Procedural Fairings.  All was well until I tried to stage the fairings, then kaboom.

Didn't realize at the time what was causing it, thought I must have accidentally clipped some parts.

I'm running 1.3, BTW.

Link to comment
Share on other sites

1 minute ago, Shadowmage said:

Interesting....  it really shouldn't be doing anything that would interfere with vessels/staging; all it does is add a reflection-probe to the newly created (staged) vessel.

Does it only occur when PF are used, or can it be triggered with stock fairings / other stock/mod parts as well?

Only happens with PF, stock fairings are fine

Happens on 1.3.0 and 1.3.1

 

Thanks for the quick response!

Link to comment
Share on other sites

@Drakenex / @Foozle

Hmm... someone please open an issue ticket on this so we can start tracking details.  I don't personally use PF, so I'll need to gather a bit more data/etc than usual in order to do debugging (craft files and whatnot).

If you can provide an otherwise stock craft file (stock + PF) that can duplicate the problem it would be much appreciated ( so that when I get to debugging, I'll only need to track down and download/install PF, copy the craft, and then I can get to debugging).

Link to comment
Share on other sites

11 minutes ago, Shadowmage said:

@Drakenex / @Foozle

Hmm... someone please open an issue ticket on this so we can start tracking details.  I don't personally use PF, so I'll need to gather a bit more data/etc than usual in order to do debugging (craft files and whatnot).

If you can provide an otherwise stock craft file (stock + PF) that can duplicate the problem it would be much appreciated ( so that when I get to debugging, I'll only need to track down and download/install PF, copy the craft, and then I can get to debugging).

Done and done (Issue #10)

Thanks again

Link to comment
Share on other sites

Just now, Shadowmage said:

Thanks; hopefully I'll get a chance to dig into it sometime this week.  Not fond of explosion causing incompatibilities (nor of mysteries, which this currently is).

Well, we sadly have to announce that JWST launch will be delayed because of integration problems  with its Ariane 5 launcher :sticktongue:

Thanks for looking into this!

Link to comment
Share on other sites

Okay, the first run of Space Plane stuff is finished.

Contents:

  • Mk0
  • Mk1
  • Mk2
  • Mk3
  • Air Engines
  • Wings
  • Wheels

https://drive.google.com/open?id=1UDpX8xovVpL0q0RBtDMUC3FXQxbPHG5O

 

Question for anyone using this on stock parts: do you want me to try to use color tinting to match the Panther and Inline Docking Port colors to all the other Mk1 parts?

Edited by Electrocutor
Link to comment
Share on other sites

Updated release is available:

https://github.com/shadowmage45/TexturesUnlimited/releases/tag/0.9.0.2

Fixes the explosion problems with PF and other staging actions.  Also a few very minor code-side changes.  This release is just to get the explosion fix out ASAP; another release will be forthcoming this weekend with some updated shaders, more fixes, and more options/configuration.

Link to comment
Share on other sites

2 hours ago, Shadowmage said:

Updated release is available:

https://github.com/shadowmage45/TexturesUnlimited/releases/tag/0.9.0.2

Fixes the explosion problems with PF and other staging actions.  Also a few very minor code-side changes.  This release is just to get the explosion fix out ASAP; another release will be forthcoming this weekend with some updated shaders, more fixes, and more options/configuration.

Wow!

So, what was the issue, out of curiosity?

---

JW (and much, much more) here I come!

---

Eventually

Edited by Foozle
KSP still loading... I have too many mods
Link to comment
Share on other sites

7 hours ago, Electrocutor said:

Okay, the first run of Space Plane stuff is finished.

Contents:

  • Mk0
  • Mk1
  • Mk2
  • Mk3
  • Air Engines
  • Wings
  • Wheels

https://drive.google.com/open?id=1UDpX8xovVpL0q0RBtDMUC3FXQxbPHG5O

 

Question for anyone using this on stock parts: do you want me to try to use color tinting to match the Panther and Inline Docking Port colors to all the other Mk1 parts?

I just did a quick test with the stock Ravenspear MK3, replacing the engines for rapiers and adding an MK2 nose cone from MK2 Expansion for comparison. Honestly, I don't know about the Panther and the Inline docking port because I didn't check them. I think the issue is unifying the look of all the parts, at least those from a single mod/stock.

See

https://imgur.com/pwrNRGy

Both the winglets and the RCS tanks stand out because of their differences. The MK2 nose cone, which uses the stock textures, obviously do so as well, but it's obviously up to each mod maker to take advantage of this mod or nott.

 

Link to comment
Share on other sites

1 hour ago, Shadowmage said:

Updated release is available:

https://github.com/shadowmage45/TexturesUnlimited/releases/tag/0.9.0.2

Fixes the explosion problems with PF and other staging actions.  Also a few very minor code-side changes.  This release is just to get the explosion fix out ASAP; another release will be forthcoming this weekend with some updated shaders, more fixes, and more options/configuration.

You sir, continue to be a hero.

Link to comment
Share on other sites

40 minutes ago, Foozle said:

So, what was the issue, out of curiosity?

Long Version (and lots of fun technical bits):

In order to get the reflection probes to capture the KSP layered-rendering setup properly I had to develop some fun workarounds.  In its current implementation this involves rendering a cube-map of the current environment layer-by-layer, applying this cube-map texture to the interior of a sphere, and allowing the reflection probe to capture the image of the inside of the sphere.  Layer-masks are used to ensure the probe only captures the sphere and nothing else; the sphere is actually on layer 26, the 'wheel-collider-ignore' layer, as I knew in advance that this layer was not rendered on any of KSPs cameras.

One of these sphere/probe pairs are created for every Vessel and follows the vessel around.  Procedural fairings, when they are staged, each become their own 'vessel' (debris).  Now when the sphere is created initially by Unity code it is automatically given a SphereCollider.  I was already aware of this and had code in place that handled the deletion of the collider.  But... I was using the 'lazy' deletion method that waits until the end of frame to delete the object ( GameObject.Destroy() ).  So a giant 10m sphere collider existed on each of the jettisoned fairing panels for a single frame, which was long enough to cause explosions and/or collision problems (unsurprisingly).  Stock fairings do not create vessels when staged, only some non-persistent debris.

To solve the problem I simply had to switch over to the 'do-it-now' deletion method ( GameObject.DestroyImmediate() ).  The colliders no longer exist when physics are updated, and thus, no explosions.  Definitely took longer to track down the problem than to fix it, but I'm okay with that.

 

Short Version:  Unity was delaying the deletion of a collider by 1 frame, which was just enough to cause problems.

 

@juanml82 from the look in your screenshot it would appear that reflections have not been enabled on your installation.  There is a config patch floating around somewhere that will do so (likely on the first page of the thread).  You can also edit the reflection config file in TexturesUnlimited itself; there is a line that reads 'enabled = false', change it to 'enabled = true'.

Will probably make a notable difference in the visuals :)

Link to comment
Share on other sites

6 minutes ago, Shadowmage said:

@juanml82Long Version (and lots of fun technical bits):

<snip, lots of really, really good stuff>

Will probably make a notable difference in the visuals :)

Thank you!

This makes everything much less opaque.
SO much better than "because reasons".

-----

Aso means folks at large are more likely to be able to troubleshoot problems in the future

Edited by Foozle
On second thought....
Link to comment
Share on other sites

58 minutes ago, juanml82 said:

I just did a quick test with the stock Ravenspear MK3, replacing the engines for rapiers and adding an MK2 nose cone from MK2 Expansion for comparison. Honestly, I don't know about the Panther and the Inline docking port because I didn't check them. I think the issue is unifying the look of all the parts, at least those from a single mod/stock.

See

https://imgur.com/pwrNRGy

Both the winglets and the RCS tanks stand out because of their differences. The MK2 nose cone, which uses the stock textures, obviously do so as well, but it's obviously up to each mod maker to take advantage of this mod or nott.

 

Parts using fundamentally different shaders are just going to look different, only way to suppress those differences is by suppressing all the value out of a PBR shader with correct metal/rough surface values and accurate environmental reflections.

Link to comment
Share on other sites

1 hour ago, juanml82 said:

I just did a quick test with the stock Ravenspear MK3, replacing the engines for rapiers and adding an MK2 nose cone from MK2 Expansion for comparison. Honestly, I don't know about the Panther and the Inline docking port because I didn't check them. I think the issue is unifying the look of all the parts, at least those from a single mod/stock.

See

https://imgur.com/pwrNRGy

Both the winglets and the RCS tanks stand out because of their differences. The MK2 nose cone, which uses the stock textures, obviously do so as well, but it's obviously up to each mod maker to take advantage of this mod or nott.

 

The RCS tank is in the 1.25m cfg that I am currently working on as it is not a Mk1 part.

As for expansion mods where parts need to match as long as they followed PorkJet's example to make their additional parts the same, they will also match when PBR gets turned on for them. It seems to me that Porkjet spent the time to make sure his parts had proper specular masks, which makes them easily be converted to metal.

As for 1.25m parts matching the Mk1 parts in metallicy ; I can do that simply by adjusting their colors and manually assigning a specular that causes them to match, but I'm looking at these mostly all-silver tanks and thinking that it makes sense to have a metallic space plane; but usually on rockets they paint them all white; covering all the metal; but then again the shuttle is white as well.

Choices, choices...

 

[Update]
As for the rocket fins: thanks for the heads-up; they were set to the wrong shader. Although, they may end up staying white instead depending on what I do for the 1.25m parts.

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