Your environment fades away.
Radar is a tech preview schowcasing the implementation of custom shaders, particles, skinning & animations, Nvidia PhysX, DirectX into a custom game engine written in c++. The main feature is the unfold shader.
- Type: Tech preview.
- Team: Solo
- Engine: Overlord Engine (provided by DAE) customised.
- Main Language: c++ (with DirectX and PhysX APIs) and HLSL
- Platform: Windows.
This tech preview basically shows the capabilities of the unfold shader. So most challenges are related to writing this shader and implementing it through DirectX.
The shaders basically unfolds geometry while you move through the level. A centre point, an inner and outer radius can be provided. All faces within the inner radius will be shown normally and all faces between the inner and outer radius will be rotated relatively to their distance between those two radii. Everything else outside the outer radius is hidden.
A basic explanation of the unfold shader is given below. For more information and a more thorough explanation on the unfold shader, there is in a paper available. Download a pdf-version.
The first challenge in creating this shader was rotating triangles over their closest edge to the centre point. So the first algorithm checked for each combination of vertices of the triangle, which distance from the centre point and the middle of the edge is smallest. This distance was then compared to the inner and outer radius to decide if the triangle should be shown, and if it should rotate and at what angle to rotate.
In order to achieve a better effect I wanted to rotate quads instead of only triangles. This does required a lot of change to the shader as the input for the geometry shader had to change from single triangles to triangles with their adjacent triangles as well. With this kind of input it's possible to use an algorithm which goes over each adjacent triangle and checks if it could form a quad with the original triangle. However when a quad is recognised it would show double, as the geometry shader goes over each triangle of the quad separately. So certain quads have to be trimmed out, this was achieved by trimming those triangles for which the closest edge is not the edge over which the quad will rotate.