Jump to content

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


Gameslinx

Recommended Posts

I'm very excited to download Parallax in a couple of weeks! As it will come to stock! How often do you plan to update it to current version of KSP? I don't wanna be that guy to poke though so feel free to not answer.

Link to comment
Share on other sites

1 hour ago, The Doodling Astronaut said:

I'm very excited to download Parallax in a couple of weeks! As it will come to stock! How often do you plan to update it to current version of KSP? I don't wanna be that guy to poke though so feel free to not answer.

I guess making promises would only make things worse in the end. So I think it’s safe to say: Updates will appear for new KSP version (if they are needed) when they are ready. Setting ETAs would only result in people pestering more when a „deadline“ wasn’t met. 

Edited by ValiZockt
Link to comment
Share on other sites

6 hours ago, Deddly said:

Even though I can't run this mod, I have donated to encourage development because I would love to see it come to stock. I encourage everyone else who is patiently waiting to do the same :)

Sadly I can't afford to donate, as I am on a tight budget. I would love to support @Gameslinx in any other way though!

Link to comment
Share on other sites

29 minutes ago, Kerminator1000 said:

Sadly I can't afford to donate, as I am on a tight budget. I would love to support @Gameslinx in any other way though!

spread the word to KSP friends about the awesome mod and tell them to get it.

Link to comment
Share on other sites

Hi @Gameslinx. Would you consider releasing your configs (not the mod itself!) under a different license so that people can use them as a template for other planet packs or for the stock system? Right now the only configs must be created from a blank file...

Link to comment
Share on other sites

On 10/5/2020 at 6:09 PM, MorePortal said:

Okay, I finally worked it out.

To use it with SD, you need to increase "groundTiling" in the SD config

(My rescale factor is 3.2, and "groundTiling=10" worked for me. Maybe the actual value is 3.2^2=10.24 (That would make sence), but I'm okay with 10)

  Reveal hidden contents

yd5Z397.png

 

I'm really curious why you feel that adjusting the groundTiling setting is necessary? Care to explain, as I'm not seeing any issues without changing that?

Link to comment
Share on other sites

 

10 hours ago, Morphisor said:

I'm really curious why you feel that adjusting the groundTiling setting is necessary? Care to explain, as I'm not seeing any issues without changing that?

Here is why:

On 9/28/2020 at 10:00 PM, MorePortal said:

There is no problem with textures, they seem to work:

  Reveal hidden contents

SHl89vz.png

(with big planets)

qkChrrc.png

(without big planets)

Lighting also seem to work

The only problem is "bumpiness" of the surface:

  Reveal hidden contents

iH5tDJ7.png

(with big planets)

HWIsIsa.png

(without big planets)

That's why I thought I can fix this with config

Link to comment
Share on other sites

20 minutes ago, Morphisor said:

I tried setting the rescale config to both groundtiling = 10 and groundtiling = 1. But I could not see any difference within a few comparison screenshots I made. So I'm really not sure what effect this has, if any.

For some reason, it loaded immediately when I chanded this setting for the first time.  

So I just checked and "groundtiling" actually doesn't have any effect

What actually happends for me is a delay between this:

Spoiler

0hc3hqP.png

and this:

Spoiler

yd5Z397.png

It only loads when I move for some time, if i'm not moving - it doesn't (I think so)

And there is no message in the console at the moment of loading

Link to comment
Share on other sites

On 10/13/2020 at 4:22 PM, Gameslinx said:

I'm working on Parallax configs for the stock planets now :)

ULLXzfB.png

That looks incredible! Cant wait to see this running in stock.

With proper documentation on how the config files work, can the settings be customized to apply to any planet?

Link to comment
Share on other sites

While I've been working on the stock textures, I've also been working on optimizing Parallax. Currently, the shader does 60 texture samples per pixel. As far as shaders go, that's quite a lot!

If you want the technical details, they're in the spoiler below:

Spoiler

Parallax uses a technique called Triplanar Mapping to avoid texture stretching. Compared to regular UV mapping (which requires 1 texture sample), Triplanar mapping requires 3. One for the XY,  XZ and ZY axis. 

To reduce the effect of texture tiling you may notice that the textures are tiled at different levels as you zoom out. What I do here is sample the textures again at a different scale, then interpolate between the two. This doubles the amount of texture samples. A triplanar texture requires 3 samples, and the zoom requires another 2. In total, that's 6 samples for 1 texture.

So, we have 4 surface textures, a displacement texture and an influence texture. We also have 4 surface normal maps. That's 10 maps, thus 60 texture samples. On lower end GPUs, this is very slow and actually takes longer than the tessellation stage!

I'm currently halfway through implementing a situational method which I'm calling Adaptive Parallax. When the terrain is built, I can determine whether a quad (a square patch of terrain) lies in the low, mid or high region on the planet (set in the config already). If a quad is completely within the Low region, there's no need to sample the mid and high textures! This reduces the texture sample count by 24 already.

By comparing a quad's maximum vertex height to its minimum vertex height, I can determine a gradient. Under a certain value, we can consider a quad to be "flat". Now we don't need to sample the steep texture either! This reduces the texture sample count by 36. Now we've cut down on the texture samples by over half!

However, not all quads lie in one region, and not all of them are flat. I'm currently writing some shader variants that are selected under the following conditions:

Adaptive Parallax Conditions:
Requires 24 samples:
 - Quad is flat, and lies in 1 region
Requires 36 samples:
 - Quad is not flat, and lies in 1 region
Requires 48 samples:
 - Quad is not flat, and lies in 2 regions
Requires 60 samples (Current Parallax):
 - Quad is not flat, and lies in all 3 regions

I've not implemented the new technique fully yet, so expect results to differ, however this is what Kerbin looks like if I colour terrain quads by their situation:

unknown.png

The colours merely indicate the situation, not performance impact.

I hope to provide more results for you all soon, and I'm very excited if I can get it working fully. I am estimating a 2x performance uplift

 

Link to comment
Share on other sites

9 hours ago, Gameslinx said:

While I've been working on the stock textures, I've also been working on optimizing Parallax. Currently, the shader does 60 texture samples per pixel. As far as shaders go, that's quite a lot!

If you want the technical details, they're in the spoiler below:

  Reveal hidden contents

-snip-

I've not implemented the new technique fully yet, so expect results to differ, however this is what Kerbin looks like if I colour terrain quads by their situation:

unknown.png

Stuff like this is what keeps KSP alive after so many years, Keep it up!

Spoiler

good god i need this for jnsq 

 

Edited by alberro+
Link to comment
Share on other sites

I have done some optimizations and managed to increase the performance by over 2x!

I'm super happy to have this (almost!) working now. Using the Adaptive Parallax method above, I've made some immense optimizations to the shader. I've gone from 15fps on Kerbin to a fairly stable 55.

My current specs are fairly poor. I'm at university now, so I don't have access to anything powerful. I'm running a mobile (laptop) GT 970M GPU.

I am excited to be able to drop the minimum spec significantly given this immense performance uplift. As a bonus, here's Duna!

NmR5djy.png

Note: Getting 60fps here on Duna!

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