Development news: Beautiful shader rendering, compositing shaders extensions, shadow maps, Blender X3D exporter mods, and more

March 8, 2011
Shiny dark metallic material under multiple lights, with per-pixel lighting. Castle fountain level with shaders, fun with lighting 2
Castle fountain level with shaders, fun with lighting 1 Castle fountain level with shaders, fun with lighting 3
Volumetric fog Scene for the volumetric fog, here visible with fog turned off
Volumetric fog, with normal lighting turned off Spot light casting shadows
Textured spot light with shadow Flowers bending under the wind, transformed on GPU in object space
Toon and Fresnel effects combined 3D and 2D smooth noise on GPU, wrapped in ShaderTexture

We have some great news about the recent engine developments. As always, remember that you can try all the new features immediately by downloading a binary from our nightly builds!

  1. We have a new shiny method of rendering everything through shaders (OpenGL Shading Language, aka GLSL). All of the standard X3D rendering features, as well as our extensions, are available in this rendering mode. This results in much better look of many scenes.

    By default, the shader rendering is used only for shapes that require it — shapes that are shadow map receivers, use bump mapping, or have an explicit shader source code assigned (by the ComposedShader node, or by the new Compositing Shaders extensions). For testing purposes, you can switch to "View -> Shaders -> Enable For Everything" in view3dscene menu. The results should be the same (or better) than current renderer.

    • All the lighting is calculated per-pixel in shader rendering (we use the Phong shading). This is targeted at high-end GPUs anyway, so for now I decided that there's no point in making alternative per-vertex lighting (Gouraud shading). This means you should expect much nicer specular and spot light highlights. Try to make some smooth and curvy metallic surfaces to appreciate it :)

      Note that shapes that don't need any shader effects are still by default rendered through the fixed-function pipeline. So the performance of simple scenes should not suffer on low-end GPUs.

    • Our bump mapping effect is very nicely unified within the new rendering process. Previously we used special bump mapping shaders, limited to common situations. Now bump mapping works under all lighting and texturing conditions, and takes all normal VRML/X3D lights into account.

      We also make bump mapping "enabled" by default.

      Our bump mapping works also with two-side lighting now.

    • The shadow maps implementation is also nicely unified with new rendering. This gives a huge improvement, as now we take into account the shadows in the correct place of the lighting equation, scaling down only the contribution of the obscured light. So the shadows maps work fully correctly with multiple lights and multiple shadow maps over the same shape.

      Shadow maps also work now with all the multi-texturing possibilities. And, in general, they work with every VRML/X3D lights/materials/textures settings.

    New "View -> Shaders" submenu allows to choose when shaders are used:

    • Disable means never. Our effects will not work, standard ComposedShader will not work, shadow maps will not work. Also, screen effects (that always require shaders) are off.
    • Enable When Required means that we use fixed-function pipeline for the shapes that don't use any shader effects, and shader pipeline for shapes that do.
    • Enable For Everything means that we use shader pipeline for all the shapes. You will see beautiful per-pixel lighting on everything. On the other hand, rendering may be slower, unless you have really brand new GPU.

    Note that this all in development right now. There are some rough edges for now, that will be fixed before the next release, in particular:

    • Shaders caching is not implemented, so scenes with many shapes may take a while to load.
    • Parallax bump mapping is not ported to the new renderer for now. Only standard bump mapping is available. Similarly, Variance Shadow Maps are not ported — only standard shadow maps work.
    • Some less common multi-texturing options (add/subtract modes and such), and some volumetric fog options, are not ported yet to the new renderer.
  2. Another big news is our compositing shaders extensions. The short introduction to our "compositing shaders" idea is here, including the screenshots and information where to find the demo models.

    I wrote a paper about this that will be submitted for the Web3D 2011 conference, and will be available here publicly later (I don't think I should make it public before being accepted). Drop me a mail if you'd like to get a peek at my paper PDF earlier.

  3. "Kambi VRML test suite" will be renamed to "VRML / X3D demo models" upon the next release. The SVN already has many improvements:

    • New directory layout, to emphasize foremost what features are tested (shadow_maps, shaders etc.)
    • New compositing_shaders demos, testing our extensions for compositing shaders.
    • Some new shadow_maps demos (sunny_street and others) are added. Previously they were in the papers/shadow_maps_x3d/ subdir in SVN, which wasn't well known.
    • Some basic demos from our vrml_engine_doc are added
    • Many other fixes. Thanks in particular go to circular for a lot of reports on the Lazarus forum thread.
  4. Blender VRML/X3D exporters page updated, I added there a modified version of Blender 2.56 X3D exporter, fixing small things, and adding exporting of normalMap (for our bump mapping extension).

  5. For developers using FPC 2.2.4 (or older): a bug slipped into the last engine sources, preventing compilation with FPC 2.2.4 or older. A fixed version of the sources is released, see FPC version notes and engine sources. Thanks to Stephen H. France for reporting this!

  6. view3dscene has new File -> Preferences persistent settings for line width (controls all line visualization, like wireframe, bounding box, LineSet etc.), point size and default background color.

  7. VRML 1.0 PerspectiveCamera.heightAngle and OrthographicCamera.height support.

  8. Shadow maps PCF 4 bilinear fixes — it was too dark.