Correct Displacement and Normal baking
Open, NormalPublic

Description

This patch fixes incorrect selected-to-active Displacement and Normal bake behaviour by introducing the concept of a "flat" bake. Instead of firing a ray up and a ray down from the surface and selecting the closest hit, a single ray is fired down over twice the distance. Other bake modes are unchanged.

This prevents confusing output images where surfaces above the rendering plane could be obscured by surfaces below it. It also prevents the undersides of objects from appearing. See the attached demo image for examples of both bugs.

This patch also eliminates z-fighting bugs by adding epsilon values to the start and end of the ray in all bake modes. Previously users had to do this by hand.

The longer rays exacerbate existing float precision issues with meshes (see [#18989]). To help combat this the Bias setting can now be a negative value.

The Distance property can no longer be 0, and now defaults to 5 units.

Details

Type
Patch

Forgot something: since there's always a Distance field now, displacement maps are always normalised with that value.

hmm this is a very important fix in my opinion , a lot of people ask for a cage system for texture baking but if this solves the issue then this is fine too... plus a distance indicator for the 3d view is needed while playing with bake distance and bias; like the camera mist start/end indicator... maybe show face normals can be used for feedback for distance...

There is now a bias option for displacement baking, does this resolve the same issue?