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

Ah right, yeah that makes sense, I had the stock atmosphere turned off as it was replaced by the Eve atmo shader. Oh and regarding the atmosphere height I was referring to its entire vertical scale essentially not so much to the altitude of its start point. Maybe it's something that could be edited in the configuration editor? Or is it hard limited to being proportionate to a planets radius?

Not sure what you mean, are you referring to the horizon line being higher than the actual horizon? Or do you find the default atmospehre height setting too high in RSS?

Link to comment
Share on other sites

Not sure what you mean, are you referring to the horizon line being higher than the actual horizon? Or do you find the default atmospehre height setting too high in RSS?

Yeah the latter, is there any way of altering that? Thanks :)

Edited by pingopete
Link to comment
Share on other sites

Yeah the latter, is there any way of altering that? Thanks :)

The default atmosphere size is taken off of earth's so I'd have thought it'd look perfect with RSS. Anyway, you can do it with the config tool, there's a short explanation in the OP on how not to get artifacts, if you get problems just send me a message.

Link to comment
Share on other sites

The default atmosphere size is taken off of earth's so I'd have thought it'd look perfect with RSS. Anyway, you can do it with the config tool, there's a short explanation in the OP on how not to get artifacts, if you get problems just send me a message.

Awesome thanks for the help man!

Link to comment
Share on other sites

I installed scatterer via CKAN, and it also installed clouds from the Astronomer's pack... But it causes this when I load up. If I reload, the same thing happens. If I go to the tracking station and look in map view, the skybox is gone and replaced with this weird red texture. Can anyone explain what this is and how to fix it?

2ioVNMuk.png

Link to comment
Share on other sites

I installed scatterer via CKAN, and it also installed clouds from the Astronomer's pack... But it causes this when I load up. If I reload, the same thing happens. If I go to the tracking station and look in map view, the skybox is gone and replaced with this weird red texture. Can anyone explain what this is and how to fix it?

https://cdn.pbrd.co/images/2ioVNMuk.png

That's the result of installing any cloud mod through CKAN. Scatterer should install fine through CKAN.
Link to comment
Share on other sites

I installed scatterer via CKAN, and it also installed clouds from the Astronomer's pack... But it causes this when I load up. If I reload, the same thing happens. If I go to the tracking station and look in map view, the skybox is gone and replaced with this weird red texture. Can anyone explain what this is and how to fix it?

https://cdn.pbrd.co/images/2ioVNMuk.png

you might be out of memory. try reinstalling EVE and AVP manually (yes it's a lot to do. such is life :( )

Link to comment
Share on other sites

I installed scatterer via CKAN, and it also installed clouds from the Astronomer's pack... But it causes this when I load up. If I reload, the same thing happens. If I go to the tracking station and look in map view, the skybox is gone and replaced with this weird red texture. Can anyone explain what this is and how to fix it?

https://cdn.pbrd.co/images/2ioVNMuk.png

This is an AVP bug. It's not an easy mod to install.

Link to comment
Share on other sites

So, can anybody think of an easy way to detect an eclipse? I need to hide the sunflare I'm adding when on laythe and jool occludes the sun.

If I cast a ray, will it work in scaledspace? Do the scaledspace objects have colliders?

Edited by blackrack
Link to comment
Share on other sites

That's the result of installing any cloud mod through CKAN. Scatterer should install fine through CKAN.

Oh right. I can't remove the clouds and keep scatterer with CKAN, so I guess I'll have to do a manual install.

you might be out of memory. try reinstalling EVE and AVP manually (yes it's a lot to do. such is life :( )

I run at 2.7GB in the main menu, so I'm definitely not out of memory (yet). But yeah, I'll attempt a manual install.

This is an AVP bug. It's not an easy mod to install.

Well, I thought CKAN was meant to make it easier?! xD

Link to comment
Share on other sites

So, can anybody think of an easy way to detect an eclipse? I need to hide the sunflare I'm adding when on laythe and jool occludes the sun.

If I cast a ray, will it work in scaledspace? Do the scaledspace objects have colliders?

They should. I believe that is how the existing sun flare system works.

The only other way I have is using spherical intersection models in my shaders :) You'd have to pass in the body origin and the radius however.

Link to comment
Share on other sites

They should. I believe that is how the existing sun flare system works.

The only other way I have is using spherical intersection models in my shaders :) You'd have to pass in the body origin and the radius however.

Actually, Now that I think about it, this would actually probably be much less computationally intensive than a ray-trace.

To detect if you hit the sphere:


float3 L = _PlanetOrigin - _WorldSpaceCameraPos; // Vector to Center of body from camera
float3 La = normalize(_SunOrigin - _WorldSpaceCameraPos); // Vector to the Center of the Sun (might also be able to use Vector3 La = Vector3.Normalize(Sun.Instance.sunDirection)
float tc = dot(L, La); // Component of L that is parallel to the view direction
float d = sqrt(dot(IN.L,IN.L)-dot(tc,tc)); //dot(x,x) gets magnitude squared. This just uses Pythagorean's theorem to get the distance from the center to the tangent of the view.
if ( _SphereRadius >= d && tc > 0) // Check to ensure tangent distance is less than sphere and that we are looking in the right direction.
{
Collision = true;
}

I apologize for just using pseudo code here. Couldn't remember all the references to the math functions.

Link to comment
Share on other sites

Actually, Now that I think about it, this would actually probably be much less computationally intensive than a ray-trace.

To detect if you hit the sphere:


float3 L = _PlanetOrigin - _WorldSpaceCameraPos; // Vector to Center of body from camera
float3 La = normalize(_SunOrigin - _WorldSpaceCameraPos); // Vector to the Center of the Sun (might also be able to use Vector3 La = Vector3.Normalize(Sun.Instance.sunDirection)
float tc = dot(L, La); // Component of L that is parallel to the view direction
float d = sqrt(dot(IN.L,IN.L)-dot(tc,tc)); //dot(x,x) gets magnitude squared. This just uses Pythagorean's theorem to get the distance from the center to the tangent of the view.
if ( _SphereRadius >= d && tc > 0) // Check to ensure tangent distance is less than sphere and that we are looking in the right direction.
{
Collision = true;
}

I apologize for just using pseudo code here. Couldn't remember all the references to the math functions.

I might be saying something stupid here, but if you do that whole check in the shader won't the same calculation be done over and over again for every pixel in the image? Isn't better to just compute it once per frame outside of the shader?

Also, what would make this less performance-intensive? Is the raycast checking for all colliders while this basically checks intersection with one body?

If either of you figure out how to have a moon cast a shadow on a planet I will buy you a beverage of your choice. :)

I believe rbray already has a good idea on how to do this.

Link to comment
Share on other sites

If either of you figure out how to have a moon cast a shadow on a planet I will buy you a beverage of your choice. :)

Already working on it. I'm re-jiggering the shadow mechanism I created for the clouds to work for moons as well :)

Link to comment
Share on other sites

I might be saying something stupid here, but if you do that whole check in the shader won't the same calculation be done over and over again for every pixel in the image? Isn't better to just compute it once per frame outside of the shader?

I'm using it to actually perform depth checking on oceans, so it is required that I do this for the pixel shader.

Also, what would make this less performance-intensive? Is the raycast checking for all colliders while this basically checks intersection with one body?

There are a couple implementations of ray-casting that could be used... but they are all iterative and can be pretty performance hungry. I don't think 1 raycast will make a huge difference, but many would.

https://unity3d.com/learn/tutorials/modules/intermediate/physics/physics-best-practices

Basically, ray casting has to loop over all the verticies/triangles in range and somehow determine which intersect the ray's path, and which is closest. My solution is an O(1) solution, ray tracing would be at BEST O(Log n) if it was heavily optimized in Unity.

So you would end up just doing this once for the center of the body each update of course :)

Edited by rbray89
Link to comment
Share on other sites

I'm using it to actually perform depth checking on oceans, so it is required that I do this for the pixel shader.

There are a couple implementations of ray-casting that could be used... but they are all iterative and can be pretty performance hungry. I don't think 1 raycast will make a huge difference, but many would.

https://unity3d.com/learn/tutorials/modules/intermediate/physics/physics-best-practices

Basically, ray casting has to loop over all the verticies/triangles in range and somehow determine which intersect the ray's path, and which is closest. My solution is an O(1) solution, ray tracing would be at BEST O(Log n) if it was heavily optimized in Unity.

So you would end up just doing this once for the center of the body each update of course :)

Got it, but I just looked it up and it's possible to set a layer "mask" for raycasting so it shouldn't be much of a problem. Plus if I do it this way it will be compatible with multiple moons, mods that add custom systems etc... So it looks like I'll use the built-in raycasting.

Link to comment
Share on other sites

Got it, but I just looked it up and it's possible to set a layer "mask" for raycasting so it shouldn't be much of a problem. Plus if I do it this way it will be compatible with multiple moons, mods that add custom systems etc... So it looks like I'll use the built-in raycasting.

Ah, true... I've been trying to figure out how to *Efficiently* do the shadows on bodies. I'm pretty sure I want to keep using the projectors, but I'm afraid multiple bodies will eat up all my interpolators.

Link to comment
Share on other sites

If either of you figure out how to have a moon cast a shadow on a planet I will buy you a beverage of your choice. :)

I want to add that SQUAD might also buy you guys your beverage of choice... They have yet to add true eclipses to stock and if either of you gets it working, I bet there is a high chance that they would look into adding it to stock. Or at least something similar. :)

We could finally see something like this:

jupiter-moons_3175749c.jpg

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