Cascaded Light Propagation Volumes, VS RC 2015, Retarded Calculators + More stuff

Well, let’s begin shall we! 🙂 ( This article isn’t very focused, it’s just small notes and such )


For a while I’ve been thinking about working on cascaded light propagation volumes, so I finally did. For now I just have a 64 (detailed) + a 32 ( less detailed ) grid that are filled using the voxel caches. Although I have not worked on the energy ratio yet ( My solution is hacky ), I like the result.

(Images scaled to fit, originally rendered at resolution 1920×1080. The whitish color is because I’ve got some simple volumetric lighting going on, although it doesn’t respond to the LPV yet) (PS. Still lots of work, so there are issues + light bleeding ) ( And there’s no textures on the trees, for… reasons and stuffPosted Image )
Posted Image

I’ve also worked on my BRDF shading model which is based on Disneys solution, and integrated my BRDF shading model into the LPV system ( Although it’s a simplified version, as we don’t need all the detail and some computations are meaningless in this context ). And I really think it made the indirect colors feel more part of the scene.

A poor quality gif showing how the light propagates through the scene:
Posted Image


On the complete other side, as I’m rewriting the engine I felt like upgrading to the RC Version of VS 2015 ( And dear god I recommend it to anyone ). And so I needed to recompile lots of libraries, such as SFML ( + most dependecies ), AntTweakBar, +small stuff. Now the AntTweakBar case was special, as it really only supports SFML 1.6. It contains a minified version of the SFML 1.6 events that it then uses, although when the memory layout changes in SFML 2.3 it all fucks up (Sorry). So I had to change some of the minified internal version of SFML to make it work, for anyone here is the modified part of the minified sfml (It’s hackyish, mostly c&p from the sfml sources, so there’s most likely errors and such, but for now it does the job ):

EDIT: See the code here ->

On top of that the performance of my engine in VS 2015 strangely increased by a few milliseconds which really surprised me. I’m not completely sure what it is. And in VS 2013 I had a strangely huge overhead when starting my application inside VS which made the file io incredibly slow, in VS 2015 this issue is gone and this huge waiting time is gone ( 20 seconds to a minute… ) :).

I finally got to redesign my gbuffer, and while there’s lots of work to be done, it all fits nicely, general structure:

2Channel: x = Depth, y = Packed(metallicness, anisotropicness),
4Channel: xy = Normal, z = Packed(subsurface, thickness), w = Packed(specular, roughness)
4Channel: xyz = Diffuse, z = Packed(clear_coat, emmision)

The tangent is then reconstructed later, and it’s pretty cheap and works fine for my needs. Now all the user has to do is call GBuffer_Retrieve(…) from their shaders and then all the data is decompressed which they then can use, the final data container looks somewhat like the following:

struct GBufferData
	float3 Diffuse;
	float3 PositionVS;
	float3 TangentVS;
	float3 NormalVS;
	float3 Position;
	float3 Normal;
	float3 Tangent;
	float SpecPower;
	float Roughness;
	float Metallic;
	float Emmision;
	float ClearCoat;
	float Anisotropic;
	float SubSurface;
	float Thickness;

Now, you might say “But what if I don’t want to use it all, huge overhead”, which is true, but, compilers! The cute little compiler will optimize out any computations that aren’t needed, so if you don’t need a certain element decompressed, it wont be (Yay)! So all of that fits together nicely.

But at the same time I think I’ve got an issue with the performance concerning filling the gbuffer stage, as it’s huge compared to everything else. Perhaps it’s the compression of the gbuffer, not sure yet.
Posted Image

But, it’s acceptable for now, although I think I can squeeze some cute little milliseconds out of it :).

On a side note I’ve also been trying to work on some basic voxel cone tracing but it’s far from done. And I seriously underestimated the performance issues, but it’s pretty fun.


Now due to family related issues I had to take my brother to our beach house ( Nothing fancy ), and there I allocated some time to work on my retarded calculator! It’s a small application based on a very basic neural network, I didn’t have time to work on my bias nodes or even my activation function, for now the output of the neuron is simply weight[i] * data, although it actually produces acceptable results. The network is composed of 4 layers:

  • 10 Neurons
  • 7 Neurons
  • 5 Neurons
  • 1 Neuron

Again, this was just for fun, I didn’t even adapt the learning rate during the back propagation, it was just to fill out a bit of time. The output from the application:

Starting trianing of neural network
  Train iteration complete, error 0.327538
  Train iteration complete, error 0.294999
  Train iteration complete, error 0.266
  Train iteration complete, error 0.240112
  Train iteration complete, error 0.216965
  Train iteration complete, error 0.196237
  Train iteration complete, error 0.177651
  Train iteration complete, error 0.160962
  Train iteration complete, error 0.145959
  Train iteration complete, error 0.132454
  Train iteration complete, error 0.120285
  ......... a few milliseconds later
  Training completed, error falls within treshold of 1e-06!


  Final testing stage
  Feeding forward the neural network
  Final averaged testing error: 0.0178298


Please enter a command...
>> f var(a0)
    #0 -> 2
    #1 -> 4
    #2 -> 3
    #3 -> 1
    #4 -> 4
    #5 -> 5
    #6 -> 2
    #7 -> 3
    #8 -> 4
    #9 -> 1
  Feeding forward the neural network
  Layer Dump:
    #0 = 29.346

>> e var(a0) algo({sum(I)})
  Evaluating error: (a0)
    Error: 0.345961


So, overall, I’m pretty happy with it all. But I haven’t been able to allocate enough time ( You know, life and stuff, school or whatever everybody suddenly expects of you ). But if anybody is reading this, can you comment on the colors of the images, meaning do you find it natural or cartoony, I find them a bit cartoony. Well, thanks for even reaching the bottom!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s