Jump to content

[WIP][1.9.x-1.12.x] Scatterer-atmospheric scattering (0.0838 - 14/08/2022) Scattering improvements, in-game atmo generation and multi-sun support


blackrack

Recommended Posts

Well, thanks. PQS is the detailed terrain system that you see from the surface of the planet or a low orbit.

Edited: Laythe before and after.

http://i.imgur.com/bc7svJW.png

http://i.imgur.com/FAswdO2.png

I should be able to find better settings than this later on, Jool lost quite a bit of detail.

Laythe should have haze. It does have a salty atmosphere :P

Also when will you make multiple bodies editable? I want that, the Eve haze, and awesome Kerbin at the same time.

Link to comment
Share on other sites

Laythe should have haze. It does have a salty atmosphere :P

Also when will you make multiple bodies editable? I want that, the Eve haze, and awesome Kerbin at the same time.

I have hit a brickwall with the postprocessing shader in scaled space, when I find a good way around that there will be multiple planets.

You can keep the PQS active by editing the altitude where ScaledSpace fades in.


body.scaledVersion.GetComponent<ScaledSpaceFader>().fadeStart = value;
body.scaledVersion.GetComponent<ScaledSpaceFader>().fadeEnd = value2;

And do you want to deactivate the Coronas of the Sun or the emitted light? :)

As always, Thomas P. to the rescue, I'll try this and report back. Not the coronas or the emitted light but the glare effect (exposure circle thing that forms when you look straight at the sun and you can see it disappearing if you just slightly pan the sun off screen)

For the sunglare I only know a way: RealSolarSystem.

With Texture Replacer you can turn to black the glare, but that will be only a dimming of the texture.

EDIT: I'm pretty eager to use the tool on any computer. Laythe looks amazing.

EDIT2: Anyway, stock Jool isn't full of detail, precisely... :P

In this case I might be able to dim/undim it as needed ingame.

Edited by blackrack
Link to comment
Share on other sites

The postprocessing covers completely the planet in all ways?

Maybe you just need to apply the same effect but in a different way.

I mean, can you trigger a more subtle/transparent postprocessing, just for scaled space?

Link to comment
Share on other sites


body.scaledVersion.GetComponent<ScaledSpaceFader>().fadeStart = value;
body.scaledVersion.GetComponent<ScaledSpaceFader>().fadeEnd = value2;

I think there's a typyo here, .scaledVersion doesn't exist, I'm trying it with .scaledBody.

Ah, OK. I'll look into this. ;)

Thanks!

Link to comment
Share on other sites

The postprocessing covers completely the planet in all ways?

Maybe you just need to apply the same effect but in a different way.

I mean, can you trigger a more subtle/transparent postprocessing, just for scaled space?

The problem is, the scaled space planet has no height/depth whatsoever, it's a flat texture on a sphere and it cheats at lighting and shadows by using what I assume is a bump map or something similar. So applying postprocessing to it will return nothing but a flat-looking ocean planet, making the postprocessing transparent will just make it look like this

http://i.imgur.com/gC7s6td.jpg

http://i.imgur.com/P2icg7i.jpg

These are old pics from when I was just applying transparency to that blue sphere that used to cover kerbin after the 160km altitude but the result should look exactly the same, it's basically just a blue overlay painted on top of the planet.

Edited:

As for the sun glare, try this and report back please:

Sun.Instance.sunFlare.gameObject.SetActive(false);

I can't test this myself at the moment because of computer-problems. ;)

Ah, you are useing the CelestialBody component, not the whole PSystemBody. Try .scaledBody. If it doesn't works, I'll write a function to get the right scaledVersion. :) But I think it should work.

I'll try both after lunch, thanks a lot! I hope this works.

Edited by blackrack
Link to comment
Share on other sites

Can't you use the height map as alpha channel for the effect? That way you end up with high transparency in high areas (mountains) and low in the plains and oceans.

This could work too but the effect would look off since the scattered light as a function of distance is more than just a base color with a transparency value proportional to said distance. But this could give acceptable results from a bit far away. Maybe after I modified the PQS height but I reach the limit where it hits the far clipping plane?

Or maybe I could find another way to just pass the heightmap to the shader and work with it straight up...

Link to comment
Share on other sites

The problem is, the scaled space planet has no height/depth whatsoever, it's a flat texture on a sphere and it cheats at lighting and shadows by using what I assume is a bump map or something similar. So applying postprocessing to it will return nothing but a flat-looking ocean planet, making the postprocessing transparent will just make it look like this

http://i.imgur.com/gC7s6td.jpg

http://i.imgur.com/P2icg7i.jpg

These are old pics from when I was just applying transparency to that blue sphere that used to cover kerbin after the 160km altitude but the result should look exactly the same, it's basically just a blue overlay painted on top of the planet.

Edited:

I'll try both after lunch, thanks a lot! I hope this works.

As long as the transition remain smooth, that looks like a pretty decent temporary solution -for me- (maybe a little less of transparecy and a bit more of light/contrast...). But I'm pretty sure that the solution you want is much better deal... so don't take this too much on count, lol.

Lately I use this as a kind of visual reference: https://www.google.es/maps/@9.9219692,7.9093048,23003639m/data=!3m1!1e3

Link to comment
Share on other sites

As for the sun glare, try this and report back please:

Sun.Instance.sunFlare.gameObject.SetActive(false);

I can't test this myself at the moment because of computer-problems. ;)

Ah, you are useing the CelestialBody component, not the whole PSystemBody. Try .scaledBody. If it doesn't works, I'll write a function to get the right scaledVersion. :) But I think it should work.

Initially I thought this worked exactly like I wanted, but upon return to the surface I realized kerbin wasn't getting any sunlight anymore.

You can keep the PQS active by editing the altitude where ScaledSpace fades in.


body.scaledVersion.GetComponent<ScaledSpaceFader>().fadeStart = value;
body.scaledVersion.GetComponent<ScaledSpaceFader>().fadeEnd = value2;

I did some testing, and this seems to control when the scaledSpace object is faded in/out but the PQS itself remains unaffected and still fades in and out as usual and completely disables at 160kms up :(

Lately I use this as a kind of visual reference:

https://www.google.es/maps/@9.9219692,7.9093048,23003639m/data=!3m1!1e3

The drop shadows on those clouds are gorgeous.

Edited:

EDIT: I'm pretty eager to use the tool on any computer. Laythe looks amazing.

If you still can't use the tool, you can just use the config included with the mod, rename it to Laythe instead of Kerbin and then just go ingame and set the sky transparency to 70-80% and the postprocessing exposure to about 12-15% and it should look about the same as the screen I posted.

Edited by blackrack
Link to comment
Share on other sites

I'm having a hard time getting my head around the config tool.

I'm using Kerbin 365 which rescales the system to 3.2x sizes, Kerbin itself has a radius of 192,000m which I'm able to enter into the tool and get it to generate a new globe but I can't figure out how to set the atmosphere height correctly.

Link to comment
Share on other sites

I'm having a hard time getting my head around the config tool.

I'm using Kerbin 365 which rescales the system to 3.2x sizes, Kerbin itself has a radius of 192,000m which I'm able to enter into the tool and get it to generate a new globe but I can't figure out how to set the atmosphere height correctly.

Atmosphere height= radius( 192 000, not sure how you got this, since stock kerbin's radius is 600 000) + desired atmosphere height

or you could leave the radius unchanged and change the ratio of (atmosphere height/radius) and it'll scale both up according to kerbin's radius when you get ingame.

How RAM hungry is this?

Not RAM hungry at all as far as I know.

Link to comment
Share on other sites

Thanks to Thomas P. I was able to keep the PQS active longer, but I have to admit the postprocessing is really underwhelming here and there are some artifacts.

But at least now I can play with the settings and maybe fade it out until I find something better.

ww5tQWI.jpg

Edited:

From a 300 km altitude things look a little bit better so I guess I could fade it out from here

stock: http://i.imgur.com/PLgmjJZ.jpg

post processing default: http://i.imgur.com/Rl2FdtA.jpg

post processing with a quick adjustment: http://i.imgur.com/hlm2wfK.jpg

Thanks Blackrack.

The radius came from the RSS.cfg that Kerbin 365 uses. I meant to type 1,920,000.

So did it work?

Edited by blackrack
Link to comment
Share on other sites

Not RAM hungry at all as far as I know.

Likely this stuff is more processing-power hungry than anything else. The game won't crash from memory overages (at least not with this mod as the culprit) but may crash from processor overages.

Link to comment
Share on other sites

Likely this stuff is more processing-power hungry than anything else. The game won't crash from memory overages (at least not with this mod as the culprit) but may crash from processor overages.

Well, this mod uses up more GPU than CPU and RAM combined, and as far as I know KSP isn't very GPU-intensive so it should run fine for anyone with an older midrange GPU or better and not have any slowdowns.

Edited: kerbin just turned into a nebula http://i.imgur.com/NjaDsfi.jpg

Edited by blackrack
Link to comment
Share on other sites

That last picture looks wonderful. :)

In a weird way it does yeah, that's what you get when the scaledSpace object is disabled, PQS has almost completely faded out and postprocessing is rendered directly on top of the skybox. Makes me think of disabling the scaledSpace object and rendering directly on top of a custom texture or a custom scaledSpace object.

Link to comment
Share on other sites

Thanks to Thomas P. I was able to keep the PQS active longer, but I have to admit the postprocessing is really underwhelming here and there are some artifacts.

But at least now I can play with the settings and maybe fade it out until I find something better.

http://i.imgur.com/ww5tQWI.jpg

Great step on!

I wish I could give you more rep...

Link to comment
Share on other sites

I bumped up the far camera's far plane, this would look great if it wasn't jittering because of all the depth buffer imprecisions at this distance.

KIH4ELy.jpg

I'm going to try bumping up the close camera's far plane (shouldn't make a difference at this place in space) so I can bump up the far camera's near plane and try and gain some precision in the depth buffer used by the postprocessing.

Proot said:

Great step on!

I wish I could give you more rep...

Thanks, you guys support means a lot to me.

Edited: Oh god it worked, with no adverse effects on the near camera too.

osIQx1p.png

Edited by blackrack
Link to comment
Share on other sites

There's no guarantee that the scaled space mesh will be a perfect sphere; certainly various moons' aren't, and in RSS I do wrap the mesh to the PQS terrain even for large planets. That said for anything but rocky misshapen lumps of moons it will likely be indistinguishable from a sphere except on close examination.

Using heightmaps isn't the answer because (a) not all bodies have them and (B) even if they do, a heightmap is just one PQSMod among many that contribute to the final terrain. If you actually want a map of the _final_ terrain heights, you'll need to either use the built in export method or use stupid_chris's.

And yes, most of the terrain variation you see in scaled space is from the normal maps applied to all bodies.

Link to comment
Share on other sites

There's no guarantee that the scaled space mesh will be a perfect sphere; certainly various moons' aren't, and in RSS I do wrap the mesh to the PQS terrain even for large planets. That said for anything but rocky misshapen lumps of moons it will likely be indistinguishable from a sphere except on close examination.

Using heightmaps isn't the answer because (a) not all bodies have them and (B) even if they do, a heightmap is just one PQSMod among many that contribute to the final terrain. If you actually want a map of the _final_ terrain heights, you'll need to either use the built in export method or use stupid_chris's.

And yes, most of the terrain variation you see in scaled space is from the normal maps applied to all bodies.

I decided against this, right now I'm just extending the PQS altitude, adjusting the different camera's planes to that altitude on the fly, to keep it "in the shot" and keep the depth buffer precise, and applying the postprocessing shader to the now-visible-from-far-away PQS of the planet. Until it gets sufficiently small then I just fade in the scaledObject and fade out and disable postprocessing altogether.

Does this approach seem sound? It keeps the high detail of the PQS available to the post processing shader and it certainly bought me lots of wiggle space until I can figure out a good method for scaledSpace.

Edited by blackrack
Link to comment
Share on other sites

blackrack: It's a bad idea IMO: from far away PQS will look either look much, much worse than the prerendered scaledspace texture+NRM, or it will lead to way too much processing overhead. And that's for Kerbin-sized stuff, let alone anything larger. :\

There's good reason PQS gets faded out and disabled as low as it does.

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