Friday, March 21, 2014

[UE4] Manual Distance Based Tessellation

When using a material with tessellation in unreal engine 4, adaptive tessellation is enabled by default. Whilst this screen-space algorithm is doing a solid job there are situations where you might want to manually set the tessellation factor directly or make it de/increase in intervals rather than constantly changing. 

To make the following materials work you'll need to uncheck 'Enable Adaptive Tessellation' in the material properties.

This is the most simple setup, using 3 parameters - 2 tessellation factors (one for when far away and one for close up) plus the distance in world space.

For a smooth transition between both states divide the distance by an additional parameter, this one is also in world space units:

For a more subtle transition you can scale the amount of displacement by distance as well. Therefore calculate the inverse of the lerp alpha input and multiply that by your World Displacement input.

In case you need more than 2 states of tessellation you can simply add an additional Lerp.

No comments:

Post a Comment