Castor3D (C++)

Description

Castor3D is a 3D engine written in C++ 17.
It works on Windows and on GNU/Linux.
It uses Vulkan as rendering API.

Features

  • Clustered lighting to compute all light sources.
  • Using a visibility buffer for opaque objects.
  • Weighted Blended rendering for transparent objects.
  • Normal mapping (using Mikktspace or explicit bitangents specification).
  • Shadow Mapping (allowing to choose between Raw, PCF or Variance Shadow Maps).
  • Parallax Occlusion mapping.
  • Screen Space Ambient Occlusion (using Scalable Ambiant Obscurance implementation).
  • Reflection/Refraction Mapping.
  • PBR rendering (hybrid Metallic/Specular/Roughness workflow), and Phong/Blinn-Phongrendering.
  • HDR rendering with various tone mapping operators and various colour grading operators.
  • Screen Space Subsurface Scattering (without backlit transmittance yet).
  • Volumetric Light Scattering, for the directional light source.
  • Cascaded Shadow Maps for the directional light source.
  • Global Illumination, through Light Propagation Volules or Voxel Cone Tracing, your choice.
  • Frustum culling.
  • Scene graph.
  • Render graph.
  • Modular architecture through plug-ins.
  • Shaders are generated automatically from material and pass configuration.
  • Shaders are writable directly from C++ code.
  • Scenes are described using a text format easily comprehensible and extensible.
  • Asynchronous or synchronous rendering.
  • Using Mesh and Task shaders, if available.
  • GUI primitives.

Implemented plugins

Importers

Importer plugins can add support for new mesh file formats.
  • ASSIMP: Multiple format mesh importer, using assimp library.
  • glTF: glTF 2.0 importer, more precise than assimp's provided one, using fastgltf library.

PostEffects

  • Bloom: HDR Bloom implementation.
  • PbrBloom: PBR Bloom implementation.
  • DrawEdges: Detects and renders edges, based on normal, depth, and or object ID.
  • FilmGrain: To display some grain on the render.
  • GrayScale: Converts render in gray scale.
  • LightStreaks (using Kawase Light Streaks).
  • FXAA Antialiasing.
  • SMAA Antialiasing (1X and T2X so far).
  • Linear Motion Blur.
  • DepthOfField: Depth of Field implementation.

Generators

They allow procedural generation of meshes or textures.
  • DiamondSquareTerrain: to generate terrains inside Castor3D scenes, using diamond-quare algorithm.

Generics

They're here to allow general extensions of the engine features.
  • ToonMaterial: A toon material (to be combined with DrawEdges plugin).
  • WaterMaterial: Water material, using normal maps.
  • FFTOceanRendering: Ocean rendering using FFT generated surfaces.
  • WavesRendering: Basic ocean rendering, specifying waves attributes.
  • AtmosphereScattering : Sky and atmosphere rendering.

ToneMappings

The definitions of tone mapping operators.
  • None: A passthrough, used when rendering to HDR screen.
  • Linear: Default tone mapping.
  • Haarm Pieter Duiker.
  • Hejl Burgess Dawson (Filmicx).
  • Reinhard.
  • Uncharted 2.
  • ACES.

Other applications

Along with the engine and its plugins, the projects also comes with other applications:
  • CastorViewer, a scene visualizer, using Castor3D.
  • ImgConverter, image converter, from all images formats to XPM or ICO.
  • CastorMeshConverter: A converter from various mesh files to Castor3D mesh format.
  • CastorMeshUpgrader: Upgrades from earlier versions of Castor3D mesh format to the latest one.
  • HeightMapToNormalMap: Converts a height map to a normal map.

Documentation

The project's documentation is contained in the headers, and can be generated with Doxygen.
The project itself is generable for supported platforms, using CMake.

Examples


Version 0.16.0

Date : 2024-04-22

Features

  • Implemented clustered lighting
    Intel Sponza's 10000 candles.
    Clustered Deferred/Forward lighting
  • Implemented colour grading operators.
    Colour Grading
  • Implemented a Depth of Field plugin
    Depth of Field
  • Implemented a glTF importer plugin.
  • Removed deferred rendering.
  • Implemented context blocks in scene file parser.
  • Added support for HDR screens.


Version 0.15.0

Date : 2023-04-28

Features

  • Fixed COM binding, and finished implementation of a basic C# viewer application.
  • Implemented support for multiple lighting models in the same scene.
    Multiples Light Models. Multiple Light Models Nyra
  • Improved PCF shadows, sampling a Poisson disk.
  • Castor3D now uses a reversed Z buffer.
  • Drastically improved overlays preparation and rendering performances and scalability.
  • Got rid of almost all remaining uses of std::shared_ptr.
  • Reworked PBR specular component, to make it behave consistently when used with metalness.
  • Improved environment map reflections, to make it more consistent with IBL.
  • Implemented static nodes, that will only be rendered once in shadow map passes and voxelize pass.
  • Moved CastorGui plugin code in Castor3D, and implemented more GUI controls.
    Text Edit behaviour
  • Added ways to invert normals, either at mesh import or through the material pass.


Version 0.14.0

Date : 2022-11-21

Features

  • Allowed to change Castor3D engine length unit.
  • Allowed background passes customisation.
  • Added support for multi-pass blending.
  • Full rework of Pass, introducing PassComponent to improve flexibility.
  • Implemented full support of glTF material specification and extensions.
    Attenuation Clearcoat Sheen Iridescence Transmission
    glTF's iridescence model glTF Volume and attenuation model, along with transmission
  • Implemented atmosphere scattering
    Atmosphere Scattering, Clouds, Island Atmosphere Scattering Atmosphere Scattering Surface
    Atmosphere Scattering Clouds Rendering Atmosphere Scattering,Terrain, Volumetric Light Scattering.
  • Improved DiamondSquareTerrain, adding island mode and support for biomes.
    Colored Terrain Textured Terrain with slope and biomes
  • Removed PlyImporter plugin.
  • Implemented PBR bloom, which blooms the whole image.
    PBR Bloom


Version 0.13.0

Date : 2022-06-08

Features

  • Drastic performance improvement.
  • Implemented mesh and task shader, with frustum culling and backface culling.
  • Full rework of external data import (meshes, skeletons, animations).
  • Implemented morph target animations, replacing the per-vertex animations.
  • Added support for multiple texture coordinates sets (up to 4).
  • Added vertex colour component.
  • Merged the two implemented PBR workflows into an hybrid one, more flexible regarding extern scenes import.


Version 0.12.0

Date : 2022-03-20

Features

  • Now using RenderGraph to build a frame graph.
    The scene voxellisation graph, generated with RenderGraph.
  • Now using bindless textures.
  • Using MultiDrawIndirect to draw scene objects.
  • Implemented a loading screen.
    The default loading screen
  • Implemented texture animations (tile maps and transforms).
    Texture transform animation
  • Implemented scene node animations.
  • Added DrawEdges plugin, to detect and draw edges.
    DrawEdges
  • Implemented water rendering on plane surfaces.
    Water rendering and interactions with indirec lighting.
  • Implemented basic ocean rendering plugin.
    Basic waves rendering
  • Implemented FFT based ocean rendering plugin.
    First rendering Finished effet
  • Implemented toon materials collection.
    Pufi
  • Added ACES tone mapping plugin.
  • Added HeightMapToNormalMap application.


Version 0.11.0

Date : 2021-02-19

Features

  • Castor3D now relies on Ashes, allowing support for OpenGL, Direct3D11 and Vulkan renderers.
  • GlslWriter has been completely removed and replaced by ShaderWriter, allowing the generation of shaders in the appropriate rendering API shader language.
  • Added support for cross skyboxes.
  • Enabled anisotropic filtering control from scene file.
  • Added support for shadow map filtering choice (Raw, PCR or VSM).
  • Added sendEvent function to Engine, to be able to execute an event directly if there is an enabled device.
  • Extracted binary/text write/parse classes to new files, to reduce includes dependencies.
  • Reworked mip level management for textures loaded from files.
  • Added volumetric light scattering.
    Volumetric Light Scattering
  • Upgraded scene files, meshes can now hold a default material.
  • Render queue now uses SceneCuller from its render pass, and this culler is used for frustum culling.
  • Cascaded shadow maps are implemented and functional.
    Cascaded Shadow Maps
  • Overlays are now rendered in their own framebuffer, and then combined with the 3D rendering.
  • Shadow maps now use texture arrays (2D or Cube).
  • Added Light Propagation Volumes global illumination implementation.
    Park with LPV San Miguel with LPV
    LPV LPV + VLS + Pufi
  • Added Voxel Cone Tracing global illumination implementation.
    Sponza VCT Park + VCT
    Sponza + VCT
  • Implemented texture animations (UV rotate and translate).
    Basic texture animation Animated fountain with bloom
  • Création de l'effet LinearMotionBlur.
    Object Linear motion blur Camera linear motion blur
  • ShaderDialog now displays all the shaders for the pipeline used to display a pass.


Version 0.10.0

Date : 2017-12-30

Features

  • Renamed namespace Castor3D to castor3d.
  • Emissive in a material is now stored on a single floating point (emissive maps still hold a colour though).
  • Implemented Physical Based Rendering, using both metallic/roughness and specular/glossiness workflows.
    PBR/SSR comparison
    PBR rendering (Metallic/Roughness)
  • RenderPipeline now also holds the shader program.
  • Implemented Screen Space Subsurface Scattering (without backlit transmittance, though).
    Without SSSSS With SSSSS Detail comparison
  • The light pass result is now stored in two render targets: diffuse and specular.
  • Vertex buffers now use a buddy allocated pool.
  • Shadow mapping now uses variance shadow maps.
  • Transparent meshes are now rendered using Weighted Blended OIT rendering.
  • Screen Space Ambiant Occlusion has been improved, using Scalable Ambiant Obscurance implementation.
    SSAO comparison
  • Parallax Occlusion mapping is implemented.
    Parallax Occlusion Mapping
  • Reflection and refraction mapping have been implemented.
    Reflection and Refraction
  • Deferred rendering has been fully integrated to the engine, for opaque objects rendering.
  • Created components for submeshes, to move functionalities out of Submesh, and make it more flexible.
  • Rendering now uses a depth prepass.
  • Created ColourSkybox, to handle background colour and skyboxes in the same way.
  • Created ShaderBuffer class, to be able to handle SSBOs or TBOs in a similar way, choosing the most appropriate one, depending on running machine.
  • Created a plugin to generate terrains using Diamond Square algorithm.
    Diamond Square terrain
  • Events from CastorGUI are now forwarded to the user.
  • Removed almost every importer plugin, keeping only Assimp, OBJ, and PLY importers.
  • Created SMAA post effect.
    SMAA comparison
  • Created Kawase Light Streaks post effect.
    Kawase Light Streaks
  • Created Film Grain post effect.
  • Technique plugins have been completely removed.
  • Created Uncharted 2 tone mapping plugin.

Bugs corrections

  • Fixed bounding boxes for per-vertex animated and skeleton animated meshes.
  • Repaired an reenabled frustum culling.
  • Fixed alpha rejection.

Downloads



Version 0.9.0

Date : 2017-03-26

Features

  • Complete review of the render loop: RenderPipeline is not a unique instance anymore, it now holds any necessary informations to render on object type (states, shader program, uniform buffer bindings, ...).
  • The rendering has been dispatched in RenderPass instances, which hold one ore more RenderQueues, which are updated asynchronously on CPU, using a thread pool. This allows the GPU loop to be free of almost all CPU computations.
  • Skyboxes have been added.
    Equirectangular texture 8192x4096 to 4096x4096 Skybox
  • Binary export has been reviewed completely, using now a chunk data format (like 3DS or LWO). It is used for meshes and skeletons.
  • Basic fog algorithms have been implemented (linear, exponential, and squared exponential).
    Squared exponential fog
  • Added support for per-vertex animations.
    Per-vertex animation
  • Implemented frustum culling.
  • Implemented a colour picking pass.
    Colour picking
  • Implemented shadow mapping, the light sources can produce shadows, and objects can project and/or receive shadows.
    Spot light shadow mapping
  • Implemented particle systems, letting the developer choose the implementation (CPU through inheritance, GPU via Transform Feedback or Compute Shaders).
    Particle system
  • Fixed the GLSL lighting computations, and the light sources management (they are now rotated via scene node only), to have a correct rendering, without dirty hacks.
  • Added Compute Shaders, along with Shader Storage Buffers and Atomic Counter Buffers.
  • Textures implementation has been greatly modified, we now have TextureLayout, which holds the TextureImages and the TextureStorage per image. It allowed the creation of cube textures.
  • The billboards rendering doesn't use geometry shaders anymore, it now relies on hardware instancing.
  • FrameVariableBuffer has been replaced by UniformBuffer, which doesn't depend on the shader program anymore, and by UniformBufferBinding which depends on it. The UniformBufferBinding instances are stored in the RenderPipeline.
  • FrameVariable has been replaced by two classes: Uniform (for uniform variables coming from a UniformBuffer), and PushUniform (for uniform variables that don't).

Bugs corrections

  • Textures data transfer to RAM has been fixed.

Downloads



Version 0.8.0

Date : 2016-04-07

Features

  • The text overlays now can have a horizontal and a vertical alignment.
  • The back frame buffers are retrieved and bindable, though you cannot add attachments to it.
  • SceneFileParser has been extended, to be able to use parsers from external plug-ins.
  • The skeleton animation system is now finished and working.
    Skeleton animations
  • Castor3D can now read scenes from zip archive files.
  • Castor3D now renders the scenes using HDR and tone mapping.
  • Implemented a Phong tessellation subdivider.
  • Implemented a FBX importer plug-in.
  • The first post effect plug-in has been implemented: HDR Bloom.
  • New plug-in, allowing creation of GUIs inside Castor3D scenes: CastorGUI.

Bugs corrections

  • Fixed hardware instantiation.
  • Fixed a bug in border panel overlays material management.
  • Fixed an overlays bug, revealed with on Intel GPUs
  • The billboards are now fixed.
  • Fixed PN Triangles subdivider, to use Bezier patches.

Downloads




Version 0.6.5.0

Date : 2011-08-30

Features

  • Tangent space computed for created primitives. You can access it over GLSL with 'attribute/in vec3 tangent'
    Normal mapping on an OBJ model Relief Mapping
  • Added UV map retrieval in cscn text format mesh description.
  • Works now under Linux (Gtk), tested with Debian (Squeeze and Wheezy), Fedora 13 and Mandriva 10

Bugs corrections

  • Crash when closing application - Corrected, caused by ShaderManager

Downloads



Version 0.6.1.2

Date : 2011-03-17

Features

  • Created a renderer selection dialog when lauching CastorViewer and CastorShape, added a splash screen for thos applications.
    Renderer selector Splash screen
  • Added a small application to convert any image file type to XPM to ease the multi OS development with wxWidgets.
  • Added new directives to scene file (alpha_rejection, rgb_blend, alpha_blend, hl_shader_program, ...).
  • Improved CMakeLists and 'cmake_modules' files in order to manage various client configurations in a better way.
  • Revised VertexBuffer and IndexBuffer system, introduced VertexDeclaration and BufferElement so user can create VertexBuffers using what hr want into it from this list : positions, normals, tangents, diffuse colour, texture coordinates (from 0 to 4), and ordered as user wants.
  • Vertex class now extends BufferElement.
  • TextureEnvironment will disappear in next version, multitexturing is now managed directly by Pass and TextureUnit.

Downloads



Version 0.6.1.1

Date : 2011-01-21

Features

  • Created a CMakeLists to generate solution from CMake.
  • Reordered file system to ease the use with CMake
  • Splitted Plugin class in 3 : RenderPlugin, DividerPlugin and ImporterPlugin. Importers and dividers will be created and modified without recompiling all projects.
  • Created a project for each existing importer (OBJ, PLY, MD2, MD3, 3DS, ...)
    PLY Model MD3 Model MD2 Model 3DS Model
  • Created a plugin for LoopDivider but PNTrianglesDivider remains in Castor3D because it is used in Icosahedron generation.
    Loop subdivided torrus
  • Started Cg shaders implementation. It implied a modification of scene files because in Cg and uniform variables are attached to a program (vertex, pixel, geometry) instead of being attached to the whole shader as it is in GLSL.
  • Buffers used for the render (Vertex, attribute, Texture, Normals, ...) are npw created by the RenderSystem so they can be created directly in Castor3D and not only in renderers (GL2, GL3 and future D3D).
  • Suppressed Singletons for the Managers (Image, Font, Material, Animation and Mesh).
  • Remerged the SceneNodes to ease their use.
  • Subdividers can also make their job in a thread and launch a callback at the end of it (cf. CastorShape).
  • Submesh::AddPoint now creates IdPoints and Submesh::AddFace uses it to create the vertices.

Bugs corrections

  • Corrected LoopDivider that didn't move newly created vertices, leaving them unchanged.

Downloads



Version 0.6.1.0

Date : 2010-12-10

Features

  • TransformationMatrix class is no more, it has been resumed to a functions collection working on 4x4 square matrix, regrouped in a namespace : MtxUtils.
  • Modified SceneNode management : a base class (NodeBase) holding all informations from old SceneNode and 3 derived classes (GeometryNode, CameraNode and LightNode) holding render specifics for respective linked objects (Geometry, Camera and Light).
  • MovableObject class now has less functionalities (now just a name and a NodeBase), Light and Camera classes now derive from this one for more uniformity in their moves, compared to geometries.
  • Renamed UniformVariable in FrameVariable to have a better view of what it is and to link this less to OpenGL.

Bugs corrections

  • Corrected a crash when closing the application compiled in release.

Downloads



Version 0.6.0.0

Date : 2010-11-05

Features

  • Added a class to manage matrices, in order to be able to suppress fixed pipeline support in OpenGL
  • Modified render system : added Renderable class which is in charge of creating the associated Renderer in order to ease the creation of this class's derived, such as submesh, scene node, light or camera.
  • Changed scene/material/meshes file extensions (respectively to cscn/cmtl/cmsh)

Bugs corrections

  • Protected shared datas with recursive mutexes (essentially in managers) to avoid random crashes.

Downloads



Version 0.5.0.2

Date : 2010-09-14

Features

  • New primitive : projection which performs a projection of an arc along depth axis and joins origin and projection with faces.
  • Better materials import from MD3 files (conatined in .skin and .shader files).
  • Better material import from 3DS files, especially colours : Ambient, Diffuse, Specular and Shininess

Bugs corrections

  • Corrected normals generation (they were inverted).

Downloads




Image Large