Jump to content

WIP - Environmental Visual Enhancements Development


rbray89

Recommended Posts

Hello rbray89

Sorry I haven't been around but the move of my mod to Kopernicus kept me busy for awhile. I have been looking at the links you sent me and at the function atmofunc() in SphereAtmosphere.shader. From your comments before it sounds like you are using a pressure model for the atmospheric scattering. Your equation kind of looks like the integral solution for the out scattering equation. Perhaps even the in scattering equation. So the question I have is what variables related to the scale height. Secondly your function can be expressed as the addition of exponential function being multiplied by two different variables. One of the variables is expressed as a square root. Is this related to the camera vector magnitude? Last question is link, https://www.desmos.com/calculator/acnjln4w0z shows a nice graph but the axis are not labeled so I don't understand what the units are. Sorry for all these detailed questions but I really want to understand this material instead of randomly turning knobs. Thanks.

Edited by jsimmons
wrong name
Link to comment
Share on other sites

I posted a video of the results of the latest checkin to overhaul at

. In my 10x kerbol configuration I have two cloud layers. The bottom layer are the cumulus clouds at 2500m and the next layer above is are the stratus clouds at 6km. The idea being stratus clouds are very large flat gray sheets.
Link to comment
Share on other sites

I posted a video of the results of the latest checkin to overhaul at
. In my 10x kerbol configuration I have two cloud layers. The bottom layer are the cumulus clouds at 2500m and the next layer above is are the stratus clouds at 6km. The idea being stratus clouds are very large flat gray sheets.

Nifty! Yeah, there is still some work to be done... I need to align the cloud layers to the particles and add some "randomness" to the particles within the shader.

I also plan on adding cloud types like flat, erhm... not flat, storm cells, and perma-cloud for places like Jool. You'll probably noticed that the cloud layer is now just one hexagonal sheet... It now moves the entire sheet, shifting it by the distance between particles. This creates a more or less seamless transition, with particles apearing in the outer edges and disappearing from the opposite side. Much nicer than the "hexagon out of nowhere" loading scheme we had before. In-fact, if the fad distance is close enough, particles will just seem to fade into existence as you get close to them.

- - - Updated - - -

Hello rbray89

Sorry I haven't been around but the move of my mod to Kopernicus kept me busy for awhile. I have been looking at the links you sent me and at the function atmofunc() in SphereAtmosphere.shader. From your comments before it sounds like you are using a pressure model for the atmospheric scattering. Your equation kind of looks like the integral solution for the out scattering equation. Perhaps even the in scattering equation. So the question I have is what variables related to the scale height. Secondly your function can be expressed as the addition of exponential function being multiplied by two different variables. One of the variables is expressed as a square root. Is this related to the camera vector magnitude? Last question is link, https://www.desmos.com/calculator/acnjln4w0z shows a nice graph but the axis are not labeled so I don't understand what the units are. Sorry for all these detailed questions but I really want to understand this material instead of randomly turning knobs. Thanks.

Yeah, I have to revisit the atmo shader in a bit. Re-tooling everything to use a common library of functions for mapping and lighting. As soon as it is done I'll post a detailed explanation of what all the variables do.

Link to comment
Share on other sites

What you have done so far does look nice. Ah yes I have noticed the giant hexagonal sheet. That is why it makes such great stratiform clouds. As for cloud types we have stratiform which is basic flat featureless cloud. So in this case each particle blends into one another. Fog is in fact a stratus cloud at ground level. The classic Cumuliform which is cotton ball type. Those tend to be around 1 to 2 km in length. They also tend to form clusters with a few kilometers between each cell. For storm cells you are looking at the nimbus type clouds which form a nice dumbbell shape. Also to consider are volcanic eruptions. In that case you have a dense cloud stack that has a vertical velocity besides your normal horizontal velocity. I assume at this point you are focusing on volumetric clouds?

Link to comment
Share on other sites

I assume at this point you are focusing on volumetric clouds?

Right. My primary concern is getting function similar to how it looked previously, then atmo. I basically work on whatever I'm inspired to or have ideas on improving :)

Link to comment
Share on other sites

Congrats Rbray, the clouds in the last version works nicer than ever. As you have pointed, the hexagon tiling effect is gone and all is much more fluid.

I've managed a way to get several sizes, textures and types of cumulus with just a pair of layers, so I'm looking forward to see how this works again with the "randomness" and the tweakable sizes of the previous version. It's gonna be epic.

About the rest, appart from the unfinished details, all seems to work perfectly.

I've sent you a new texture for the water. Much better than the actual one (is the one I'm using right now). Hope you like it and it can be useful.

Keep doing your magic, sir!

Link to comment
Share on other sites

I don't know why this came to mind but do people here remember Microsoft's old flight simulators? What I'm curious about is why are clouds in KSP SO difficult and complex and PC-demanding to do, and yet in 1999 flight simulator Microsoft arguably does a better job.

And they did that for 1999 PC's, which as I can remember from being a kid, were about ten thousand times slower than today's, and with caveman software.

What is making it so hard to implement good clouds into KSP?

I don't get it :P

Also...

not... Yet.

I picture rbray...

DastardlyMustache-950x712.png

Edited by samhuk
Link to comment
Share on other sites

Congrats Rbray, the clouds in the last version works nicer than ever. As you have pointed, the hexagon tiling effect is gone and all is much more fluid.

I've managed a way to get several sizes, textures and types of cumulus with just a pair of layers, so I'm looking forward to see how this works again with the "randomness" and the tweakable sizes of the previous version. It's gonna be epic.

About the rest, appart from the unfinished details, all seems to work perfectly.

I've sent you a new texture for the water. Much better than the actual one (is the one I'm using right now). Hope you like it and it can be useful.

Keep doing your magic, sir!

Hmm... I might have to take a look from your cloud configs if tweakable sizes work well. I could add that to my cloud pack!

Link to comment
Share on other sites

I don't know why this came to mind but do people here remember Microsoft's old flight simulators? What I'm curious about is why are clouds in KSP SO difficult and complex and PC-demanding to do, and yet in 1999 flight simulator Microsoft arguably does a better job.

And they did that for 1999 PC's, which as I can remember from being a kid, were about ten thousand times slower than today's, and with caveman software.

What is making it so hard to implement good clouds into KSP?

Well... So the Microsoft clouds are all artist generated. This means that a graphics artist created several cloud meshes that look good, and added them to the game. I also read that they made extensive use of billboards, where they would basically take a snapshot of how a distant cloud looked before they deleted it, and would replace it with a 2D image.

Now... In KSP we have a few issues doing that:

1) The camera is not locked closely to the craft. This means you can zoom out 50Km and view the clouds from orbit. Or you could stay within 10Km of the clouds, but move your camera around the craft. This poses some difficulty from a performance standpoint, as we would have to CONSTANTLY generate billboards which is fairly costly to do.

2) You have to be able to fly through them. I think MS flight simulator solved this, at any rate, it is still tricky to do.

3) It still has to look good from orbit. This is arguably the most difficult thing. There are TONS of cloud packages revolved around atmospheric flight, ground travel, etc. This is because from ground, you could use a perlin noise texture on a skybox and be done with it. If you get fancy, you could make it a procedural perlin shader to vary with time. In-atmosphere is very similar... you only see a small bit of atmosphere around you at any given time in an aircraft in atmosphere, so it makes it easier to fudge things. Drop a bunch of cloud meshes around you, some billboards in the distance and you are done with it. What happens when you go above that though... You'd have to figure out a way so that the volumetric clouds you had somehow get mapped to a texture so it can be rendered in-orbit. Or you have to do it the way I do it, and use the 2D texture as a map for where the volumetric clouds appear. If you do it that way, those big fluffy meshes from MS probably won't align to where the cloud map says there should be clouds...

So yeah, it can be very tricky :)

Hehe, love it!

Link to comment
Share on other sites

snip

Thanks for the detailed response, that was fun to read! :)

And as for the specifics, it's a shame one couldn't fluently switch between an MS-flight styled atmos rendering system (requiring basically a mini-hamster-wheel powered PC to render), then to different forms of rendering for high-alt and orbital viewpoints :(

Basically moving from a two-part rendering system (PQS to ScaledSpace), to a 3+ part rendering system.

EDIT: Hmm, older games like COD4 for example used a billboard system to generate the smoke from the smoke grenades, and basically all games pre-2010-ish used that. How it worked is they rotated the billboard to the user's viewpoint, so the smoke looked 3D, and when you rotated to see if it was, the actual 2D smoke texture billboards rotated.

Almost like older cloud/smoke rendering systems just used constant fooling-the-user rendering, trying to fool the user with fake 3D by rotating 2D. It worked quite well and maybe could increase head-rooms and performances for EVE?

Or atleast...have an optional 2D-rotating-billboard mode for peeps who want faster FPS/have a weak PC.

Edited by samhuk
Link to comment
Share on other sites

Thanks for the detailed response, that was fun to read! :)

And as for the specifics, it's a shame one couldn't fluently switch between an MS-flight styled atmos rendering system (requiring basically a mini-hamster-wheel powered PC to render), then to different forms of rendering for high-alt and orbital viewpoints :(

Basically moving from a two-part rendering system (PQS to ScaledSpace), to a 3+ part rendering system.

EDIT: Hmm, older games like COD4 for example used a billboard system to generate the smoke from the smoke grenades, and basically all games pre-2010-ish used that. How it worked is they rotated the billboard to the user's viewpoint, so the smoke looked 3D, and when you rotated to see if it was, the actual 2D smoke texture billboards rotated.

Almost like older cloud/smoke rendering systems just used constant fooling-the-user rendering, trying to fool the user with fake 3D by rotating 2D. It worked quite well and maybe could increase head-rooms and performances for EVE?

Or atleast...have an optional 2D-rotating-billboard mode for peeps who want faster FPS/have a weak PC.

Well, I actually use an advanced particle billboard shader. We have more problems than COD does... In COD, your character can't fly above and over the smokescreen to the other side, or move really quickly around it. In KSP the camera can pan and go very quickly around. This breaks the effect with traditional particles, as they rotate to face the camera, but then break the illusion of 3D.

The particle shader I developed is a tri-planar shader that switches out the texture depending on the direction you look at it from. This helps to maintain the feeling of depth.

Link to comment
Share on other sites

Well, I actually use an advanced particle billboard shader. We have more problems than COD does... In COD, your character can't fly above and over the smokescreen to the other side, or move really quickly around it. In KSP the camera can pan and go very quickly around. This breaks the effect with traditional particles, as they rotate to face the camera, but then break the illusion of 3D.

The particle shader I developed is a tri-planar shader that switches out the texture depending on the direction you look at it from. This helps to maintain the feeling of depth.

Wow, just read up on that more on the wiki... aaaaaand....

confused-baby.jpg?w=640

In all seriousness though, it's really impressive and interesting how you got advanced shader and atmos. features into not only KSP and unity, but also in a way that is a tleast somewhat possible on high-range PC's :)

Link to comment
Share on other sites

Wow, just read up on that more on the wiki... aaaaaand....

https://freedomborn.files.wordpress.com/2014/06/confused-baby.jpg?w=640

In all seriousness though, it's really impressive and interesting how you got advanced shader and atmos. features into not only KSP and unity, but also in a way that is a tleast somewhat possible on high-range PC's :)

Haha, I designed it from the ground up to be usable on my integrated graphics chipset with power saving mode on CPU. Mind you, you get a LOT better performance simply by using a lower res screen as well. U5 Should help a LOT though with multi core architecture built into the framework.

Link to comment
Share on other sites

Sorry to bring bad news but I'm seeing NULL exceptions.


AtmosphereObject: AtmospherePQS: OnSphereActive

(Filename: /home/builduser/buildslave/unity/build/artifacts/LinuxStandalonePlayerGenerated/UnityEngineDebug
.cpp Line: 56)

AtmosphereObject: Clouds2D is now MACRO

(Filename: /home/builduser/buildslave/unity/build/artifacts/LinuxStandalonePlayerGenerated/UnityEngineDebug
.cpp Line: 56)

NullReferenceException: Object reference not set to an instance of an object
at Utils.MaterialManager.ApplyMaterialProperties (UnityEngine.Material material, Single scale) [0x00000] in <filename unknown>:0
at Atmosphere.CloudsVolume.Apply (Single radius, Single speed, UnityEngine.Transform parent) [0x00000] in <filename unknown>:0
at Atmosphere.AtmospherePQS.OnSphereActive () [0x00000] in <filename unknown>:0
at PQS.Mod_OnActive () [0x00000] in <filename unknown>:0
at PQS.ActivateSphere () [0x00000] in <filename unknown>:0
at PQSMod_CelestialBodyTransform.OnPreUpdate () [0x00000] in <filename unknown>:0
at PQS.Mod_OnPreUpdate () [0x00000] in <filename unknown>:0
at PQS+^U^K.MoveNext () [0x00000] in <filename unknown>:0
UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
PQS:StartSphere(Boolean)
PQS:ForceStart()
PSystemSetup:SetPQSActive(PQS)
PSystemSetup:SetSpaceCentre()
PSystemSetup:OnLevelWasLoaded(Int32)

(Filename: Line: 4294967295)

Coroutine couldn't be started because the the game object 'TrackingStation' is inactive!

Then later I get these errors:


Filename: /home/builduser/buildslave/unity/build/artifacts/LinuxStandalonePlayerGenerated/UnityEngineDebug
.cpp Line: 56)

NullReferenceException: Object reference not set to an instance of an object
at Atmosphere.CloudsVolume.UpdatePos (Vector3 WorldPos, Quaternion rotation, Matrix4x4 mainRotationMatrix, Matrix4x4 detailRotationMatrix) [0x00000] in <filename unknown>:0
at Atmosphere.AtmospherePQS.Update () [0x00000] in <filename unknown>:0

Link to comment
Share on other sites

Sorry to bring bad news but I'm seeing NULL exceptions.


AtmosphereObject: AtmospherePQS: OnSphereActive

(Filename: /home/builduser/buildslave/unity/build/artifacts/LinuxStandalonePlayerGenerated/UnityEngineDebug
.cpp Line: 56)

AtmosphereObject: Clouds2D is now MACRO

(Filename: /home/builduser/buildslave/unity/build/artifacts/LinuxStandalonePlayerGenerated/UnityEngineDebug
.cpp Line: 56)

NullReferenceException: Object reference not set to an instance of an object
at Utils.MaterialManager.ApplyMaterialProperties (UnityEngine.Material material, Single scale) [0x00000] in <filename unknown>:0
at Atmosphere.CloudsVolume.Apply (Single radius, Single speed, UnityEngine.Transform parent) [0x00000] in <filename unknown>:0
at Atmosphere.AtmospherePQS.OnSphereActive () [0x00000] in <filename unknown>:0
at PQS.Mod_OnActive () [0x00000] in <filename unknown>:0
at PQS.ActivateSphere () [0x00000] in <filename unknown>:0
at PQSMod_CelestialBodyTransform.OnPreUpdate () [0x00000] in <filename unknown>:0
at PQS.Mod_OnPreUpdate () [0x00000] in <filename unknown>:0
at PQS+^U^K.MoveNext () [0x00000] in <filename unknown>:0
UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
PQS:StartSphere(Boolean)
PQS:ForceStart()
PSystemSetup:SetPQSActive(PQS)
PSystemSetup:SetSpaceCentre()
PSystemSetup:OnLevelWasLoaded(Int32)

(Filename: Line: 4294967295)

Coroutine couldn't be started because the the game object 'TrackingStation' is inactive!

Then later I get these errors:


Filename: /home/builduser/buildslave/unity/build/artifacts/LinuxStandalonePlayerGenerated/UnityEngineDebug
.cpp Line: 56)

NullReferenceException: Object reference not set to an instance of an object
at Atmosphere.CloudsVolume.UpdatePos (Vector3 WorldPos, Quaternion rotation, Matrix4x4 mainRotationMatrix, Matrix4x4 detailRotationMatrix) [0x00000] in <filename unknown>:0
at Atmosphere.AtmospherePQS.Update () [0x00000] in <filename unknown>:0

Is this the most recent build? Are you entering/exiting the tracking station?

Are you using a custom config?

Edited by rbray89
Link to comment
Share on other sites

Is this the most recent build? Are you entering/exiting the tracking station?

Are you using a custom config?

Yes this is the most recent build. The crash happens when a saved game is started. New game will do the same thing. I'm using a custom config which worked before and I can get it to you easily. Did some parameters change for cloud.cfg?

Link to comment
Share on other sites

Previous configs didn't work (I'm redoing my stuff). Some config parameters seem to have changed (the area setting is great for some effects!). But the mod works perfectly.

Link to comment
Share on other sites

Phew, trying to get EVE WIP, a bunch of other mods, opengl, and reshade+sweetfx with custom configs... Is a right chore.

The game directory literally has more files not associated with stock KSP...ridiculous...

at the moment getting really low FPS with opengl enabled. Tried to see if reshade had issues with opengl so disabled reshade and still bad FPS. Without opengl the game has good FPS. Hmm, so conclusion is opengl and EVE WIP are not friends.

Link to comment
Share on other sites

Thanks Proot. Updated my cloud.cfg and the Null Exceptions went away. My bad. Rbray89 will the clouds _particelMaterial _Color field also go away?

I noticed the clouds tend to flicker now.

Edited by jsimmons
Link to comment
Share on other sites

Thanks Proot. Updated my cloud.cfg and the Null Exceptions went away. My bad. Rbray89 will the clouds _particelMaterial _Color field also go away?

I noticed the clouds tend to flicker now.

Clouds flickering??? Is it kind of sparkly do you mean?

Link to comment
Share on other sites

Clouds flickering??? Is it kind of sparkly do you mean?

I think I've found that problem too. Tracking station/Map-View: the cloud shadows seems to have lag, so looks flickering and misplaced in movement.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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