Yesterday, I decided to learn more about O3D render/scene graphs in order to implement multi-pass shading effects. It’s still a bit of a hack, but I’ve written a few helper functions for myself to abstract away some of the leg-work in assigning render targets and uniforms whilst creating ViewInfo objects, as well as creating materials with shaders.
I do have one problem with accessing the depth buffer as a texture, but I’ve posted on the O3D-discuss mailing list and I’m hopeful someone will have an answer there. This has meant that I’ve had to write a custom phong-shader which writes the depth to the alpha channel. Anyway, read on to see what I came up with.
Controls:
- Mouse-wheel tracks camera in/out
- Click & drag to rotate the scene
- Slider bar changes depth-of-focus
There are no floating point textures in webgl for the moment(talk of making it an extension I think), take a look at the o3d shadow demo it encodes the depth into rgb. Although, from the looks of things limiting to the alpha channel works really well anyway, 5* on the demo. I’ve just been working on DOF in GLGE I tried SSAO as well but the performance wasn’t all that good with all the packing and unpacking(half the frame rate) :-( I Might try your technique of limiting to 8 bit and using the alpha channel ;-)