Posted on

Pixel perfect object movement

A standard feature of all 3D scene editors are object transform manipulation tools, i.e. translate, rotate and scale. Whilst there are articles that describe the behavior I couldn’t find a specific article on the implementation details so thought I’d write up the algorithm I use. Continue reading Pixel perfect object movement

Posted on

Compiling C/C++ libraries for Android (updated)

There are a few forms a C/C++ library that you want to cross compile to Android might come in.

For instance:

  • An Autotools project
  • A CMake project

To get started let’s make a standalone Android toolchain (a toolchain being compilers, libraries and headers for cross compiling our source code to a specific target architecture and platform ABI) . Continue reading Compiling C/C++ libraries for Android (updated)

Posted on

Running on Mac

A quick clip showing the side project running on Mac courtesy of CMake’s Xcode generator (Unix makefiles and Qt Creator are also an option however IMHO XCode is the better IDE on Mac). Of course life is never as simple as simply generating the project, there’s building of dependencies and on Mac (and Linux) dealing with rpath related issues. These tasks are now mostly resolved with just the packaging to tidy up.

Posted on

Automate building of dependent libs with rpath handling

Automating the building of 3rd party libraries involves fetching the source, extracting, optionally applying a patch, building and installing. On Mac and Linux you also have to take care of rpaths ensuring the rpath embedded in your target libs (and pulled in by referencing executables) are as you intend. It’s such a common task that I’ve a script that does this for me and decided to share it here in case someone else finds it useful for their projects (assuming the library being downloaded uses CMake). This task can also be performed now entirely within CMake using the ExternalProject command, the subject of a future post. Continue reading Automate building of dependent libs with rpath handling

Posted on

Occlusion culling

Occlusion culling complements frustum culling by culling occluded objects. Frustum culling is an optimisation technique that discards meshes that sit outside of the viewing volume by testing each mesh against the six frustum planes. The culling can be accelerated with hierarchical spatial partitioning whereby the scene is carved up into a tree with each tree node representing a smaller region of space. A node contains all render-able objects enclosed in the node’s space allowing fast inclusion / rejection of the node objects. If, a node is found to intersect the viewing volume then the algorithm recurses down into the node’s child nodes etc.

That’s great however more can still be done. Continue reading Occlusion culling

Posted on

Post-processing shaders

Added post-processing shader support to the engine. Post-processing shaders can be used to apply full screen effects to scenes. Examples of such shaders include full-screen anti-aliasing, vignette effects and motion blur to name but a few. With a post processing shader the scene is typically rendered to a texture that is bound to an off screen frame buffer with appropriate depth and color attachments. The texture is then applied to a full screen quad and rendered to screen. This short clip demonstrates the post processing shader.

Posted on

Pluggable Components and Systems

The entity, component system architecture enables the easy addition of components (behaviours) and systems (allocate and update components of a specific type in a cache friendly manner). Components can be attached to scene items to create more advanced scene elements and interactions. The engine supports the pluggable addition of systems and components. Systems and components can be defined within a shared library (aka “plugin”) which are then exported for loading into the engine and editor. The editor displays all loaded systems in the Systems tab and all loaded components can be attached to scene elements via the editor’s components panel. As with scene items the editor also reflects on system and component properties so they can be configured either manually (in the editor) or programmatically through script. Like scene elements, both system and component properties are serialised into the scene in a versionable format. Below is a short clip demonstrating the Physics plugin’s Physics System and the RigidBodyObjectComponent exported by the plugin.

Posted on

Unit Testing

CMake supports test automation and optional uploading of test results to a dash board. CTest tests are added using the CTest add_test() macro. Enabling testing results in a RUN_TESTS project (in Visual Studio) being generated (or a tests target on Linux). The clip below shows this in action in the engine project. CTest generates a summary of the status, timing and result of each test. The next step is to use Jenkins to automate the checking-out, building and testing of the code when a commit is pushed to the git repo.