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

21 minutes ago, MR L A said:

huh, I'll whack it in and see what happens :)

I'll do a bit of digging but I vaguely remember a few people saying their performance was unexpectedly (much more of a hit than Scatterer should have).

I've used a fresh install of KSP when testing scatterer :( so conflicts don't appear to be the problem.

I'm not with my PC for about a week, so I can't currently show you my config.. it should be exactly as appears on download though

That was when people updated to the new version but kept using configs made for previous versions.

Link to comment
Share on other sites

1 hour ago, blackrack said:

That was when people updated to the new version but kept using configs made for previous versions.


Ahh thanks :) I'll report back soon, hopefully I won't have anything negative to report :)

Link to comment
Share on other sites

52 minutes ago, Avera9eJoe said:

This just keeps getting better and better... :) Blackrack is there a chance you can extinguish the crazy underwater view distance from stock?

I'm trying to nail the look of the underwater surface look first, I can't put my finger on what it is exactly but something is wrong, and the view feels restricted to a very small angle, smaller than I expected. The surface seems a bit plastic-y as well.

Jy1XAEt.jpg

 

FmmmFTJ.jpg

 

Not sure what's wrong, maybe it just doesn't pop like this

1.jpg

 

I'll try again tomorrow.

 

44 minutes ago, JadeOfMaar said:

Assuming it's one of @StarCrusher96's many, many sexy planets, we have no hope of guessing right so just tell us. D:

What galileo said, it's kerbin underwater.

Edited by blackrack
Link to comment
Share on other sites

5 hours ago, blackrack said:

I'm trying to nail the look of the underwater surface look first, I can't put my finger on what it is exactly but something is wrong, and the view feels restricted to a very small angle, smaller than I expected. The surface seems a bit plastic-y as well.

Not sure what's wrong, maybe it just doesn't pop like this

I'll try again tomorrow.

 

It's too dark where the normals aren't angled right at the camera, or away from it. Spots like that should still be getting light though it would be mostly blue due to scattering.

Link to comment
Share on other sites

18 hours ago, blackrack said:

I'm trying to nail the look of the underwater surface look first, I can't put my finger on what it is exactly but something is wrong, and the view feels restricted to a very small angle, smaller than I expected. The surface seems a bit plastic-y as well.

Jy1XAEt.jpg

[snip]

By looking at the image, I assume you have the intensity of the refractive component calculated according to the fresnel equations.
To me it looks, as if the transmittant (refractive)  component is rendered pretty good, and "all that is missing" is the reflective component.

(The observed phenomenon is called Snell's window. See https://en.wikipedia.org/wiki/Snell's_window )

At this point, to achieve a physically accurate model, you'll probably need to incorporate another, custom tailored mie scattering. And reflection maps. And, and... :D

Maybe I've got an idea of how to crudely, naively and inaccurately (i.e. purely visually)  approximate fake the intensity values for the reflective component by taking into account 1) the distance of the camera to the surface (perpendicular) 2) the length of the view ray from camera to surface, 3) the length of the reflected view ray (clamped to a max value, length to ground otherwise) and 4) the cosine of the angle of the reflected view ray to the water surface (or sine using the normal). It's basically distance fog with additional steps to increase light intensity the nearer and more parallel the reflected view-ray is to the water surface. It's based on the assumption that there is more scattered light traveling in any direction at any point near the surface, exponentially decreasing in intensity the deeper it gets.

Just an idea. Yours is probably already better:D

Edited by plonk
Link to comment
Share on other sites

57 minutes ago, plonk said:

By looking at the image, I assume you have the intensity of the refractive component calculated according to the fresnel equations.
To me it looks, as if the transmittant (refractive)  component is rendered pretty good, and "all that is missing" is the reflective component.

(The observed phenomenon is called Snell's window. See https://en.wikipedia.org/wiki/Snell's_window )

At this point, to achieve a physically accurate model, you'll probably need to incorporate another, custom tailored mie scattering. And reflection maps. And, and... :D

Maybe I've got an idea of how to crudely, naively and inaccurately (i.e. purely visually)  approximate the intensity values for the reflective component by taking into account 1) the distance of the camera to the surface (perpendicular) 2) the length of the view ray from camera to surface, 3) the length of the reflected view ray (clamped to a max value, length to ground otherwise) and 4) the cosine of the angle of the reflected view ray to the water surface (or sine using the normal). It's basically distance fog with additional steps to increase light intensity the nearer and more parallel the reflected view-ray is to the water surface. It's based on the assumption that there is more scattered light traveling in any direction at any point near the surface, exponentially decreasing in intensity the deeper it gets.

Just an idea. Yours is probably already better:D

I'm using the fresnel equations but I think there is a problem somewhere in the refracted ray calculation.

Basically when debugging the fresnel value visually I noticed that the "snell's window" seems twice as large as in the image above, yet my refracted ray seems to be hitting maximum angle sooner. I probably messed up something stupid in the transformation from ocean space to world space or whatever.

If you look in the first image, you'll see 3 distinct zones, the center zone where you can see the sky, then the dark blue zone, then the outer, black zone at the edge of the screen.

When debugging the fresnel value, zone 3 should be where we have total reflection and zone 1 and 2 are the same zone of refraction, where the refracted angle never reaches as low as the horizon.

However what's happening up there is that in zone 1 the angle is refracted to go towards the sky, in zone 2 the angles are refracted towards the horizon or lower, which is why their shading is messed up, and zone 3 is total reflection.

Plus there are these weird white spots and the whole look is off making me think something is off with the normals or whatever

l8sl3Hx.jpg

Anyway, I'm sure it's something stupid, I was tired last night and experimenting with something new. For the reflected component I haven't really thought about it yet but probably something similar to the distance fog you mentioned and if I can figure it out, some kind of light scattering depending on the viewing direction and the angle of the sun. I'll just have to research it and experiment a bit.

 

Edited:

Here's what debugging the fresnel value looks like, in red transmission and blue reflection, notice how much bigger it is than the one above.

3WCUjkc.jpg

Edited by blackrack
Link to comment
Share on other sites

5 hours ago, blackrack said:

I'm using the fresnel equations but I think there is a problem somewhere in the refracted ray calculation.

Basically when debugging the fresnel value visually I noticed that the "snell's window" seems twice as large as in the image above, yet my refracted ray seems to be hitting maximum angle sooner. I probably messed up something stupid in the transformation from ocean space to world space or whatever.

If you look in the first image, you'll see 3 distinct zones, the center zone where you can see the sky, then the dark blue zone, then the outer, black zone at the edge of the screen.

When debugging the fresnel value, zone 3 should be where we have total reflection and zone 1 and 2 are the same zone of refraction, where the refracted angle never reaches as low as the horizon.

However what's happening up there is that in zone 1 the angle is refracted to go towards the sky, in zone 2 the angles are refracted towards the horizon or lower, which is why their shading is messed up, and zone 3 is total reflection.

Plus there are these weird white spots and the whole look is off making me think something is off with the normals or whatever

 

Anyway, I'm sure it's something stupid, I was tired last night and experimenting with something new. For the reflected component I haven't really thought about it yet but probably something similar to the distance fog you mentioned and if I can figure it out, some kind of light scattering depending on the viewing direction and the angle of the sun. I'll just have to research it and experiment a bit.

 

Edited:

Here's what debugging the fresnel value looks like, in red transmission and blue reflection, notice how much bigger it is than the one above.

 

Somewhere in there you're getting the dot product of the viewing angle and the normals, right? Are you using the absolute value of that? If not that could be why you're getting those results.

Link to comment
Share on other sites

have you been able to get the nearClipPlane parameter back in for the next release? Just a reminder. Really missing it for IVA photos because a lot of the time the IVA model gets clipped in view of the camera under stock settings

Edited by Drew Kerman
Link to comment
Share on other sites

Basic underwater surface + distance "fog" (only applied to water surface at the moment). Shading to be improved.

21 hours ago, Starwaster said:

Somewhere in there you're getting the dot product of the viewing angle and the normals, right? Are you using the absolute value of that? If not that could be why you're getting those results.

That would be a very rookie mistake to make.

9 hours ago, Drew Kerman said:

have you been able to get the nearClipPlane parameter back in for the next release? Just a reminder. Really missing it for IVA photos because a lot of the time the IVA model gets clipped in view of the camera under stock settings

Should I just make it a separate, minimal mod?

Edited by blackrack
Link to comment
Share on other sites

1 hour ago, blackrack said:

Basic underwater surface + distance "fog" (only applied to water surface at the moment). Shading to be improved.

Can't wait to film something in an environment like that, it looks stunning.

1 hour ago, blackrack said:

Should I just make it a separate, minimal mod?

I'd appreciate something simple like that. Given that it's rather important to me.

Link to comment
Share on other sites

21 minutes ago, blackrack said:

Why wouldn't it? What happens deep underwater?

Hm, it may have been fixed when they re-did water physics but it used to be that your camera would try and point straight up if you go into negative altitudes. I guess they removed that now?

Link to comment
Share on other sites

Just now, Avera9eJoe said:

Hm, it may have been fixed when they re-did water physics but it used to be that your camera would try and point straight up if you go into negative altitudes. I guess they removed that now?

I just went 1 km deep and it seems everything is working fine.

Link to comment
Share on other sites

3 hours ago, blackrack said:

Should I just make it a separate, minimal mod?

I don't think it's worth the extra effort that would go with having to keep track of it separately, but that would be your call. From a user standpoint, I went back to 1.1.3 just so I could get one photo from an IVA using this setting and I did notice it affected the ground somewhat if it was set too low, so just having it as a value people can play with within Scatterer (since its Scatterer that would be causing any ground/water flickering) seems to make the most sense. Keeping all problems in one place and all that.

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