Skip to content

Commit

Permalink
feat(cloud-picture): fix get_hit_shading_data.glsl->alpha cut
Browse files Browse the repository at this point in the history
solution
now if alpha mode is MASK(gltf), handle alpha cut;
  • Loading branch information
yyc-git committed Nov 15, 2020
1 parent 1392e0c commit e9f9ea9
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ bool _isUseAlphaAsCoverageInsteadOfTransmission(float alphaCutoff) {
return alphaCutoff > 0.0;
}

bool _isHandleAlphaCutoff(float alphaCutoff) { return alphaCutoff != 1.0; }

float _computeUVFieldByWrap(float wrap, float uvField) {
switch (int(wrap)) {
// ClampToEdge
Expand Down Expand Up @@ -340,7 +342,12 @@ HitShadingData getHitShadingData(uint instanceIndex, uint primitiveIndex) {
}

if (_isUseAlphaAsCoverageInsteadOfTransmission(alphaCutoff)) {
data.materialTransmission = alpha >= alphaCutoff ? 0.0 : 1.0 - alpha;
if (_isHandleAlphaCutoff(alphaCutoff)) {
data.materialTransmission = alpha >= alphaCutoff ? 0.0 : 1.0;
} else {
data.materialTransmission = 1.0 - alpha;
}

data.materialIOR = 1.0;
} else {
if (_hasMap(transmissionMapLayerIndex)) {
Expand Down

0 comments on commit e9f9ea9

Please sign in to comment.