Просмотр исходного кода

WebGPURenderer: Honor `polygonOffset` with WebGPU backend. (#30496)

Michael Herzog 11 месяцев назад
Родитель
Сommit
2061c3e186
1 измененных файлов с 8 добавлено и 0 удалено
  1. 8 0
      src/renderers/webgpu/utils/WebGPUPipelineUtils.js

+ 8 - 0
src/renderers/webgpu/utils/WebGPUPipelineUtils.js

@@ -188,6 +188,14 @@ class WebGPUPipelineUtils {
 
 			}
 
+			if ( material.polygonOffset === true ) {
+
+				depthStencil.depthBias = material.polygonOffsetUnits;
+				depthStencil.depthBiasSlopeScale = material.polygonOffsetFactor;
+				depthStencil.depthBiasClamp = 0; // three.js does not provide an API to configure this value
+
+			}
+
 			pipelineDescriptor.depthStencil = depthStencil;
 
 		}

粤ICP备19079148号