Why waste all those resources rasterizing everything multiple times per frame? That being said, if you really do have something that needs to be re-rasterized, you can use Epic's trick of marking things as static and checking each frame to see if they actually need to be re-voxelized.
For this scene:
Dominant axis voxelization (anisotropic sampling enabled):
Static pre-voxelization once during initialization: ~25 to 35 fps
Dynamic voxelization per frame: ~25 to 35fps
Majority of the cost is actually in the cone tracing, which is why when I turn off anisotropic sampling there is such a massive increase in framerate - however, I have found out that anisotropic filtering is required for more physically accurate lighting, particularly with specular where the cone ratio is much smaller.
Of course, if I implemented an octree system, then the cost of building the octree might be too much for a per frame basis. Likewise if I had a more complex scene. Ultimately, the plan for this particular test scene was to keep the walls and floor static and the objects dynamic so that I can move them around to demonstrate the lighting effect. However, this is low on my priority list - something that I would implement at the end after I've corrected all noticeable artifacts.
At the moment, my aim is to get the lighting as accurate as possible. Then I would worry about performance. This is a hobby research project - I am not trying to create a game.
Anyhow, check out my latest semi-success in soft shadowing using vct:
[attachment=13621:giboxshadows.jpg][attachment=13622:giboxshadows1.jpg][attachment=13623:giboxshadows2.jpg]
float sampleVoxShadows(vec3 pos, vec3 dir, float lod)
{
float shadowSamp = textureLod(voxTex, pos, lod).w;
return shadowSamp;
}
float shadowConeTrace(vec3 o, vec3 d, float coneRatio, float maxDist)
{
vec3 samplePos = o;
float sampleVal = 0.0;
float accum = 0.0;
float minDiam = 1/voxDim;
float startDist = minDiam;
float dist = startDist;
while(dist <= maxDist && accum < 1.0)
{
float sampleDiam = max(minDiam, coneRatio*dist);
float sampleLOD = log2(sampleDiam*voxDim);
vec3 samplePos = o + d*dist;
sampleVal = sampleVoxShadows(samplePos, -d, sampleLOD);
float sampleWt = (1.0 - accum);
accum += sampleVal * sampleWt;
dist += sampleDiam;
}
return accum;
}
float shadow = 0; shadow += shadowConeTrace(voxPos.xyz, L.xyz, 0.1, 1.0); fColor.xyz = ((color.xyz*(1-shadow)+iDiffuse.xyz)*baseCol.xyz*texMap.xyz+spec);
I just need to figure out a way to remove the voxelized self-shadowing artifacts that are apparent on the blue sphere.
I also need to work out how to remove or reduce the add-on effect that the radiance has on direct lighting.