Legacy Documentation: Version 4.6.2
Language: English
Level of Detail (Pro Only)
Compute Shaders

Using DirectX 11 in Unity 4

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Unity 4 introduces 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. Unity editor needs to be restarted for this to take effect.

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 (Pro Only)
Compute Shaders