Jump to content

IVAs with no windows or internal light source still letting outside light in


Recommended Posts

6 hours ago, Nils277 said:

Hey @sumghai

here is a Unity Package with one of my most recent IVAs: CrewCabin.unitypackage.
It contains the model as Blender File. The shadows are cast correctly from it. Hope this helps.

Which version of Unity and PartTools was that unitypackage for?

I first tried importing it into my Unity 5.2.4f1 project that had PartTools 1.1.2, but all the material shaders became invalid. I then tried importing the same package in Unity 4.2.2f1 with an older version of PartTools, and the materials shaders were replaced with non-KSP diffuse ones.

6 hours ago, Nils277 said:

Btw, i get rid of the leaking edges by having an additional mesh without any sharp egdes (in blender). When set to the right shader (KSP/Alpha/Unlit/Transparent) it does not cause any interference with stock cutout or portraits.  

In my current WIP, I have a cylinder with outward-facing normals and filleted edges. While I haven't figured out how to block shadows completely, the rounded edges do at least soften lights/shadows being cast inside.

6 hours ago, Nils277 said:

Edit: If this does not help, could you upload one of your problematic models? Maybe we find something fishy in it that causes your problem :wink: 

I'll get the files to you tomorrow. In the meantime, a quick screenshot (Unity 5.2.4f1 / PartTools 1.1.2):

c7CJ8Ac.png

Link to comment
Share on other sites

54 minutes ago, sumghai said:

Which version of Unity and PartTools was that unitypackage for?

Oh yeah forgot to mention that, sorry. I use Unity 5.2.4f1 with the newest parttools. But i added the shaders from porkjets PartOverhauls, because the newest 'official' parttools are missing e.g. the shader for internal spaces. Additionally i'm not able to load most of the props when LightingKSP.cginc is not available in the Squadcore folder.

Here is the full setup of my parttools: PartToolsSetup.unitypackage

Oh, i took the liberty to look at the internal model from your GitHub repository. (Imported the .mu in Blender) And all the meshes look perfectly normal to me.
Will make a unity setup tomorrow and and see what it looks like in game. 

Edited by Nils277
Link to comment
Share on other sites

On 24/11/2016 at 8:20 AM, Nils277 said:

Oh yeah forgot to mention that, sorry. I use Unity 5.2.4f1 with the newest parttools. But i added the shaders from porkjets PartOverhauls, because the newest 'official' parttools are missing e.g. the shader for internal spaces. Additionally i'm not able to load most of the props when LightingKSP.cginc is not available in the Squadcore folder.

Here is the full setup of my parttools: PartToolsSetup.unitypackage

Ah, the elusive Porkjet shaders!

I'll take another look later today - thanks!

On 24/11/2016 at 8:20 AM, Nils277 said:

Oh, i took the liberty to look at the internal model from your GitHub repository. (Imported the .mu in Blender) And all the meshes look perfectly normal to me.
Will make a unity setup tomorrow and and see what it looks like in game. 

You may wish to redownload the internal model - I just pushed a commit that (for now) strips out all my depth mask and border stuff, leaving only the internal mesh I'm attempt to block exterior lighting with.

Link to comment
Share on other sites

@Nils277

I encountered some complications while importing your PartTools unitypackage.

As I already had my own copy of PartTools, the import process created new copies of your shaders rather than overwriting mine. A closer look reveals that each Unity asset (Material, Shader etc.) are all given unique GUIDs - this means that for instance, your Unlit shader will have a different GUID from my Unlit shader, even if the actual shader definitions were 100% identical. It took me a good part of an hour to manually merge everything so that my existing Unity project files would use your new(er) Shader definitions.

Once the manual merging was done, I was able to import your CrewCabin package - again, more manual merging was needed to make your materials reference the consolidated shader definitions on my computer. Some of your (apparently unused) materials still broken because they referenced invalid shaders not included in your PartTools package.

The take home lesson: Perhaps sharing screenshots of how each material/mesh were configured may be better.

 

Coming back to the original issue...

I examined your crew cabin part, and copied way you set up the shadow casting mesh to my own dummy internal model. I definitely saw some improvements (no more light leaks), and the IVAs look dimmer, but testing in orbit shows that external light is still passing through the windowless airlock interior.

I have to confess that I became a bit frazzled from testing various permutations and combinations of shaders/material configurations, so what you get from my latest GitHub repo commit may not reflect what I have running on my laptop right now.

Link to comment
Share on other sites

So are we postulating that ivas need, a visible model, a mask model, a border model (to make outlined edges for externally viewed cutouts that reveal iva interiors), and an occlusion model to block external light??

Is the occlusion mesh yet another mu file or is it a child of the visible model in unity?

Link to comment
Share on other sites

2 hours ago, tg626 said:

So are we postulating that ivas need, a visible model, a mask model, a border model (to make outlined edges for externally viewed cutouts that reveal iva interiors), and an occlusion model to block external light??

Is the occlusion mesh yet another mu file or is it a child of the visible model in unity?

In theory, the visible model should already act as an occlusion model as well, but to my knowledge this behaviour has been inconsistent across stock parts, even after various backend fixes by the developers.

Link to comment
Share on other sites

1 hour ago, sumghai said:

In theory, the visible model should already act as an occlusion model as well, but to my knowledge this behaviour has been inconsistent across stock parts, even after various backend fixes by the developers.

Well that was my thought too, but I could also see the game being goofy and working better with a simplified occlusion mesh - a sort of "light collider" as it were.  Even tho, like I said, it would be goofy...  I wanted to be sure I "got" the concept being discussed and ask where in the unity hierarchy such a mesh would be.  I have an IVA where I can see light inside as if there were a gap between the sides and walls even tho no such gap exists to the eye or mathematically (vertices and coords) for that matter.

Edited by tg626
Link to comment
Share on other sites

Hey @sumghai

you are right, a screenshot would have been way easier.

I might have found something though:
I tested the IVA that is in the repository on Github as well as a version i exported. Before saving the imported .mu file in Blender, i rotated the model by 90° to compensate the weird 90° rotation which Unity adds when it loads models from blender.
In game though, the rotation was off by 90°. But was exactly like the one in your screenshot.

For me though, the IVA is correctly rotated with this setup:

bPAUFmt.png

And my IVA is shadowed. Except for the specuar light on the prop. The specular light does not seem to be reduced when in shadow, which is why is set its color to 40/40/40 at most for all internl parts.

Long story short, can you check to which layer you set the Kerbals layer to? It should be layer 16. I suspect it might not be set to 16. Btw, to prevent confusion, i named layer 16 in my setup Internal Space
Additionally, is the whole setup in unity in this layer or just the model? I just put everything on layer 16 any a few part to 20. 

Edited by Nils277
Link to comment
Share on other sites

@Nils277 - My Kerbals layer is definitely set to Layer 16, and I too usually put all my internals and props on that layer.

16 hours ago, Nils277 said:

I might have found something though:
I tested the IVA that is in the repository on Github as well as a version i exported. Before saving the imported .mu file in Blender, i rotated the model by 90° to compensate the weird 90° rotation which Unity adds when it loads models from blender.
In game though, the rotation was off by 90°. But was exactly like the one in your screenshot.

For me though, the IVA is correctly rotated with this setup:

What you're saying here doesn't sound right to me - my .MU file already had the orientation corrected in-game to start with, so when you re-imported it into Blender/Unity and added your own rotational values, you've actually compounded the number of orientation errors.

(NB: I've successfully made and correctly-oriented IVAs up to KSP 1.0.5 - it's just this shadow casting business that has thrown me for a loop)

Link to comment
Share on other sites

On 25.11.2016 at 0:38 AM, tg626 said:

So are we postulating that ivas need, a visible model, a mask model, a border model (to make outlined edges for externally viewed cutouts that reveal iva interiors), and an occlusion model to block external light??

Is the occlusion mesh yet another mu file or is it a child of the visible model in unity?

I had tried a very basic iva consisting of this layout and it was not working. The occlusion model did not block any lights.

Link to comment
Share on other sites

 

@sumghai Sorry, i did not intent to insinuate you to make rookie mistakes. Just thought, that it might have been a small oversight when migrating to unity 5.2.4 for KSP 1.1.
The rotation was the only thing i saw which was different from what you have and thought that different orientation + problem with IVA is a strong indicator for a problem with the layers.

The setup you use in the screenshots is exactly the same as i do for Parts and IVAs, except for the non-convex Mesh Collider you have added in Unity. But i doubt this can cause problems with the light. Other than that, i'm out of ideas, sorry. 

Edited by Nils277
Link to comment
Share on other sites

5 hours ago, Nils277 said:

@sumghai Sorry, i did not intent to insinuate you to make rookie mistakes. Just thought, that it might have been a small oversight when migrating to unity 5.2.4 for KSP 1.1.
The rotation was the only thing i saw which was different from what you have and thought that different orientation + problem with IVA is a strong indicator for a problem with the layers.

S'all good :)

5 hours ago, Nils277 said:

The setup you use in the screenshots is exactly the same as i do for Parts and IVAs, except for the non-convex Mesh Collider you have added in Unity. But i doubt this can cause problems with the light. Other than that, i'm out of ideas, sorry. 

The mesh collider was left over from another experiment, and I agree that it shouldn't have anything to do with lighting.

Aye, no worries.

By the way, I found the original bug report for this issue (#8439). It appears that a fix was partially implemented, but there were mixed results even in stock modules.

Perhaps the way the game is set up right now, cutouts in the IVA mesh let 100% of the external light in, while the walls let in around 50% - I'm aiming for complete blocking of external light, since I want to use JSI RPM to switch internal lights on and off. I might be able to test this by cutting some holes in my IVA, and seeing if the openings are letting more light in that the walls.

Link to comment
Share on other sites

I think I can confirm my theory!

I made a copy of my placeholder IVA and cut some windows in the internal mesh - the cutout spots were definitely brighter than shaded areas, so some occlusion is happening, but the walls aren't completely blocking out outside light:

iiSeQCK.png

Link to comment
Share on other sites

@sumghai That sounds true. Just remembered that the InternalSpace shader uses one layer of the lightmap for ambient light (the blue channel). I remember when playing around with this Shader in 1.1 that an IVA had a reddish tint on Duna although it did not have the InternalSpace shader applied. Maybe a portion of ambient light is applied to all internal without that shader. You could try to use the InternalSpace shader with a lightmap that is completely dark in the blue channel. I also think that the strenght of the ambient light can be adjusted in Unity. Might be worth a try

Edited by Nils277
Link to comment
Share on other sites

Zcy5vF5.png

So I took my windowless placeholder internal model, and replaced the shader with KSP/InternalSpace, cranking down the Shininess and Ambient Boost values. I also made sure that the _LightMap image was actually black in all three color channels.

However, I'm still seeing ambient light inside the windowless internal.

Link to comment
Share on other sites

Hope he still sees this thread. Has not been online for quite a while.

Another fake approach might be to use a Shader that allows to multiply to diffuse texture with a color (I think e.g. the emissive one can do this) and add a plugin module that changes the color between black and white depending on the color/intensity of the lights.

This could make the IVA model completely dark. The problem might be that the kerbal will probably still be lit. Maybe a black plane in front of his/her face that is made transparent depending on the status of the light via a module might work for the portraits? The Kerbal would still be lit in the Cutaway view though...

 

 

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