Progress Update #31
Shaders and Particles
I had two goals for this sprint; to make the atmospheres work with more than one light source, and to improve the Niagara solar effects.
Atmosphere Shader
For the first few hours I tried to get a better understanding of the shader to see if there was any simple tweak to make it be illuminated by multiple light sources. The more time went on the more I thought that a bigger change would be needed, so towards the end of the day I reached out to the creator of the shader Dimev on GitHub for some advice. The issue that I opened on the repo can be found here.
In the response, Dimev pointed me to a version of the atmosphere shader on shadertoy as well as a self-made guide on porting shadertoy shaders to Unreal Engine materials. With all of these new resources I got back to work.
I ended up using a version of the same shader in a program called SHADERed so that I could mess around with it on the fly. Not too long after I had got multiple lights working on that version by just duplicating the light scattering calculation and only changing the light direction on the duplicate. It probably wasn't the nicest way of doing it but Dimev did warn me of this in the original responce.
Porting it into Unreal then I got the function all setup to take in an array of light directions but when it came to actually pass an array in the graph I got stuck. It seems that there is no nice way of making arrays in Unreal's material graph. As a result of this I had to scrap the array for 5 individual values light_dir0-light_dir4. This doesn't really "solve" the problem but it increases the maximum number of stars allowed in a scene from 1 to 5 and since 5>1 this fix shall stay.
From there I did the same thing for the light_intensity variable so that each star will effect the final brightness of the atmosphere by its own ammount. I then used a material parameter collection to store all of the valuse for these variables as well as another variable that holds the number of stars in the scene (a.k.a. the "array" length).
Finally I had this (extremely messy) graph:
Particle Effects
To make the solar particle effects better, I had a short list of things to do
- Make the effects pause in overview mode like the asteroids
- Make the material pause panning in overview mode
- Make stars created in overvierw mode paused by default
- Have changes to color immediately effect the particles
- Scale the effects based on the size of the star
- Have changes to position and size of a star immediately effect the system
Also, I am in the process of changing the UE project nema from CppGame to SpaceGame but Unreal and Visual Studio really don't want to play nice. This process could take some time.
Comments
Post a Comment