Understanding of unity hdrp bentnormal


1. I learned from surfing the Internet that bentnormal can solve the problems of indirect ambient highlight leakage and indirect diffuse illumination leakage.

The light leakage here refers to the light leakage caused by the occlusion relationship of the model itself is not taken into account in the intermittent lighting part.


2. you can bake the bentnormal map through software such as SD. The software will calculate the visibility of each angle outward according to the cosine angle, and finally get a vector by averaging, which will be brought into the subsequent calculation to calculate the weight.

In addition, bentnormal maps store normalized vectors in the same way as normals.

For details, please refer to the article:https://developer.download.nvidia.cn/books/HTML/gpugems/gpugems_ch17.html 

Note: it is better to set a longer maximum detection distance during baking


3. In the unity implementation part, I took a look at getspecularocclusionfrombentao, which means something like this,

If the weight area is greater than the bendnormal vector, the occlusion will not be calculated. Otherwise, the value of spectralocclusion will be calculated according to the coefficient and returned.



For the test of indirect illumination (taking the illumination probe sh as an example), 2 times of normalmap scaling is enabled to prevent the picture compression from being obvious.

(no bentnormal on the left, bentnormal on the right)


For highlight test, you need to open from bent normal of spectral occlusion.



Test effect:

(no bentnormal on the left, bentnormal on the right)



Finally, I verified whether the following understanding was correct. I rewritten a simple bentnormal in the URP to add weight to the indirect lighting part:

//Globalillumination part added
float bentNormalIntensity = saturate(1.0 - dot(normalWS, bentNormalWS));
float weight = max(dot(bentNormalWS, reflectVector), 0.0);
weight = lerp(1.0, weight, _BentNormalWeight * bentNormalIntensity);
indirectDiffuse *= weight;
indirectSpecular *= weight;
fresnelTerm *= weight;


Then the previously baked bentnormal map is given, and the results are as follows:

(no bentnormal on the left, bentnormal on the right)

Recommended Today

Introduction to js decorator (introduction to ts decorator)

reference js decorator @Decorator Decorator – Ruan Yifeng TS Decorator(2): Metadata TS Documentation – Decorators hint TypeScript has fully implemented the decorator, and the js decorator is a syntax that is still in the proposal. If you use js instead of ts, you need to configure Babel to use it. The prerequisite knowledge you need […]