Jump to content

[1.12.x] Parallax - PBR Terrain and Surface Objects [2.0.8]


Gameslinx

Recommended Posts

Hi there! I dunno if anyone else is experiencing this or not, but I've been having a weird bug with Parallax recently. I have EVE, Scatterer, and True Volumetric Clouds installed, as well as the Kcalbeloh mod, and for some reason, my planets are coming out all frosty and white, like they're covered in ice and snow. Lovely for Eeloo, less great for gorgeous planets like Eve or Laythe. I'd add the screenshots I've taken of the issue, but I have no idea how to add an image via URL. Same problem with the logs that I've got - I have them, but I dunno how to post them here.

Link to comment
Share on other sites

Hmm. The issue got weirder - sometimes when I enter a planet's sphere of influence, its surface just straight up doesn't load. Like it'll be pure white, rather than frosty white - no water, no mountains, nuthin. And then, seemingly at random, it'll snap back into existence. What is happening??

Link to comment
Share on other sites

8 hours ago, Dragonlover1201 said:

I'd add the screenshots I've taken of the issue, but I have no idea how to add an image via URL

Yeah, it's a bit arcane.  You need to upload your pics to a file sharing service, such as Imgur, and post links.  Read this article for more help reporting KSP issues with modded installs.  I would highly recommend posting links to log files, iaw that article, every time.  While sometimes it's unnecessary, diagnosis is often faster with it available to the wisest among us.

 

Edited by Brigadier
Link to comment
Share on other sites

On 7/23/2024 at 9:16 PM, Vphurple Izumi said:

I am one again asking a way to remove life on layth

 

Did read through the posts to see if anyone posted a patch. 

You should probably start from page 1 the very first post..the one introducing the mod, talking about features.

This one even has a small FAQ

Link to comment
Share on other sites

On 7/26/2024 at 10:48 AM, Fizzlebop Smith said:

Did read through the posts to see if anyone posted a patch. 

You should probably start from page 1 the very first post..the one introducing the mod, talking about features.

This one even has a small FAQ

I have, a dozen times now it talks about removing life on eve not laythe

Link to comment
Share on other sites

4 hours ago, Vphurple Izumi said:

I have, a dozen times now it talks about removing life on eve not laythe

Apologies. I misread. 
I do not have much experience in patching yet but will try to figure it out or coop some help.
Sorry,  for the misdirected snark.

Edited by Fizzlebop Smith
Link to comment
Share on other sites

7 minutes ago, Wilhelm von Hermann said:

Gameslinx, how  development of parallax rewrite is going on? :) Looks like last post from you was like a month ago, so id like to hear anything new! You're doing very good job in ksp modding community!

I've finished updating all the planets' scatters and terrain textures to support the update. I've almost finished implementing the new collider system too, so not far off testing :) 

Link to comment
Share on other sites

5 hours ago, Gameslinx said:

I've finished updating all the planets' scatters and terrain textures to support the update. I've almost finished implementing the new collider system too, so not far off testing :) 

2 months?

Link to comment
Share on other sites

15 hours ago, Gameslinx said:

I've finished updating all the planets' scatters and terrain textures to support the update. I've almost finished implementing the new collider system too, so not far off testing :) 

Is new collider system going to be much stable and reliable than current one? Like current one is very buggy, so i don't play with colliders :) 

Link to comment
Share on other sites

1 hour ago, Wilhelm von Hermann said:

Is new collider system going to be much stable and reliable than current one? Like current one is very buggy, so i don't play with colliders :) 

It'll be much more stable. The current implementation is very convoluted because of some architectural issues. Now that those are fixed and improved in the upcoming version, the colliders are much easier to manage. There was some extra complexity added by having to optimize the system to run on one thread (and it doesn't help that I implemented it wrong, lol) - this new version will use multithreading via Unity Jobs to avoid a lot of the aggressive optimizations I had to make before.

It's still fairly early days but the colliders are proving to already be much more reliable than before. I should have some more info in the coming week or two once it's fleshed out more.

Link to comment
Share on other sites

Posted (edited)

Parallax Development Update - Talking Frametimes and Optimization

I am long overdue staying in the loop but today I bring some statistics and some analysis comparing the current version of Parallax to the upcoming version, as well as some optimizations I've made to resolve some dastardly issues.

First, Some Graphs

Directly comparing performance between the two versions is important to do as a developer, but it's worth noting that in this case it's not quite a completely fair test. In the new version, performance is significantly better so I am using some of those performance gains to introduce some more complex models and push out the default object render distance which will result in lower gains in the graphs. Because the assets themselves are different between versions, it's difficult to compare the two versions from just the raw framerate.

System Specs Tested:

  • i9 13900k (slightly underclocked because of the intel instability fiasco - my CPU is affected)
  • NVIDIA RTX 4080 Super
  • 32GB DDR5 5600

However, for those wondering, these are the framerate graphs. The most reliable ones are the two loading screen comparisons for reasons I explain below.

wawbvqR.pngwGtSBT0.png

g31VcQK.png

Note on the Framerate graph - 1% Low and 0.1% Low taken with MSI Afterburner, but readings varied largely. The graph shows an average over a minute. 1% and 0.1% lows should be taken with a pinch of salt, and may not be indicative of real performance

Frame Times

But framerate is not quite the full story - a lot of the performance woes of the current parallax version lies not in its continuous framerate but in the stuttering when moving around. So what's happening during these stutters?

  1. KSP is building the terrain - this is done in patches called 'Quads' (a bit like Chunks in Minecraft). This is the main source of stuttering, is slow in general, and occurs independently of parallax
  2. Parallax is generating data for the scatters - this is done when KSP builds the terrain and can extend the stutters I mentioned above fairly significantly on planets with many scatters
  3. Parallax is building the collider octree - occurs when moving around a planet near its surface and takes a very long time
  4. Parallax is subdividing nearby quads. I covered this here 

Frame Times - Profiler

Quick note on the Profiler - Frame times are not hugely indicative of the real time it takes to run the code being analysed because using the profiler significantly slows down the game. What's more important is the relative time it takes compared to everything else.

Here is a breakdown of one typical Parallax 2.0 frame. This shows everything the game is doing as well, but in each of the following frame captures I'm showing all Parallax functions that ran at the time.

2l6ojKT.png

In total, Parallax 2.0 adds 1.23 milliseconds to this frame. For reference, this frame would have taken 7.2 milliseconds (139 frames per second) without parallax installed, but actually took 8.43 milliseconds (119 fps), assuming every frame took this long. This also ignores additional frame time from rendering, but we're comparing CPU time in these screenshots.

Honorable mentions are looking at what is happening during the stutters I mentioned above:

TqfhkSo.png

This one is especially bad, taking almost half the frame time preparing some data. QuadRangeCheck is responsible for more than calculating distances, but it is very slow regardless. What's worse is this runs very often and causes microstutters.

And the final frame capture is an extraordinarily bad (but very common) case of stuttering - flying over Dres at around 10 meters per second yields one of these every few seconds:

lgMs40E.png

This function is responsible for preparing the colliders on a quad and building the data structure to efficiently query them. The red lines below indicate 'garbage' generated by this function which will cause another stutter later on when it's cleaned up so as you can see, not very efficient at all :p

Frame Time - Parallax Continued

In the rewrite, none of these functions exist anymore as they have been replaced by different implementations, or rewritten more efficiently. You can expect stuttering from Parallax to be completely gone save for existing stutters caused by the base game or other mods.

This is a typical frame captured from the same location as the first Parallax 2.0 frame capture:

3vsUdn1.png

In total, Parallax Continued takes 0.697 milliseconds (compared to Parallax 2.0's 1.23ms) per frame which is a 43% speedup. Almost all of the frame time comes from the ScatterManager.LateUpdate() function which is responsible for dispatching compute shaders before rendering the scatters. In P2.0, this runs over the course of a few frames but due to the improved implementation which brings a host of bug fixes, these have to run every frame now.

So What Optimizations Have Been Made?

In short, a whole host. I mentioned quad subdivision in the last dev update but I will note it here again (because it makes the list larger :P )

  1. The entire collision system now runs on Burst Jobs, eliminating the need to build a large octree data structure. This means the collider system is multithreaded
  2. Quad subdivision runs on Burst Jobs so this, too, is multithreaded
  3. The terrain shaders and scatter shaders are massively more optimized for both tessellation performance and memory bandwidth (there's a lot more than this, but it's too much to dig into for today)
  4. Scatter random noise generation is now GPU-based, eliminating the need to use a PQSMod for every scatter to generate it - this was very slow, and contributed to the stuttering
  5. Scatter biome checks are now GPU-based, and addresses the same issue as above
  6. With the shader optimizations, lights performance is hugely improved (and obviously improved further with Deferred)

Those are the main things, anyway. In short, Parallax aims to multithread or offload to the GPU as much as possible to keep framerates high - it's difficult managing over 1 million objects every frame!

Some Bonuses

With the multithreaded terrain subdivision, we can get much more localized and higher levels of vertex density:

bcv1Alc.jpeg

The bubbles (that I am sure everyone will turn off in favour of the Lifeless Eve patch that I'll recreate for the update...) have been revised:

VKmornB.png

Kerbin's oak trees have been replaced with much better ones:

vGCDn1g.png

 

And finally, with the improved light performance I'm adding a new quality setting to allow lights to cast shadows

kPwkCyg.png

*Ignore the weird looking rocks close to the kerbal/craft in these screenshots - I was showing the collider objects here which results in some overlap between the visual and collider object :p 

fH4yuZ4.png

And with that, this dev update is concluded! I'm working on the final touches now that the collision system is in, so this will be the last dev update until release besides any one-off updates :). I can't wait to release this

Edited by Gameslinx
Link to comment
Share on other sites

Absolutely mindblowing!

With the new collisions, any tips on how it would work incorporated into an existing save without destroying landed crafts & bases? Use something like VesselMover to move stuff to safer locations? 

Link to comment
Share on other sites

Would it be possible to always have the parallax terrain loaded in even when you get far away from a planet, instead of how it switches to the vanilla texture once you're far enough away ?

Link to comment
Share on other sites

4 hours ago, OldMold said:

Use something like VesselMover to move stuff to safer locations?

This is probably one of the best ways. Start the game with colliders off (they will be on by default now), move your vessels to a safe place, then restart with colliders on

Or roll the dice :p 

Link to comment
Share on other sites

1 hour ago, Turbo49_ said:

Would it be possible to always have the parallax terrain loaded in even when you get far away from a planet, instead of how it switches to the vanilla texture once you're far enough away ?

The near and far view of the planets are two separate systems. That is something I'd like to look into in more detail in the future, but at the moment I'm focusing on the planet surfaces up close

Link to comment
Share on other sites

On 7/29/2024 at 1:43 PM, Gameslinx said:

It's still fairly early days but the colliders are proving to already be much more reliable than before.

Is it safe to use Laytheshrooms as landing  pads? By "safe" I mean that the Laytheshroom's colliders will be there on the scene load next time, not the overall procedure of landing an aircraft on top of some unknown alien specimen.

Edited by Manul
Link to comment
Share on other sites

52 minutes ago, SartinMax said:

zv8sgLz.png

I noticed that parallax makes the shadows in the iva view very squared, is there a setting to avoid this effect?

What cockpit are you using?

Link to comment
Share on other sites

12 hours ago, Manul said:

Is it safe to use Laytheshrooms as landing  pads? By "safe" I mean that the Laytheshroom's colliders will be there on the scene load next time, not the overall procedure of landing an aircraft on top of some unknown alien specimen.

It certainly will be

YorxrWs.png

Tk091jb.jpeg

 

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