Support for specular maps (and more) in view3dscene, Blender exporter to CommonSurfaceShader

Posted on

1_blender_monkey_0
2_more_textures_with_specular_maps_0
3_rust_metal_shininess_texture_0
4_synthetic_metal_textures_specular_map_0
  1. I was working intensively on support of CommonSurfaceShader (aka “material on steroids”) in view3dscene and Castle Game Engine, and the following features have been added:

    • specular maps (vary specular color throughout the surface, e.g. making it selectively shiny or “rough”)
    • shininess maps
    • ambient maps
    • configuring displacementFactor for parallax bump mapping
    • support for reflectionFactor and transmissionFactor in ray-tracer

    This is all added to the previous features: support of basic factors (similar to the standard Material features) and normal maps (bump mapping). Bump mapping was also improved a bit.

    The demos are inside bump_mapping/common_surface_shader subdir (you can download complete demo models contents from GitHub). You can open them using the latest view3dscene from snapshots. Or you can just compile the engine from GitHub

    The updated CommonSurfaceShader information is here. The fields marked in bold there are supported in view3dscene / Castle Game Engine. There’s also a lot of text that may help you understand how CommonSurfaceShader works:)

  2. In a (related) news, I have improved our custom Blender exporter to X3D. It now exports the CommonSurfaceShader, including various texture configurations like normal maps, specular maps and so on.

    This means that an artist can configure all the goodies mentioned above from Blender! Just export with “Use CommonSurfaceShader” checkbox, and the resulting file will include CommonSurfaceShader with all the parameters and texture configuration.

    The details are here.

    My notes about exporting X3D to Blender (part of the Castle Game Engine documentation) include a detailed description how to use this feature. See the “Extra material textures (normal maps, specular maps) with CommonSurfaceShader” section here.

    The modifications to the Blender exported are not yet submitted to the Blender developers, but they *will* be:) I want this to be present in Blender out-of-the-box.

    At the end, I wanted to emphasize that this work was sponsored by Castle Game Engine patrons on Patreon. If you like what I’m doing, please consider supporting me, through the page https://www.patreon.com/castleengine . This really helps me spend more time on the engine and view3dscene, and you can also request a particular feature. This month, Robert Daniel Murphy requested “easy export from Blender of normal maps and specular maps”, and look what cool things happened! 🙂

Comment on this post ➤

Ray-tracer improvements (aka “Did you know our engine has ray-tracer?”)

Posted on

ray_tracer_textures
ray_tracer_smooth_1
ray_tracer_smooth_normals

I was playing with the ray-tracer inside Castle Game Engine this weekend. Although the focus of our engine is real-time rendering (not a software ray-tracer), but there is a distinct pleasure when you’re able to generate pretty images without the help of OpenGL:)

New ray-tracer features:

  • It can now use smooth normal vectors.
  • Classic ray-tracer supports now 2D textures, with bilinear or nearest filtering.
  • It looks at Background.skyColor.

You can try it out e.g. using view3dscene Ctrl + R (“Display -> RayTrace!” menu item). From code, you can use the CastleRayTracer unit.

The ray-tracer in CGE is still just a toy subproject for me. Our ray-tracer does not try to compete with professional, full-featured ray-tracing renderers existing today. But it is a nice demo that, using Castle Game Engine API, you can take a scene and create a decent ray-tracer, because

  1. All the necessary information about the 3D scene is available,
  2. You have a fast structure (octree) to perform ray collisions.

I hope that you enjoy it!:) If anyone here is interested in putting more work into this way of rendering (we have classic ray-tracer and a path-tracer), if you dream about creating a real, full-featured physically-based solution, than please join the development of CGE! I would happily see someone extend the CGE ray-tracer to render some really cool stuff! 🙂

An old gallery of images is here.

Comment on this post ➤

CommonSurfaceShader in view3dscene and Castle Game Engine implemented:)

Posted on

CommonSurfaceShader with bump mapping
CommonSurfaceShader with steep parallax bump mapping and self-shadowing
CommonSurfaceShader defining a mirror for ray-tracer

I’m proud to announce an initial implementation of CommonSurfaceShader in Castle Game Engine and view3dscene! CommonSurfaceShader acts as a powerful “material on steroids” X3D node, in particular with support for normal maps (bump mapping).

1. The documentation

2. The demos

3. To try this *now*, you can use view3dscene from our “nightly builds”. Or you can compile any of the engine tools (like examples/3d_rendering_processing/view_3d_model_basic ) using the engine code from GitHub.

This is happening thanks to the support on Patreon (https://www.patreon.com/castleengine). Robert Daniel Murphy sponsored improving the Blender exporter to be able to export normalmaps (and specular maps and similar) from Blender to Castle Game Engine easily. I took the idea a little further, and implemented it by adding the CommonSurfaceShader node to the engine, and then the Blender exporter will export an X3D file with the CommonSurfaceShader.

This way the Blender exporter will be improved for everyone, e.g. Instant Reality / X3DOM users will also benefit by having an exporter that can write CommonSurfaceShader.

More work is yet ahead (the Blender exporter, and the specular maps are not done yet). But the CommonSurfaceShader, with many basic fields, and normal maps, is supported now!

The CommonSurfaceShader works both for interactive rendering, and for our toy raytracer. It is also understood when editing materials in view3dscene (Edit->Edit Material->… menu items).

P.S. If you like view3dscene, or you’d like to request more view3dscene features like that, please support me on Patreon !:)

Comment on this post ➤

fpcupdeluxe and Castle Game Engine

Posted on

fpcupdeluxe

Recently I’ve been playing with fpcupdeluxe, a great tool to install FPC/Lazarus (stable, unstable…), with cross-compilers. I’m very impressed by it, and I wrote a wiki page documenting how to use it (in the context of Castle Game Engine, although contains some general notes too):

https://github.com/castle-engine/castle-engine/wiki/fpcupdeluxe

In another news: Ten Square Games is helping us by lending Apple hardware with the latest Mac OS X! This is a great help towards the upcoming improvents of iOS in the Castle Game Engine (integrating it with the build tool better). Thousand thanks!

Comment on this post ➤