Sigma88 / Sigma-Dimensions

The Universal Rescale Mod for KSP
Other
24 stars 7 forks source link

Falling Through Terrian on SD with OPM #95

Open Nicias opened 4 years ago

Nicias commented 4 years ago

I'm using SD with RESCALEx10 and OPM on KSP 1.9.1.

Every OPM body I try to land on I fall through the surface and explode. It doesn't happen with stock planets or OPM without SD>

Sigma88 commented 4 years ago

if it doesn't happen with the stock planets it might be an issue with something OPM planets use that the stock planet don't use

@poodmund idk if you are still maintaining opm, if you do and want to look into this feel free to ping me for help if you find what might be causing the issue.

I would look into it myself but I don't have that much free time to dedicate to ksp anymore

Poodmund commented 4 years ago

Like Nicias has said, it doesn't occur when S:D is not used/any bodies are rescaled but they did include their logs here: https://filebin.net/oedgokihhbx529np which shows a NullRef occurring when they focus to a vessel orbiting the most distant planet, Plock. I do not know if they teleported the vessel there and then didn't save/re-load for example as I know sometimes things like this cause issues with LOD on the mesh. This is the null ref part in question:

[LOG 12:20:18.445] [PlanetariumCamera]: Focus: Untitled Space Craft
[LOG 12:20:21.542] [OD] --> ScaledSpaceDemand.LoadTextures loading OPM/OPM_Textures/PluginData/Karen_color.dds and OPM/OPM_Textures/PluginData/Karen_normal.dds
[LOG 12:20:22.235] [Kopernicus] No new objects this time. (Probability is 50%)
[LOG 12:20:22.235] [Kopernicus] No new objects this time. (Probability is 15%)
[LOG 12:20:22.235] [Kopernicus] No new objects this time. (Probability is 15%)
[LOG 12:20:24.061] Warping to UT:10010.1. Max Rate Allowed: 5.0x.
[LOG 12:20:24.100] Packing Untitled Space Craft for orbit
[LOG 12:20:25.276] [OD] <--- OnDemandStorage.DisableBodyCBMaps destroying Karen
[LOG 12:20:25.276] [OD] <--- OnDemandStorage.DisableBodyCBMaps destroying Nissee
[LOG 12:20:25.276] [OD] <--- OnDemandStorage.DisableBodyCBMaps destroying Thatmo
[LOG 12:20:25.276] [OD] <--- OnDemandStorage.DisableBodyCBMaps destroying Tal
[LOG 12:20:25.276] [OD] <--- OnDemandStorage.DisableBodyCBMaps destroying Wal
[LOG 12:20:25.276] [OD] <--- OnDemandStorage.DisableBodyCBMaps destroying Priax
[LOG 12:20:25.277] [OD] <--- OnDemandStorage.DisableBodyCBMaps destroying Polta
[LOG 12:20:25.277] [OD] <--- OnDemandStorage.DisableBodyCBMaps destroying Tekto
[LOG 12:20:25.277] [OD] <--- OnDemandStorage.DisableBodyCBMaps destroying Slate
[LOG 12:20:25.277] [OD] <--- OnDemandStorage.DisableBodyCBMaps destroying Eeloo
[LOG 12:20:25.277] [OD] <--- OnDemandStorage.DisableBodyCBMaps destroying Ovok
[LOG 12:20:25.277] [OD] <--- OnDemandStorage.DisableBodyCBMaps destroying Hale
[LOG 12:20:25.296] Camera Mode: AUTO
[LOG 12:20:25.298] [ApplicationLauncher] SetVisible: 
[LOG 12:20:25.302] ScaleModList: listSize 287 maxListSize 614
[LOG 12:20:26.857] [PQ] Edge in GetRightmostCornerPQ is null! Caller: Plock Zn2 (PQ) nextQuad: Plock Xp2 (PQ)
[LOG 12:20:26.858] [PQS] cornerQuad in GetRightmostCornerNormal is null! caller: Plock Zn20 (PQ) nextQuad: Plock Xp2 (PQ)
[LOG 12:20:26.858] [PQS] Last edge accessor in GetRightmostCornerNormal is null! Caller: Plock Zn20 (PQ) nextQuad: Plock Zn02 (PQ) cornerQuad Plock Xn0 (PQ)
[EXC 12:20:26.873] NullReferenceException: Object reference not set to an instance of an object
    PQ.GetRightmostCornerPQ (PQ nextQuad) (at <394a98b9c7624adc895c04290da62640>:0)
    PQS.GetRightmostCornerNormal (PQ caller, PQ nextQuad) (at <394a98b9c7624adc895c04290da62640>:0)
    PQS.UpdateEdgeNormals (PQ q) (at <394a98b9c7624adc895c04290da62640>:0)
    PQS.UpdateEdges () (at <394a98b9c7624adc895c04290da62640>:0)
    PQS.UpdateQuads () (at <394a98b9c7624adc895c04290da62640>:0)
    PQS+<UpdateSphere>d__144.MoveNext () (at <394a98b9c7624adc895c04290da62640>:0)
    UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <7d9ec060e791409ab3eb85c61e312ed6>:0)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
    UnityEngine.Debug:CallOverridenDebugHandler(Exception, Object)
[WRN 12:20:26.907] Cannot find preset 'High' for pqs 'Plock'
[EXC 12:20:27.008] NullReferenceException: Object reference not set to an instance of an object
    PQ.GetRightmostCornerPQ (PQ nextQuad) (at <394a98b9c7624adc895c04290da62640>:0)
    PQS.GetRightmostCornerNormal (PQ caller, PQ nextQuad) (at <394a98b9c7624adc895c04290da62640>:0)
    PQS.UpdateEdgeNormals (PQ q) (at <394a98b9c7624adc895c04290da62640>:0)
    PQS.UpdateEdges () (at <394a98b9c7624adc895c04290da62640>:0)
    PQS.UpdateQuads () (at <394a98b9c7624adc895c04290da62640>:0)
    PQS+<UpdateSphere>d__144.MoveNext () (at <394a98b9c7624adc895c04290da62640>:0)
    UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <7d9ec060e791409ab3eb85c61e312ed6>:0)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
    UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    PQS:StartSphere(Boolean)
    PQS:RebuildSphere()
    PQS:Update()
[ERR 12:20:27.008] PQS Plock: Restarted

[WRN 12:20:27.043] Cannot find preset 'High' for pqs 'Plock'
[EXC 12:20:27.134] NullReferenceException: Object reference not set to an instance of an object
    PQ.GetRightmostCornerPQ (PQ nextQuad) (at <394a98b9c7624adc895c04290da62640>:0)
    PQS.GetRightmostCornerNormal (PQ caller, PQ nextQuad) (at <394a98b9c7624adc895c04290da62640>:0)
    PQS.UpdateEdgeNormals (PQ q) (at <394a98b9c7624adc895c04290da62640>:0)
    PQS.UpdateEdges () (at <394a98b9c7624adc895c04290da62640>:0)
    PQS.UpdateQuads () (at <394a98b9c7624adc895c04290da62640>:0)
    PQS+<UpdateSphere>d__144.MoveNext () (at <394a98b9c7624adc895c04290da62640>:0)
    UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <7d9ec060e791409ab3eb85c61e312ed6>:0)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
    UnityEngine.Mono

Seeing as it doesn't occur when S:D is not be used I am not really sure as what to suggest. I will wait until you've seen this log above to get your comment before any further investigation.

Sigma88 commented 4 years ago

Sadly those logs don't really tell anything to me. could be anything.

since it says Cannot find preset 'High' for pqs 'Plock' it could be that the plock cfg is not including some information and kopernicus just doesn't generate the proper materials for it. but why it wouldn't happen without SD, I have no idea

expecially since the stock planets don't have this issue.

what I would do if I had time would be to strip plock from bits of code until you don't see the issue anymore.

I would expect that clearing everything from the PQS node should do the trick. This is something that the latest versions of kopernicus do that I don't really like, when you try editing some PQS stuff they lose all the info from the template and force you to define all the materials and everything from scratch.

tbh I don't know why this would not occur on stock planets but only custom planets, and also why it does happen only with SD.

but at least there's a starting point.

another trick could be to check the mm cache for differences in the plock node between a normal install and a SD install because SD somewhat changes the nodes so it might be adding something that you don't expect to the node.

Poodmund commented 4 years ago

The "Cannot find preset 'High' for pqs 'Plock'" messages show for all modded bodies but thats always been the case for years.

I've cleared all the cached .bin meshes and regenerated them and I'm stil experiencing the issue so I'll look into it some more to see if I can find the culprit.

Sigma88 commented 4 years ago

I would be surprised if caches were an issue however SD makes Kopernicus regenerate caches so if you ship old ones with OPM that might actually be a point of difference worth checking as well

Poodmund commented 4 years ago

I deleted all cached meshes from the installs and ran them with and without S:D, put a craft in Plock orbit (new Sandbox save), saved and reloaded to refresh the scene and went down to Plock's surface.

Without S:D it was fine and touched down directly on the surface but with S:D and the bodies rescaled the above issue occurred. I have looked through the Kopernicus and MM Cache logs but can't really identify exactly where this issue is coming from.

I use a program called Beyond Compare to compare the text files side by side to see the differences. Not sure if you have a similar program to do so. Here are all the logs: https://www.dropbox.com/s/o8tr5mhlk5ljopw/OPM_Rescale_Issue_Logs.zip?dl=0 I edited the Kopernicus/Plock.Body - TimestampsRemoved.log logfiles to remove the timestamps to be able to see where the differences are more easily.

The files I've specifically compared are the Kopernicus Plock body log and the MM Cache and the only thing I can see that might affect the mesh thats not to do with the specific mesh generation by S:D is that the line minDetailDistance = 6 gets changed to minDetailDistance = 2.22222222222222. I'm not sure if that would have this effect?

Sigma88 commented 4 years ago

the mesh is only used in scaled space so I would doubt it has anything to do with PQS issues, let me check the mm caches and I will get back to you about those.

Sigma88 commented 4 years ago

I agree, the only relevant difference seems to be the minDetailDistance = 2.22222222222222 could you try adding this small cfg and see if it fixes plock?

@Kopernicus:FINAL
{
    @Body[Plock]
    {
        @PQS
        {
            @minDetailDistance = 6
        }
    }
}
Sigma88 commented 4 years ago

I might need to edit SD so that it doesn't change mindetaildistance, even though I fail to see why that would cause any issues honestly

Sigma88 commented 4 years ago

ah, ha!

I think I found something that might be an issue, not 100% sure.

you don't seem to have a materialType defined in the PQS node for plock, this might be bad with the latest kopernicus.

since plock uses Moho as a template I assume you want it to have the same materialType:

https://github.com/Kopernicus/kittopia-dumps/blob/master/Configs/Moho.cfg#L186

( = materialType = AtmosphericMain)

you should also try adding that to the plock cfg

Nicias commented 4 years ago

I think that minDetailDistance fix works. I used that patch and I could land on Plock. I also checked and Thatmo.cfg has the same 6, so I added Thatmo to the same patch and set it's minDetailDistance to 6 and it worked as well. Is there a way to do this for all of the OPM planets in one @Body? (rather than 11, also, it seems that minDetailDistance is 8 for Tekto, I assume I should set it to 8?)

Poodmund commented 4 years ago

ah, ha!

I think I found something that might be an issue, not 100% sure.

you don't seem to have a materialType defined in the PQS node for plock, this might be bad with the latest kopernicus.

since plock uses Moho as a template I assume you want it to have the same materialType:

Kopernicus/kittopia-dumps:Configs/Moho.cfg@master#L186

( = materialType = AtmosphericMain)

you should also try adding that to the plock cfg

Ah, you are right. I should do this to be explicit. Eventually all the bodies will transfer to the new Triplaner shader but I should state which material they are using for the time being.

@Nicias, to be honest I would just wait for a Sigma:Dimensions update if this minDetailDistance issue is the resolution.

Weirdly, I've also been experiencing similar issues with ground scatter on stock bodies floating above or below the surfaces. This can be resolved by quick-saving and quick-loading but the issue appears again when you travel around towards the other side of the body (basically far away). I wonder if this issue also has anything to do with that. I'll test it out.

Poodmund commented 4 years ago

Just tested with the minDetailDistance patch and it seems to resolve the issue.

Nicias commented 4 years ago

I don't mind using the patch for now. I checked it out for all of the bodies that have minDetailDistance defined, and it works for all of them. But Nissee and Tal don't have it defined, what should I use for the minDetailDistance for them?

Sigma88 commented 4 years ago

@Nicias you can skip the patches, go into SD files and delete these two lines: https://github.com/Sigma88/Sigma-Dimensions/blob/master/GameData/Sigma/Dimensions/Configs/ReDimension/resizePQSMods.cfg#L11-L12

Nicias commented 4 years ago

That change fixed it. Thanks!