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

1 hour ago, RaffaCT14 said:

That problem appears only with opengl, when I play without it there are only a lot of artifacts. :D

image.jpg

 

I'll wait the new version of the mod. Thank you for the help yesterday! :)

Those are just tears in the fabric of space and time. KSP was not meant mean to have this kind of shader, the space-time continuum has been broken... But seriously, I don't know what's causing these yet but the good thing is that I now get them from time to time so I might be able to fix them one of these days.

 

Edited: I'll just leave this here:

U8XzNIp.png

Edited by blackrack
Link to comment
Share on other sites

52 minutes ago, blackrack said:

Those are just tears in the fabric of space and time. KSP was not meant mean to have this kind of shader, the space-time continuum has been broken... But seriously, I don't know what's causing these yet but the good thing is that I now get them from time to time so I might be able to fix them one of these days.

 

Edited: I'll just leave this here:

U8XzNIp.png

I think I love you......

 

Nope I thought about it, just very platonic affection.

Link to comment
Share on other sites

9 minutes ago, Nhawks17 said:

Soon enough "Scatterer" is going to need a new name :P Feel like you're going beyond just atmo scattering now :D 

Well, I thought about it, but couldn't come up with a name catchier than scatterer :P suggestions welcome.

Btw I'm gonna need some opinions here.

Here are godrays rendered at 1/4 resolution and upscaled: http://i.imgur.com/mRb54bZ.jpg http://i.imgur.com/rwq9WoX.jpg (ignore the topmost aliasing artifacts)

And here rendered at native resolution: http://i.imgur.com/aHBRtCn.jpg http://i.imgur.com/jeUv8ap.jpg

Somehow I find the lower resolution gives them a more volumetric and natural feel while the crisp high resolution betrays their polygonal nature and takes away from the effect. Opinions?

Link to comment
Share on other sites

39 minutes ago, blackrack said:

Somehow I find the lower resolution gives them a more volumetric and natural feel while the crisp high resolution betrays their polygonal nature and takes away from the effect. Opinions?

lower res definitely gives off a "softer" look that feels more natural to me

Link to comment
Share on other sites

7 hours ago, blackrack said:

Somehow I find the lower resolution gives them a more volumetric and natural feel while the crisp high resolution betrays their polygonal nature and takes away from the effect. Opinions?

The quarter res, does look softer. Is it not possible to increase the width of the fuzziness on the high res ones, to make them similarly soft?

Either way. Amazing work, blackrack.

Link to comment
Share on other sites

9 hours ago, Errol said:

The real question is will eve clouds cause god rays?

Well this only works with geometry and also assumes any point in the screen will only go once into the light and once into the shadow, i.e objects in mid-air will break it.

3 hours ago, m4ti140 said:

Without the proper terrain shading (i.e. with sun side of mountains still alit despite being in the shadow of bigger mountains) the godrays look a bit out of place

You're totally right but there is nothing I can do about the terrain shading right now. These godrays are based on shadow volumes (think shadows in doom3) which I guess I could use for shadows but I'm not sure how to do that.

1 hour ago, Val said:

The quarter res, does look softer. Is it not possible to increase the width of the fuzziness on the high res ones, to make them similarly soft?

Either way. Amazing work, blackrack.

Currently there isn't, but I'll try to come up with something. I was just experimenting with this to see if a little blurriness would help.

Link to comment
Share on other sites

1 hour ago, blackrack said:

When I figure out terrain shadows this should be easy.

I mean, besides butting a shadow on it and "turning off" the sunlight the ambient lightning level should become darker. I mean the lightning that is used to render the ships in planet shadow, for example.

Link to comment
Share on other sites

On 1/27/2016 at 5:39 PM, blackrack said:

Well, I thought about it, but couldn't come up with a name catchier than scatterer :P suggestions welcome.

Btw I'm gonna need some opinions here.

Here are godrays rendered at 1/4 resolution and upscaled: http://i.imgur.com/mRb54bZ.jpg http://i.imgur.com/rwq9WoX.jpg (ignore the topmost aliasing artifacts)

And here rendered at native resolution: http://i.imgur.com/aHBRtCn.jpg http://i.imgur.com/jeUv8ap.jpg

Somehow I find the lower resolution gives them a more volumetric and natural feel while the crisp high resolution betrays their polygonal nature and takes away from the effect. Opinions?

1/4 res, definitely!

Link to comment
Share on other sites

So unfortunately, the method I'm using for extruding volumes for the godrays doesn't play well with all meshes resulting in many "holes" and instability in the geometry. This would be easily fixed if there was a possibility to access neighboring normals in a vertex shader but as far as I know this isn't possible. Extruding the terrain geometry on the CPU is also out of the question for terrain of that scale and especially for KSP's tight CPU budget.  This is unfortunate as this method is very fast, I might still release but it will always have holes and artifacts in it.

The issue can be seen in these screens on the box on the left.

 

 

In the end I might give shadow maps a try and then I'll be able to use them for terrain and for godrays (as per this paper http://www.moving-picture.com/documents/VolumetricShadowMapping.pdf) but I feel it's going to be much slower for real-time. On the upside it will look fuzzier and "more volumetric" than current method.

Edited by blackrack
Link to comment
Share on other sites

If may I ask... from where you "take" the terrain volumes?

Maybe... could you "fill" the geometry gaps using the low poly model used in scaled space? Probably the result will be not acurate, but nearest to the real mesh? Just an idea, I don't know if it is possible.

EDIT: btw, with Kopernicus you can generate a .bin with the lowpoly mesh of the bodies. ;)

Edited by Proot
Link to comment
Share on other sites

17 minutes ago, blackrack said:

So unfortunately, the method I'm using for extruding volumes for the godrays doesn't play well with all meshes resulting in many "holes" and instability in the geometry. This would be easily fixed if there was a possibility to access neighboring normals in a vertex shader but as far as I know this isn't possible. Extruding the terrain geometry on the CPU is also out of the question for terrain of that scale and especially for KSP's tight CPU budget.  This is unfortunate as this method is very fast, I might still release but it will always have holes and artifacts in it.

The issue can be seen in these screens on the box on the left.

 

 

In the end I might give shadow maps a try and then I'll be able to use them for terrain and for godrays (as per this paper http://www.moving-picture.com/documents/VolumetricShadowMapping.pdf) but I feel it's going to be much slower for real-time. On the upside it will look fuzzier and "more volumetric" than current method.

Cool! I was wondering how you were doing that. I assume you extrude vertices that maintain normal perpendicular to the ray?

Link to comment
Share on other sites

30 minutes ago, Proot said:

If may I ask... from where you "take" the terrain volumes?

Maybe... could you "fill" the geometry gaps using the low poly model used in scaled space? Probably the result will be not acurate, but nearest to the real mesh? Just an idea, I don't know if it is possible.

EDIT: btw, with Kopernicus you can generate a .bin with the lowpoly mesh of the bodies. ;)

Well, the problem is, these gaps only appear after extrusion and there is no real way to check for them. Besides, the geometry is taken directly from a duplicate camera using a replacement shader, so I don't really pass the geometry around or anything, it's why it's fast.

Edited: the gaps actually appear in the godrays, the objects are not a problem, gaps also "fill" and "empty" with a moving light source.

 

30 minutes ago, rbray89 said:

Cool! I was wondering how you were doing that. I assume you extrude vertices that maintain normal perpendicular to the ray?

Exactly, the code is very simple:

    	    float backFactor = dot( toLight, v.normal );
    	    float extrude = (backFactor < 0.0) ? 1.0 : 0.0;
    	    v.vertex.xyz -= toLight * (extrude * extrusionLength);

But as you can see it doesn't work well for all meshes. It's enough to introduce distracting gaps in the effect. Some people may not notice though and it may look good in some screenshots so I'll probably still release it as an option :P

I've looked around and basically the only way to fix this is to check neighboring edges and faces which can't be done in the vertex shader or alter the geometry by adding additional quads, which also can't be done in the vertex shader. Not sure if there is something else I'm missing.

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