Development: water with caustics, lights editor, force Phong shading, shadow volumes improvements, more
Hi! Here are the latest news from the development of our engine and view3dscene:
Let's start with something shiny :) Victor Amat send me a demo of water with very nice caustics using our shadows and shaders and other VRML/X3D features. Be sure to switch to HD and fullscreen, for best quality:
This model shows a German Pavillion in the Universal Expo of Barcelona of 1929. The video shows a quick walk around the model in view3dscene, showing reflections and caustics visible above and under the water. We also show that all screen effects, like Screen Space Ambient Occlusion, work now with shadow volumes without problems :)
Lights editor is available in view3dscene. Use the menu "Edit -> Lights Editor" to bring it on. It allows to interactively adjust a lot of lights settings. The scene is not paused — you can still trigger animations, walk around and generally do everything while you tweak lights settings. Of course you can try it right now by using view3dscene from snapshots.
A lot of light parameters can be adjusted by comfortable sliders. My main motivation for implementing this was that light settings are usually hard to get perfect using an external modeller, like Blender, where light parameters do not precisely match the VRML/X3D concepts.
Basic shadows settings (by shadow maps or shadow volumes) are also configurable using this. In particular try out the "Shadows (Easy: Shadow Maps)" setting (not for PointLight), it just works on an arbitrary scene. I hope that this will also make our dynamic shadows algorithms more discoverable :)
Note: turn on per-pixel lighting by using "Shaders->Enable For Everything" menu item to see perfect lights results, this may be necessary to make local light effects really stand out. (See also the Shape.shading="PHONG"
extension below to mark inside your X3D file that some shapes should use this look by default.)
This is a tool for tweaking lights, not for designing them from the start. There's no option to add a new light, you can only change existing light sources. There's also no option to delete a light, although you can always disable light by setting "On" value to "No".
This is a much cleaned up and improved lights editor that was previously available in our "The Castle" debug menu. It allowed us to make some nice light effects in "The Castle" levels, now it's available for arbitrary 3D models :) Of course you can save the edited VRML/X3D file back on disk by "File -> Save..." menu items from view3dscene.
We have implemented a simple Shape.shading extension, allows you to force Phong shading for a particular shape.
Problems with cube maps on Intel GPU on Windows workarounded: for Intel HD 4000, generating cube maps is broken, so don't do it. For other models, use glCopyTexSubImage instead of FBO. Also, glGenerateMipmap is either crashing or broken (makes black/random contents) on this GPU, so don't use mipmaps for cube maps.
view3dscene menu item "Display -> Show Controls on Screenshots".
Shadow volumes cooperate now with screen effects that read depth (like SSAO).
Previous implementation had problems because on GPUs with packed depth+stencil (pretty much all existing GPUs? I didn't see a GPU without it...) you cannot just create depth texture and separate stencil buffer for FBO, instead you have to create special texture that contains both depth+stencil. And that's what we do now :)
For shadow volumes to work, your 3D models must now be perfect 2-manifold. No border edges (view3dscene "Help -> Manifold Edges Information" must say "0 border edges", and "View -> Fill Mode -> Silhouette And Border Edges" must show only yellow edges — no blue edges). Previously, allowing models with some border edges to be used as shadow volumes casters was an endless source of artifacts. And to avoid these artifacts, some parts of the castle1 were using CastShadowVolumes = false by default, effectively disallowing engine to automatically detect should shadow volumes be used (are border edges 0).
I think it's cleaner to just require 2-manifold models (as they were in practice required already for bug-free shadow volumes, it just wasn't enforced by the engine), and do something safe (instead of weird rendering artifacts) for other models.
Yes, this may force you to fix
your 3D models. If you really really miss old
non-perfect-manifold rendering, please report, we can make an option re-enable
it. But we would really like to encourage people to instead fix models
to be perfect manifolds. Remember that you can mark some shapes as not shadow casters
to avoid considering them at all in the manifold/border edges
set. Only the shapes that sum into a 2-manifold should have shadowCaster = true
.
Engine improvements for programmers: