Open hhhhkrx opened 2 months ago
https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_sheen
https://github.com/mrdoob/three.js/blob/3f2956c35e1bd1fc8cbe35f1430e475fd848e6a2/src/nodes/functions/BSDF/BRDF_Sheen.js#L3
技术细节 直接光部分: https://github.com/BabylonJS/Babylon.js/blob/7fd025d4fbb4ea0b6f4f108788cd312a613b38d8/packages/dev/core/src/Shaders/ShadersInclude/pbrDirectLightingFunctions.fx#L160 间接光部分: https://github.com/BabylonJS/Babylon.js/blob/7fd025d4fbb4ea0b6f4f108788cd312a613b38d8/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockSheen.fx#L42
https://github.com/google/filament/blob/06f9626429bca811f459bc9286059fa710689dfc/shaders/src/shading_model_standard.fs#L5 技术细节
float distributionCloth(float roughness, float NoH) { #if BRDF_CLOTH_D == SPECULAR_D_CHARLIE return D_Charlie(roughness, NoH); #endif } float visibilityCloth(float NoV, float NoL) { #if BRDF_CLOTH_V == SPECULAR_V_NEUBELT return V_Neubelt(NoV, NoL); #endif } #if defined(MATERIAL_HAS_SHEEN_COLOR) vec3 sheenLobe(const PixelParams pixel, float NoV, float NoL, float NoH) { float D = distributionCloth(pixel.sheenRoughness, NoH); float V = visibilityCloth(NoV, NoL); return (D * V) * pixel.sheenColor; } #endif
sheen由于没什么特别难的算法,所以三个引擎都使用了基本相同的brdf算法,只是一些api调用不太一样
按照sheen标准brdf算法内置到引擎,uniform一一对应GLTF2.0标准。
Sheen 只需要注意一下间接光部分使用曲线拟合方法,引擎没有 LUT 贴图。另外可以参考/关闭这个陈年老PR: #692
GLTF
https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_sheen
three.js
https://github.com/mrdoob/three.js/blob/3f2956c35e1bd1fc8cbe35f1430e475fd848e6a2/src/nodes/functions/BSDF/BRDF_Sheen.js#L3
babylon
技术细节 直接光部分: https://github.com/BabylonJS/Babylon.js/blob/7fd025d4fbb4ea0b6f4f108788cd312a613b38d8/packages/dev/core/src/Shaders/ShadersInclude/pbrDirectLightingFunctions.fx#L160 间接光部分: https://github.com/BabylonJS/Babylon.js/blob/7fd025d4fbb4ea0b6f4f108788cd312a613b38d8/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockSheen.fx#L42
filament
https://github.com/google/filament/blob/06f9626429bca811f459bc9286059fa710689dfc/shaders/src/shading_model_standard.fs#L5 技术细节
技术对比
sheen由于没什么特别难的算法,所以三个引擎都使用了基本相同的brdf算法,只是一些api调用不太一样
方案
按照sheen标准brdf算法内置到引擎,uniform一一对应GLTF2.0标准。