As I already promised too many times, here comes major CSharpRenderer framework update!
As always, all code available on GitHub.
Note that the goal is still the same – not to write most beautiful or fast code, but to provide a prototype playground / framework for hacking and having fun with iteration times approaching 0. 🙂 It still will undergo some major changes.
Apart from volumetric code as example for my Siggraph talk (which is not in perfect shape code quality wise – it is supposed to be a quickly written demo of this technique; note also that this is not the code that was used for shipping game, it is just a demo; original code had some NDAd and console specific optimizations), other major changes cover:
“Global” shader defines visible from code
You can define some constant as “global” one in shader and immediately have it reflected in C# side after changing / reloading. This way I removed some data / code duplication and potential for mistakes.
// shader side #define GI_VOLUME_RESOLUTION_X 64.0 // GlobalDefine // C# side m_VolumeSizeX = (int)ShaderManager.GetUIntShaderDefine("GI_VOLUME_RESOLUTION_X");
Based on old but excellent post by Rory Driscoll. I didn’t see much sense in computing tangent frames in mesh preprocessing for needs of such simple framework. I used “hack” of using normal maps as derivative map approximation – doesn’t really care in such demo case.
“Improved” Perlin noise textures + generation
Just some code based on state of the art article from GPU Pro by Simon Green. Used in volumetric fog for some animated, procedural effect.
Very basic implementation of BRDFs
GGX Specular based on a very good post about optimizing it by John Hable.
Note that lighting code is a bit messy now, its major clean-up is my next task.
Minor changes added are:
- UI code clean-up and dynamic UI reloading/recreating after constant buffer / shader reload.
- Major constants renaming clean-up.
- Actually fixing structured buffers.
- Some simple basic geometric algorithms I found useful.
- Adding shaders to project (actually I had it added, have no idea why it didn’t get in the first submit…).
- Some more easy-to-use operations on context (blend state, depth state etc.).
- Simple integers supported in constant buffer reflection.
- Other type of temporal AA – accumulation based, trails a bit – I will later try to apply some ideas from excellent Epic UE4 AA talk.
- Time-delta based camera movement (well, yeah…).
- Fixed FPS clamp – my GPU was getting hot loud. 🙂
- More use of LUA constant buffer scripting – it is very handy and serves purpose very well.
- Simple basis for “particle” rendering based on vertex shaders and GPU buffer objects.
- Some stupid animated point light.
- Simple environment BRDF approximation by Dimitar Lazarov from Black Ops 2
Within next few weeks I should update it with:
- Rewriting post-effects, tone-mapping etc.
- Adding GPU debugging
- Improving temporal techniques
- Adding naive screens-pace reflections and an env cube-map
- Adding proper area light support (should work super-cool with volumetric fog!)
- Adding local lights shadows