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

Sorry, what?

Right now it looks like the alpha may be all over the place. The extiction shader could be used to set the alpha to a known value. Is it rendered on top of or behind the sky shader?

Also:

sbPyN3R.png

Edited by rbray89
Link to comment
Share on other sites

Right now it looks like the alpha may be all over the place. The extiction shader could be used to set the alpha to a known value. Is it rendered on top of or behind the sky shader?

Also:

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

It is rendered behind the sky shader. Also, what am I looking at here?

Edited: now do this

14uwAzZ.jpg

Edited by blackrack
Link to comment
Share on other sites

It is rendered behind the sky shader. Also, what am I looking at here?

Edited: now do this

http://i.imgur.com/14uwAzZ.jpg

Perfect.

That was my initial attempt at a proper terminator with a VERY overpowered multiplicative blend. I think the default sky shader over-writes the alpha values though. That or there is a bug in my atmo shader. Either way, we are getting closer. I suspect that this is entirely an issue with KSP's sky. It also seems to write to the depth buffer (no "zwrite off"), and seems to be on the transparent render queue. It is quite annoying; I see why you decided to eliminate it :)

Link to comment
Share on other sites

Perfect.

That was my initial attempt at a proper terminator with a VERY overpowered multiplicative blend. I think the default sky shader over-writes the alpha values though. That or there is a bug in my atmo shader. Either way, we are getting closer. I suspect that this is entirely an issue with KSP's sky. It also seems to write to the depth buffer (no "zwrite off"), and seems to be on the transparent render queue. It is quite annoying; I see why you decided to eliminate it :)

Yea it's quite the pain. Try it with the scatterer sky and see if anything changes, though I'm not sure if the scatterer sky writes 1 to the alpha channel, or writes it's own values from older versions where I was using alpha blending.

Link to comment
Share on other sites

Yea it's quite the pain. Try it with the scatterer sky and see if anything changes, though I'm not sure if the scatterer sky writes 1 to the alpha channel, or writes it's own values from older versions where I was using alpha blending.

Hmmm... Tried toying around with scatterer, but I don't know enough about it's workings to say if this is what I should be doing.

Extinction shader goes first, extinguishes alpha, keeps color blend mode


/ Compiled shader for all platforms, uncompressed size: 22.5KB

Shader "Proland/Atmo/SkyExtinction" {
SubShader {
Tags { "QUEUE"="Transparent-6" }


// Stats for Vertex shader:
// d3d11 : 10 math
// d3d9 : 14 math
// Stats for Fragment shader:
// d3d11 : 48 math, 2 branch
// d3d9 : 68 math, 2 texture
Pass {
Tags { "QUEUE"="Transparent-6" }
ZTest False
ZWrite Off
Cull Front
Blend DstColor Zero, Zero Zero

Planet is re-rendered next, writing brightness to alpha.


Shader "EVE/PlanetLight" {
Properties {
_Color ("Color Tint", Color) = (1,1,1,1)
}
Category {
Lighting On
ZWrite Off
Cull Back
Blend SrcColor SrcAlpha, One Zero
Tags {
"Queue"="Transparent-5"
"RenderMode"="Transparent"
"IgnoreProjector"="True"
}

Sky is last. Now addition is dependent on framebuffer alpha. Here, we could also try reversing it to "Blend One OneMinusDstAlpha" and reversing the alpha writing in the planet shader to write dark areas as "1".


// Compiled shader for all platforms, uncompressed size: 52.6KB

Shader "Proland/Atmo/Sky" {
SubShader {
Tags { "QUEUE"="Transparent-3" }


// Stats for Vertex shader:
// d3d11 : 10 math
// d3d9 : 14 math
// Stats for Fragment shader:
// d3d11 : 163 math, 1 texture
// d3d9 : 243 math, 11 texture
Pass {
Tags { "QUEUE"="Transparent-3" }
ZTest False
ZWrite Off
Cull Front
Blend OneMinusDstAlpha One

- - - Updated - - -

Ok, got it. had to move my shader to Geometry+1:

Javascript is disabled. View full album

This is still with the queues being moved around as well, so I don't know for certain how much the new alpha changes are helping.

Interestingly, Mun now glows with a slight tint of whatever the sun is. Pretty cool actually.

Edited by rbray89
Link to comment
Share on other sites

Images

Holy **** that looks beautiful, especially the second image. Mun looks overblown to full white though. Can you try this with laythe and Jool?

Also, not sure what you mean with the mun glowing with a slight tint of the sun, but that is a byproduct of the extinction shader (it should get more noticeable nearing the horizon), unless you mean something else...

Edited by blackrack
Link to comment
Share on other sites

Damn this looks good guys please carry on doing what you're doing! :D

One question though as it may be relevant to load orders and buffers and stuffs.. there bug with scatterer and RasterPropMonitor. I get the feeling it's something that's inherent to the way scatterer is rendered. It would seem RPM can't load multiple instances of atmosphere at different angles or in 2D while loading in the 3D main view as the RPM view's atmosphere appears as it should based on the kerbals IVA viewing angle and changes as the IVA view changes. You may well have known about this but just thought it might be worth mentioning in case there's any other changes to depth buffers or load orders that might fix/mitigate this (BTW in case you didn't notice I'm like 143x less smart than you guys about the above so I probs made a number of mistakes with terminology :P )

Link to comment
Share on other sites

There are alias and random black bars over the edge of the terrains in far background. Not sure how to fix.

Like this, especially when you zoom in a lot (second img), or even at raw resolutions.

Javascript is disabled. View full album

I have AVP installed with medium textures and a couple optional features (like auroras), with 8x anti-aliasing. I do have a bunch other graphics mods (HotRockets, Ven's Stock Part Revamp, Destruction FX, Engine Light, Collision FX and a couple others), but I doubt that they would have caused this.

My machine runs on Windows 8.1, with 4720HQ, GTX 960M and 16GB DDR3-1600. This happens in both Forced OpenGL and not Forced OpenGL (DX11, I assume?).

Any idea what to do?

Edited by Wavechaser
Link to comment
Share on other sites

I've been using Scatterer happily for a couple of months and the dawn and dusk effects are just spectacular.

Recently when running DX11 I've had a game suddenly slow down during atmospheric flight and then the clouds turned black; EVE itself works fine but whenever I run Scatterer on this instal I will see black sky above the clouds and no amount of reinstalling EVE or tweaking BoulderCO clouds settings could restore the normal sky.

Is there a fix for the 'black sky' issue?

Edit:

Fixed - searched the thread and confim loading a craft, zooming the camera out to orbit and back restores the normal sky.

Edit 2

I do have one other request - Can i make the 'background fog' effect on Kerbin more prominent at midday? Currently the default settings look most glorious at dawn and dusk only.

Edited by pandoras kitten
fixed :)
Link to comment
Share on other sites

Damn this looks good guys please carry on doing what you're doing! :D

One question though as it may be relevant to load orders and buffers and stuffs.. there bug with scatterer and RasterPropMonitor. I get the feeling it's something that's inherent to the way scatterer is rendered. It would seem RPM can't load multiple instances of atmosphere at different angles or in 2D while loading in the 3D main view as the RPM view's atmosphere appears as it should based on the kerbals IVA viewing angle and changes as the IVA view changes. You may well have known about this but just thought it might be worth mentioning in case there's any other changes to depth buffers or load orders that might fix/mitigate this (BTW in case you didn't notice I'm like 143x less smart than you guys about the above so I probs made a number of mistakes with terminology :P )

Scatterer gets the properties of the main camera (position, view direction, field of view) and renders the effects for that particular camera. So when the effect is viewed from another camera it looks completely wrong. In the future I might make it render separately for each RPM/custom camera.

There are alias and random black bars over the edge of the terrains in far background. Not sure how to fix.

Like this, especially when you zoom in a lot (second img), or even at raw resolutions.

http://imgur.com/a/DRUFR

I have AVP installed with medium textures and a couple optional features (like auroras), with 8x anti-aliasing. I do have a bunch other graphics mods (HotRockets, Ven's Stock Part Revamp, Destruction FX, Engine Light, Collision FX and a couple others), but I doubt that they would have caused this.

My machine runs on Windows 8.1, with 4720HQ, GTX 960M and 16GB DDR3-1600. This happens in both Forced OpenGL and not Forced OpenGL (DX11, I assume?).

Any idea what to do?

I believe this is because the depth buffer is aliased compared to the main buffer, so when the effects are lined up they "don't match". Never tried it myself but you could try disabling regular AA and using downsampling/nvidia SDR instead.

I've been using Scatterer happily for a couple of months and the dawn and dusk effects are just spectacular.

Recently when running DX11 I've had a game suddenly slow down during atmospheric flight and then the clouds turned black; EVE itself works fine but whenever I run Scatterer on this instal I will see black sky above the clouds and no amount of reinstalling EVE or tweaking BoulderCO clouds settings could restore the normal sky.

Is there a fix for the 'black sky' issue?

Edit:

Fixed - searched the thread and confim loading a craft, zooming the camera out to orbit and back restores the normal sky.

Edit 2

I do have one other request - Can i make the 'background fog' effect on Kerbin more prominent at midday? Currently the default settings look most glorious at dawn and dusk only.

Short answer: you can't right now. Long answer: it's complicated, sorry if I'm being brief but it's supposed to be that way on dawn and dusk, however it's not completely realistic right now as it doesn't take into account whether you're looking towards the sun's direction or opposite to it.

Quick example from outerra and the alps:

Close to sunset, looking in the sun's direction, very prominent scattering

KDmnfln.jpg

Looking opposite to the sun's direction, strong light reflecting off the terrain "mutes" the scattering effects

iEk0WFS.jpg

This isn't currently taken into account in scatterer and the alpha blending kind of negates all of these things. This is one of the reasons I wanted to try HDR, as it would achieve this effect "natively", but it didn't work very well and the terrain looked really bad and reflected light in an unnatural way. I thought of some other ways of approximating this and making the effect adjustable based on time of day and viewing angle to the sun and might be doing something for this later.

No matter what I do, I still have the moire effect on OpenGL regardless if forceoffaniso is enabled or not.

Moire effect isn't supposed to be affected by forceoffaniso, moreover, since a few versions ago forceoffaniso is useless and only lowers the video quality. Hence why I removed it from the UI. It's still in the config files but there's no reason to use it.

Link to comment
Share on other sites

Scatterer gets the properties of the main camera (position, view direction, field of view) and renders the effects for that particular camera. So when the effect is viewed from another camera it looks completely wrong. In the future I might make it render separately for each RPM/custom camera.

I believe this is because the depth buffer is aliased compared to the main buffer, so when the effects are lined up they "don't match". Never tried it myself but you could try disabling regular AA and using downsampling/nvidia SDR instead.

Short answer: you can't right now. Long answer: it's complicated, sorry if I'm being brief but it's supposed to be that way on dawn and dusk, however it's not completely realistic right now as it doesn't take into account whether you're looking towards the sun's direction or opposite to it.

Quick example from outerra and the alps:

Close to sunset, looking in the sun's direction, very prominent scattering

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

Looking opposite to the sun's direction, strong light reflecting off the terrain "mutes" the scattering effects

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

This isn't currently taken into account in scatterer and the alpha blending kind of negates all of these things. This is one of the reasons I wanted to try HDR, as it would achieve this effect "natively", but it didn't work very well and the terrain looked really bad and reflected light in an unnatural way. I thought of some other ways of approximating this and making the effect adjustable based on time of day and viewing angle to the sun and might be doing something for this later.

Moire effect isn't supposed to be affected by forceoffaniso, moreover, since a few versions ago forceoffaniso is useless and only lowers the video quality. Hence why I removed it from the UI. It's still in the config files but there's no reason to use it.

Thanks. I'll try that. :)

Link to comment
Share on other sites

Hello, I have been trying to get this to work on Ubuntu 15.04 in RSS here and there over the last couple of days and every time I try to load up the game after adding it it doesn't seem to actually load scatterer, but the framerate drops to about 1 frame every 3 seconds. My computer has always run it fine in the past on Windows so I was wondering if it was something to do with Linux? This was one of my favourite mods to use when I played on windows and I was hoping it would run even smoother on Linux in 64bit but as I have been learning the more I use Linux nothing ever works right out the box, there's always some silly difficulty to be encountered!

So yes I was wondering if anyone else is running Linux and if it works perfectly for you or not? Otherwise it could just be that RSS+Scatterer is too much for my computer, but I'd rather explore other possibilities first because it just doesn't feel right without this mod!

Edit: well I just loaded scatterer onto a fresh install of stock KSP and it worked no problems so I guess it is something to do with it not playing ball with RSS (I forgot to mention but I did extract the RSS compatability after the main Scatterer files) I still don't know if it's fixable or down to my computer not being able to handle it though

Edited by Squiggsy
Link to comment
Share on other sites

Hello, I have been trying to get this to work on Ubuntu 15.04 in RSS here and there over the last couple of days and every time I try to load up the game after adding it it doesn't seem to actually load scatterer, but the framerate drops to about 1 frame every 3 seconds. My computer has always run it fine in the past on Windows so I was wondering if it was something to do with Linux? This was one of my favourite mods to use when I played on windows and I was hoping it would run even smoother on Linux in 64bit but as I have been learning the more I use Linux nothing ever works right out the box, there's always some silly difficulty to be encountered!

So yes I was wondering if anyone else is running Linux and if it works perfectly for you or not? Otherwise it could just be that RSS+Scatterer is too much for my computer, but I'd rather explore other possibilities first because it just doesn't feel right without this mod!

This was already reported a few pages ago by pingopete, I'll get to it as soon as I can. This problem appeared with the newest/second newest version of scatterer as far as I know. Linux probably has nothing to do with it.

Edited by blackrack
Link to comment
Share on other sites

This was already reported a few pages ago by pingopete, I'll get to it as soon as I can. This problem appeared with the newest/second newest version of scatterer as far as I know. Linux probably has nothing to do with it.

whoops sorry I must have missed that post while looking back through the forums! thank you very much for your response :)

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