Skip to content

Commit e9f9ea9

Browse files
committed
feat(cloud-picture): fix get_hit_shading_data.glsl->alpha cut
solution now if alpha mode is MASK(gltf), handle alpha cut;
1 parent 1392e0c commit e9f9ea9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/run/domain_layer/domain/shader/ray_tracing/get_hit_shading_data.glsl

+8-1
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ bool _isUseAlphaAsCoverageInsteadOfTransmission(float alphaCutoff) {
153153
return alphaCutoff > 0.0;
154154
}
155155

156+
bool _isHandleAlphaCutoff(float alphaCutoff) { return alphaCutoff != 1.0; }
157+
156158
float _computeUVFieldByWrap(float wrap, float uvField) {
157159
switch (int(wrap)) {
158160
// ClampToEdge
@@ -340,7 +342,12 @@ HitShadingData getHitShadingData(uint instanceIndex, uint primitiveIndex) {
340342
}
341343

342344
if (_isUseAlphaAsCoverageInsteadOfTransmission(alphaCutoff)) {
343-
data.materialTransmission = alpha >= alphaCutoff ? 0.0 : 1.0 - alpha;
345+
if (_isHandleAlphaCutoff(alphaCutoff)) {
346+
data.materialTransmission = alpha >= alphaCutoff ? 0.0 : 1.0;
347+
} else {
348+
data.materialTransmission = 1.0 - alpha;
349+
}
350+
344351
data.materialIOR = 1.0;
345352
} else {
346353
if (_hasMap(transmissionMapLayerIndex)) {

0 commit comments

Comments
 (0)