With Visual Studio 2012 Microsoft dumped the DirectX SDK, and the effects library with it( along other things), which I needed for my engine.
To compensate for that, I wrote some code to load an xml file that describes the outputs and inputs of the shaders, just like the .fx files used to do.
Having that working, I realized xml is a bit too cumbersome for that use, and coming up with some small language will speed up development time, plus, I've always wanted to write a parser/compiler/vm.
Before starting with it, I decided to try to do something smaller first, something to parse/execute a kind of assembly code meant to run embedded in an application.
So after a lot of coding, and messing with regular expressions, I finally managed to get it working. 
The parser can load code like this:
and produce a memory representation that the vm can execute. The example above adds in parallel two arrays of floats, and stores the result in another array. 
The vm code runs from 10 % to 20 % slower, which isn't that bad for a simple implementation. Ok, so now some code! I won't put the VM, as it is a lot of code, but I'll put the parser.

Parser:

So I finally got to work again in the particles simulation, and I made some advances. Mainly, fixing the displacement of the particles and adding a "pseudo z culling" step. Actually, what I'm doing is compare the distance of the sample to the camera with the distance of the scene to the camera, and only add the sample to the final color if the distance is smaller.
Oh, I forgot. I also optimized part of the voxel update code, so I'm now using 80.000 particles at 90 - 110 fps. Quite nice!
There are things to do though. First of all, add some shading, maybe even shadows. I have other thing in mind, that I mentioned earlier, regarding compression of the voxels ( particles are sparse after all right? ) but it still needs some more work.
For now, here are some screens:





Pages

Powered by Blogger.