# How to set DefaultGraphicsRHI

**URL:** <https://forums.unrealengine.com/t/how-to-set-defaultgraphicsrhi/569747>\
**Category:** Rendering\
**Tags:** Ray-Tracing, unreal-engine, Rendering, UE4-27, question\
**Created:** [May 30, 2022, 7:56am UTC](https://forums.unrealengine.com/t/how-to-set-defaultgraphicsrhi/569747 "2022-05-30T07:56:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![grimm\_zz1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@grimm\_zz1](https://forums.unrealengine.com/u/grimm_zz1)\
**Post date:** [May 30, 2022, 7:56am UTC](https://forums.unrealengine.com/t/how-to-set-defaultgraphicsrhi/569747/1 "2022-05-30T07:56:04Z")

</div>

I’m working on raytracing setting with DirectX Edition. It seems that After I set Project Setting → Platforms - Windows → Target RHIs → “DirectX 11&12(SM5) = Yes” and “Default RHI = Default”, it will launch with DX11 as Default always. So I want know if there is a way to launch DX12 as Default if the device environment support? and run DX11 as Default if not support?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/7/6/1763244f67abc7577b314d428ea2e4725efbbab9.png)

---

<div class="post-metadata">

**Author:** ![grimm\_zz1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@grimm\_zz1](https://forums.unrealengine.com/u/grimm_zz1)\
**Post date:** [May 31, 2022, 3:51am UTC](https://forums.unrealengine.com/t/how-to-set-defaultgraphicsrhi/569747/3 "2022-05-31T03:51:28Z")

</div>

Is there someone know better UE4 raytracing strategy? For now I could only enable DX11 for the first time and let player select to enable DX12 then restart game to enable raytracing, that is a little inconvenient.

---

<div class="post-metadata">

**Author:** ![grimm\_zz1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@grimm\_zz1](https://forums.unrealengine.com/u/grimm_zz1)\
**Post date:** [June 8, 2022, 3:10pm UTC](https://forums.unrealengine.com/t/how-to-set-defaultgraphicsrhi/569747/4 "2022-06-08T15:10:56Z")

</div>

Finally I fixed it out. I read source code in DynamicRHI.cpp, found that there is a “bPreferD3D12” to check if D3D12 was supported and then would be loaded else D3D11 would be loaded. So I just need add content"[D3DRHIPreference] bUseD3D12InGame=True" in “GGameUserSettingsIni” file (YourProjectDir/Config/DefaultGameUserSettings.ini), and keep RHI setting as same as my first image. Attention, that only works when you launch game in package or standalone mode.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/e/c/7ec696b5e53f8a2f9a3ea218975e39d5f2470caf.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/2/3/d23458a80838f0da47d072371b94a359e1f941f0.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/f/2/df244716fd1a3f4db8e60abd4e071626d2ca8290.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/8/1/981ab7b329b2c8c5df95713831f0e8f64a8a5640.png)
