Legacy Documentation: Version 5.2
Level of Detail
Compute Shaders

Using DirectX 11 in Unity

Unity has ability to use DirectX 11 graphics API, with all the goodies that you expect from it: compute shaders, tessellation shaders, shader model 5.0 and so on.

Enabling DirectX 11

To enable DirectX 11 for your game builds and the editor, set “Use DX11” option in Player Settings. This option is on by default (i.e. on Windows, your games and editor will try to use DX11, and fallback to DX9 when not available).

Note that DX11 requires Windows Vista or later and at least a DX10-level GPU (preferably DX11-level). Unity editor window title has “<DX11>” at the end when it is actually running in DX11 mode.

Image Effects that can take advantage of DX11

Compute Shaders

Compute shaders allow using GPU as a massively parallel processor. See Compute Shaders page for mode details.

Tessellation & Geometry Shaders

Surface shaders have support for simple tessellation & displacement, see Surface Shader Tessellation page.

When manually writing shader programs, you can use full set of DX11 shader model 5.0 features, including geometry, hull & domain shaders.

Surface shaders and DX11

Currently some parts of surface shader compilation pipeline do not understand DX11-specific HLSL syntax, so if you’re HLSL features like StructuredBuffers, RWTextures and other non-DX9 syntax, you have to wrap it into a DX11-only preprocessor macro. See Platform Specific Differences page for details.

DirectX 11 Examples

The following screenshots show examples of what becomes possible with DirectX 11.

The volumetric explosion in these shots is rendered using raymarching which becomes plausible with shader model 5.0. Moreover, as it generates and updates depth values, it becomes fully compatible with depth based image effects such as depth of field or motion blur.
The volumetric explosion in these shots is rendered using raymarching which becomes plausible with shader model 5.0. Moreover, as it generates and updates depth values, it becomes fully compatible with depth based image effects such as depth of field or motion blur.
The hair in this shot is implemented via DirectX 11 tessellation & geometry shaders to dynamically generate and animate individual strings of hair. Shading is based on a model proposed by Kajiya-Kai that enables a more believable diffuse and specular behaviour.
The hair in this shot is implemented via DirectX 11 tessellation & geometry shaders to dynamically generate and animate individual strings of hair. Shading is based on a model proposed by Kajiya-Kai that enables a more believable diffuse and specular behaviour.
Similar to the hair technique above, the shown slippers fur is also based on generating geometry emitted from a simple base slippers mesh.
Similar to the hair technique above, the shown slippers fur is also based on generating geometry emitted from a simple base slippers mesh.
The blur effect in this image (known as <span class="doc-prop">Bokeh</span>) is based on splatting a texture on top of very bright pixels. This can create very believable camera lens blurs, especially when used in conjunction with HDR rendering.
The blur effect in this image (known as Bokeh) is based on splatting a texture on top of very bright pixels. This can create very believable camera lens blurs, especially when used in conjunction with HDR rendering.
Exaggerated lens blur similar to the screenshot above. This is a possible result using the new Depth of Field effect
Exaggerated lens blur similar to the screenshot above. This is a possible result using the new Depth of Field effect
Level of Detail
Compute Shaders
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961