Saturday, November 3, 2007

Soft Shadows continued

like all shadow map algorithms, VSM also suffer from something called light bleeding (instead of shadows you will see some light color pops at the middle), this is due to the fact that its a probabilistic algorithm.
when the variance over a filter region is high we probably see light bleeding artifacts, we more likely to see LB in scenes where depth complexity is high.
the good news is that VSM have a lot more advantages than disadvantages if we compare it to other pixel based shadows algorithm, also we can reduce the light bleeding issue by doing a smoothstep with the variance value and some threshold.
some of the advantages:
1. we can use mip maps on the "shadow map" texture (the variance map).
2. we can blur it like regular texture blurring (no pcf needed), and because of that we can use hardware filtering so as linear, anisotropic etc.
3. we can get good soft shadows a lot faster and smoother than using pcf.

i have added softness for both spot and point lights, point light is a little bit tricky :)
here is few screenshots:
no soft applied
with soft applied
no soft applied
with soft applied

Saturday, October 27, 2007

Soft Shadows

i have added soft shadows using variance shadow map (VSM) for both point and spot lights, i also convert shadow code to use this new shadow technique because stencil shadows is fill rate/cpu intensive, especially for dynamic scene.

Saturday, October 20, 2007

Different Head

hi
i fix huge bug in md5 model, it seams that when i converted it to the new design i forgot update the transformation matrices (of the bones) after loading the mesh so every model that didn't had animation controller or bind animation will be wrong and distorted.
i found this while trying to add different head models (to same body model), and i so that the transformations matrices was identity!
here is screenshots marine model with different head:

Saturday, October 13, 2007

Dynamic Fluid on GPU

hi
i'v added dynamic water/fluid interaction on GPU using 2 render target and simple wave equation, so when you fire on water/fluid surfaces you will see the waves the bullet cause.
here is a screenshot:

Saturday, September 29, 2007

Water surfaces

hi
a lot of features and bug fixes, one of them is water surfaces.
i'v added water surfaces at the beginning but there was no lights interaction with it, i just rendered it last and it doesn't looks real, one of the main changes i made is recreating the material system so each material stage could use different shader, also each shader need to have few techniques if light interaction is needed.
after all shaders recreated for this new material system, every surface in the game could define how light interaction will effect the surface, so water will effected by lights.
i'v also fix refraction mask generation, i'm using ambient pass to generate refraction map, after that i'm rendering water surface into alpha channel of this map so i could mask pixels that doesn't need to be effected by water pertubation effect.
here is few screenshots of water inside the game.

ambient and point light
flash light interaction
refraction (close look)

Saturday, September 15, 2007

Soft Particles

hi
one of DX10 features is the ability to read from depth buffer, in DX9 you can't do it unless you are generating it by yourself and pass it as texture.
in my ambient pass i'm using multiple render target, one for color buffer and one for depth, after that i'm setting it as texture and use it when needed in the pixel shader.
for soft particle effect, i'm reading the depth value from depth buffer rt and compare it with particle depth, then i'm compute new alpha value based on the difference between those values, (closest particle to level surfaces = more transparent).
here is few screenshots of the effect.
i marked in red the area the particles intersect with level surfaces.


Saturday, September 8, 2007

MegaTexture

hi
after seeing id tech 5 mega texturing, i though how the heal he did that?
so i start digging and reading a lot about clipmaps and streaming and i succeeded creating mega texturing.
to create the huge textures i'm using L3DT (pro trial version) i'v created 8k and 16k, the 16k texture took more than 12 hours to complete and with 5 mip levels its takes 1 giga.
my computer have only 1 giga ram so it's not impossible to use this texture in system mem.
here is few screenshots showing the difference between using mega texturing and not.
note that this is just sample app using engine features but for now its isn't integrated inside.
the app uses 16k streaming texture with about 20 mb gpu mem.
the fps difference is big because mega texture ps takes 74 instructions (not optimized)

using mega texture

not using mega texture (very blurry)