Space Nebula and Starfield Plugin ✧ V1 + V2 + V3 ✧ for UE4

@Gavi101 thank you for your investigation!

regarding the occlusion and your workaround, you are correct about the buffer-mechanism. this is used to reduce pixel-resolution independently from the rest of the scene. this makes occlusion harder to realise since the scenedepth for occlusion lacks behind one frame.
i assume that your workaround leads the nebula to occlude objects behind the nebula, but not objects within or in front of the nebula. this is a also a plausible owaviour.

in general the occlusion here gets done with an exomential-density-function within the Mat_DisplayNebulaBuffer and gets controlled with the “EnvironmentOcclusion” parameter. You do set this parameter the NebulaRenderSettings MaterialInstance and it gets set at begin play automatically. to change the parameter during play, you will find it in the Material within the RenderSphere-Component of the Nebula_BP in the level.

the buffer has major impact on performance but minor impact on the visual appearance so it’s a difficult tradeoff i hope to kick off in future releases using GlobalShaders etc. You may use the rendering unbuffered with some small changes and use accurate occlusion instead of the performance benefits. you may use r.SetSeparateTranslucencyScreenPercentage instead but this also inceases e.g. the stars…

EDIT:
okay rethinking about your color-disappearing problem it surely sounds like the typicall behaviour when a fresh created nebula is baked into a persistant texture. at last step in the creation-pipeline, and if the corresponding checkbox is set, the baking is freezing the editor for some seconds to write the data onto disk. As an important act you have to open those baked textures and press Save to make them persistant. also the color will then return :smiley:

OFF: here i describe some oversampling information since i thought the problem looks like that xD hf
"you told about the color disappearing which sounds like a different subject: oversampling. if the raymarching is taking too much steps within the volume, it cuts off the rendering to not not crash the display drivers and discards the color as a performance warning.
espacially when you create a nebula on your own, be carefull with the performance settings in the NebulaRenderSettings MaterialInstance!
also the shape of the nebula itself as impact on performance: many hard edges and light translucency gives the gpu more details to dislplay which yould cause oversampling.
As long as there is no bug occuring, use the different runtime and creation parameters to optimize your Nebula settings for your platform. as long as you don’t notice any undersampling slices you may decrease sampling for more performance. at least until those oversampling “warnings” are gone.
For super high performance you may look into the MatFunc_RaymarchNebulaDF and increase the maxSteps manually ;D

just to bring everyone up to speed, its working as expected, just need some help with making the nebula not disappear? or at least not have disappear all digital likelol when getting to far away? can I make it persistent throughout the level?

Also, i cant find the maxSteps, you are referring to, looked everyehre in the MatFunc_RaymarchNebulaDF Function

@Gavi101
The maxSteps amount is still hardcoded inside the big custom node within the matfunc: RaymarchDistancefield. there is quite at the beginning of the while loop a lin you may change with caution: if( ++samples > 512 )
512 is the maximun amount of steps before cutting off. but should be enough in general, otherwise one may look for making the nebula itself more performant (e.g. with the blur-feature)

I am not quite sure what yoh mean about dissapearing of the nebula or the digital likelol. can yoh explain this a bit more?
when lowering the EnvironmentOcclusion the nebula will dissapear because it fades with the background. it’s required for a smooth fade of an object leaving the nebula away from the camera.
the nebula itself is a persistant actor in the level. when too far away i recommend to set the RenderSphere to be HiddenInGame to stop the rendering without need to destroy.

I thought it might have been the “++samples” part, thank you for pointing it out Schlabbermampf :slight_smile:

just so that i dont have to ask again lol, where would i find this blur-feature?

and also pardon all the dumb questions, im asking as i need to get to know the plugin off by hart, as its forming to be a very big part of our games visuals on a truly gigantic scale, as we managed to stumble upon a very interesting origin ■■■■ solution, for large worlds, and this is where the nebula’s come in, i need the nebula’s to be visible for distances not to be disclosed yet, and that is where the question comes from, where I asked if i can make the nebula either fade gradually over distance traveled in a sense,

at the moment if I move away and hit a certain distance the nebula’s structure starts fading away, but it looks like checker blocks in random patterns as it fades, it does not fade away smoothly,

i have played with the EnvironmentOcclusion, and not getting the results i want, basically no change what so ever, but i think that the material domain changes i mentioned has a profound effect on this effect, i could be wrong but it handles the buffer and render differently,

included is the effect im talking about, the digital like fading lol, i need it to be gradually fading off in the distance so to speak

@Gavi101

Thank you for you description and photos :smiley:
You may try to set the parameter “SamplingDecreaseByDistance” to 0 and check if the effect still occure? You find this in the RenderSettings.

The Blur amount parameters are found inside the CreationSettings. The structure is blurred in a separate stage of the creation-pipeline to ease high contrasts for better fitting a specific performance profile.

Any chance you can describe the changes needed for unbuffered rendering (for more accurate occlusion)? Or at least point me in the right direction?

Alternatively, if I tried the accurate occlusion (presumably I connect the unused nodes in the raymarch mat function?), how is it meant to be set up? An alternate raymarch input for EndDist (which it minimum blends with)?

@SMRobust
yeah, thankfully we where able to solve this via email. since we have some prototyped extensions for android/vr, there are also some implementation of the renderer without separate reaolution-buffering. any advanced user may feel free to ask for this.

though the current plan is some major reimplementation with global shaders for hierarchical details and stuff. so those buffering/occlusion will reappear completely different in the future xD

nebulaexample01.jpg

​​​​​​​I really need this to work with objects behind, inside, and in front of the nebulas. Currently, it pretty much renders on top of everything regardless of the EnvironmentOcculsion setting. For instance, we have a 3rd person spaceship, an asteroid field that would occupy the same space as the nebula, and this is all taking place inside a type of ‘dyson sphere’. Is there any possible solution?

This is clearly a bug. First of all, occlusion and translucency sorting in the raycast is not a trivial thing, the renderer is computing different kinds of depth and nebula density gradient information for optimizing ray-casts (distance fields, …), all of this is directly on the gpu - unlike the regular objects that are stored on the cpu (3d mesh / poly or a primitive (that are especially gpu-cpu optimized for intersecting ray-casts, as seen in the PS4 Dreams project linked in the topic)), therefore gpu-cpu interaction is always a tricky thing, but I might be slightly wrong with this explanation. Yet our renderer is not optimized for very detailed occlusion calculation and is meant to be scaled quite large. But anyways, Schlabber will need to have a look, maybe it is just a vey trivial checkbox in the material system or preview mode - but maybe we have to ask for a small project file for debugging (sent to our email).

It’s very basic (doesn’t need a custom project to test): put some objects in and around the nebula - it will draw on top of everything regardless of occlusion. What process is there (if any) to improve occlusion at least to the point that the asteroids will appear inside/in-front/behind the nebula? My nebulas are quite large - at 10000 scale, like in the tutorial. For instance, does a nebula need to be created for occlusion to be ‘baked into the nebula’? I’m just using the premade nebulas at the moment.

Just noticed, the sun works very well, so it’s definitely possible. :slight_smile:

Actually, the sun only works great when it’s at the center of the map. I cloned one off to the side and it draws on top of everything (besides the other sun). In this example, the ‘smaller’ sun is much further away, but drawing on top of everything. The centered sun occludes like a physical object.

@Turknor
Hi there! while the occlusion is not perfect within the nebula-sphere, it must at least work for objects in front and behind it accurately. The EnvironmentOcclusion parameter is set in blueprint, so to show the changes during PIE, go for this parameter directly by selecting the Material of the RenderSphere in the NeblaActor in the level.
On the other hand i was able to reproduce the issue and like you said, translating the nebula away from the center leads to those occlusion artifacts. please add the ‘subtract ObjectPosition’ after the ‘CameraPosition’ node within the Mat_DisplayNebulaBuffer material. also make sure that the Material domain is set to surface.
hope this helps :smiley:

Actually, “add” did the trick instead of subtract (which left a weird spherical artifact/mask when viewed from specific angles). It’s still a bit weird when you turn the camera back and forth - like the depth angle changes too much. I’ll try to capture a good gif of it. Basically, we’re trying to see if there’s a way to make it feel more solid - like you wouldn’t want to fly through it, and it’s ~easy to see when you’d “collide” with it (we’d fake it, but that’s the impression we want to make). Think of the nebula sequence from the Han Solo movie. We want players to navigate nebulas like flying through a network of caves.

Thanks for your help, btw. Forgot to say “thanks”

Hey @Turknor

yes, the cave like structures is a nice idea. We are generally working on various improvements, but we’ll see how it’l progress.

Regarding the collision you were requesting, we have built in an async query on the gpu to capture color and density values. The functions are called PickNebulaColor and PickNebulaGradient. These can be bound to trigger events.
:slight_smile:

Hey Guys,

i know this may be a late post, but we actually solved this occlusion issue, its working for us thus far and the nebulas are not in the centre at all, ive done some testing with some opaque / translucent objects and had the same thing, Im happy to share what LeeFX and Schlabber assisted me in with and we got a workaround, been working on a different part of the game, so i just need to get all my ducks in a row, ill have a look and re-post the workaround, if you like?

Hey @Gavi101

thank you, this sounds interesting. We would be glad to see your workaround! We are as well working on some nice updates :slight_smile:
We would also be excited to see some work of your project!!

Lee

Hey Guys, was on leave for a few days, apologies for the late response,

@LeeFX GREAT!!! cool cant wait for those updates, will they be for V2 or will it be a new version?
oh and by the way the latest update is so cool, just there is a nasty sphere like hue glow?? ( see Glow1 image attached) lol, ill add a pic to show it, also still haven’t found a work around for the “pixelized distance culling problem” when thew player moves to far away it starts breaking up all digital like, would like it be visible for “light years” as the nebulae must be seen as thy will be huge in size, tried some of the solutions given so far but not working…just some input on this will be sooooooo appreciated lol

@LeeFX / - I’m digging deep in this plugin, so i can make visual element one of our projects best visual draw cards, that is why i’m investing a lot of time in this plugin as its amazing…

I will add some sneak peaks soon, :p;):smiley: still busy sorting out some weird object distortion issue when the spacecrafts move very fast… but we will figure it out :D:p

Firstly, the workaround that worked for me and, for the record, keeps all the “per pixel”-based GPU rendering process intact, weird i know, coz im working on a complete different material domain to get rid of this annoying lol… “rendering in front of everything side effect of ray marching and render target mechanics”

Quick Tip ) enabling 2-sided mode in properties for MAT_RenderNebulaHQ, solves the inward culling issue > toward the center of the Nebula, as the preview made the nebula disappear when getting close to it

the workaround after the update seems to not work anymore, but the nebula now culls correctly, behind objects. still having the moving away from nebula issue…lol issue but that’s off topic again @LeeFX where can i get the original settings from the original V2 Nebula Project, to compare with what I got? coz something changed and it actually working with no workaround or material domain changes??? if that’s the case io need to compare and revert back to the forum or back top you guys to anylize?