Skip to content

Saggre/raymarch-engine

Repository files navigation

Raymarch Engine (WIP)

A game engine that renders primitive objects by utilizing raymarching. Different operations can be applied to the primitives to create more complex objects. The engine uses SharpDX as its DirectX wrapper and System.Numerics.Vectors for Vectors, Quaternions and Matrices.

Raymarch shader code is located here.

Live rendering preview

Things to look for:

  • The preview has four different primitives (octahedron, box, sphere, plane). And one light source.
  • All objects cast and receive shadows. These are fully dynamic.
  • Octahedron, sphere and plane have reflections.
  • All objects have Blinn–Phong shading as a base.
  • The octahedron has subsurface scattering. light penetrates its thin edges, making them appear lighter.
  • The box has rounded corners as a result of a rounding operation being applied to it.
  • There is ambient occlusion and blue noise applied to the view space.
  • Some purple-ish distance fog is visible in the background.
  • Raymarched objects have infinite resolution (signed distance function = no mesh).

Rendering preview

Requirements:

  • .NET Framework 4.8
  • C# 7.3+
  • DirectX 11
  • Shader Model 5 support
  • A capable GPU

Supported primitives:

  • Sphere
  • Box
  • Plane
  • Torus
  • Capped torus
  • Ellipsoid
  • Capsule
  • Hex prism
  • Cone
  • Cylinder
  • Pyramid
  • Octahedron
  • Rhombus

Supported operations:

  • Rounding
  • Infinite repetition
  • Union
  • Subtraction
  • Intersection
  • Onion slicing

Current features and future work:

  • ✔️ Basic gameobjects
  • ✔️ Basic shading (Blinn–Phong)
  • ✔️ Ambient occlusion
  • ✔️ Subsurface scattering
  • ✔️ Blue noise
  • ✔️ Reflections
  • ✔️ Soft shadows
  • ➖ All primitives
  • ❌ Dynamic sky
  • ❌ Custom resolutions
  • ❌ Color blending between shapes
  • ❌ Fractals
  • ❌ Physics
  • ❌ Custom shader code editor
  • ❌ Checkerboard rendering
  • ❌ Pre-compiled shaders
  • ❌ OpenGL support
  • ❌ Hyperbolic and spherical spaces