Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScaledSpace OnDemand Loading and Scatterer #244

Closed
StollD opened this issue Nov 18, 2017 · 6 comments
Closed

ScaledSpace OnDemand Loading and Scatterer #244

StollD opened this issue Nov 18, 2017 · 6 comments

Comments

@StollD
Copy link
Member

StollD commented Nov 18, 2017

So multiple persons on the Kopernicus discord told me that using ScaledSpace OnDemand-Loading messes up Scatterer. Since Kopernicus destroys the textures as soon as the planet doesn't get rendered anymore, I would assume that Scatterer tries to use the textures somewhere, when it is unloaded and therefore null. But I can't seem to figure out where it does that in the C# part of the code (I haven't looked through the shaders yet.)

@LGhassen any hints or ideas about this?

@LGhassen
Copy link
Contributor

LGhassen commented Nov 21, 2017

Scatterer doesn't use the planet textures, but maybe on demand loading does something more, like mess with the celestialBody or the scaled transform?

Edited: Actually maybe you destroy the scaled object's material? That would probably cause a nullref in scatterer, can you confirm if you do this? Would be an easy thing to fix on my side.

@Sigma88
Copy link
Contributor

Sigma88 commented Nov 21, 2017

@StollD have you confirmed the bug yourself? it wouldn't be the first time that people run a game with a gazillion mods, find a bug and then blame two random mods for those bugs

@StollD
Copy link
Member Author

StollD commented Nov 23, 2017

Actually I haven't confirmed it, but since neither me nor blackrack were able to figure out why it could or would do that, I think it is safe to say that Kopernicus and scatterer aren't the cause of the problem.

I will investigate this further as soon as I got time again (which is in one week)

@LGhassen
Copy link
Contributor

LGhassen commented Dec 2, 2017

@StollD I tried to reproduce this today with Kopernicus 1.3.1-3 and scatterer and I couldn't, let me know when you have more information or still need help.

@StollD
Copy link
Member Author

StollD commented Dec 2, 2017

I actually figured out what was happening yesterday.

Because of something that scatterer is doing (I suspect the Post Processing mesh in front of the camera), OnBecameVisible and OnBecameInvisible aren't called on the script that Kopernicus attaches to the Scaled Space object. I solved this by calculating the on-screen position of the object and checking if it is inside of the bounds and bigger than 1px.

@LGhassen
Copy link
Contributor

LGhassen commented Dec 2, 2017

It's plausible but that would also mean that the OnBecameVisible/Invisible callbacks are possibly doing something very expensive like raycasting to check for visibilty AND occlusion instead of just checking if the object is inside the camera frustum.

I will try to find information on how these callbacks work but in any case good to know you have a workaround.

@StollD StollD closed this as completed May 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants