How do game engines like UE4, Unity, Source, Cry Engine, etc add different rendering library's to their game engines? (Eg. OpenGL, DirectX, Vulkan)


2 Answers 2


Most game engines will have a layer between their rendering abstraction and the actual rendering API. In Unreal and Qt this is called the Rendering Hardware Interface, or RHI. I'm not sure if the others use the same terminology.

Typically the rendering engine will make high level calls to the rendering abstractions, and it will be the job of the various RHI implementations for different rendering APIs to translate those into actual rendering calls.

Supporting the various APIs isn't actually all that complicated since they all tend to do roughly the same things, just with different names. Probably the biggest engineering challenge is that each one of them uses a different shader language. Since game engines want to allow developers to customize the shading, they have to provide some common shading language or customization system that can then be translated into each of the languages and dialects needed by the different rendering APIs. This is far harder than just mapping a rendering abstraction to OpenGL, Vulkan, Metal and Direct3D.


I think there are another two options: Angle, https://github.com/google/angle, or Dawn, https://dawn.googlesource.com/dawn.

If your game is written by OpenGL, Angle can help you translate it into several backends, such as Vulkan, D3D.

And if you are designing a game from the beginning, you may try writing it by Dawn. Dawn is similar to a middle layer, if your game is based on dawn, it can make sure your game runs smoothly on the different backends.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .