Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
25ab0d77
Commit
25ab0d77
authored
2 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
fix outline artefact with opaque behind transparent
parent
ea313a44
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
src/mol-gl/shader/outlines.frag.ts
+5
-3
5 additions, 3 deletions
src/mol-gl/shader/outlines.frag.ts
src/mol-gl/shader/postprocessing.frag.ts
+5
-2
5 additions, 2 deletions
src/mol-gl/shader/postprocessing.frag.ts
with
11 additions
and
5 deletions
CHANGELOG.md
+
1
−
0
View file @
25ab0d77
...
...
@@ -7,6 +7,7 @@ Note that since we don't clearly distinguish between a public and private interf
## [Unreleased]
-
Remove pca transform from components ui focus (too distracting)
-
Fix artefacts with opaque outlines behind transparent objects
## [v3.31.1] - 2023-02-05
...
...
This diff is collapsed.
Click to expand it.
src/mol-gl/shader/outlines.frag.ts
+
5
−
3
View file @
25ab0d77
/**
* Copyright (c) 2019-202
2
mol* contributors, licensed under MIT, See LICENSE file for more info.
* Copyright (c) 2019-202
3
mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Áron Samuel Kovács <aron.kovacs@mail.muni.cz>
@author Alexander Rose <alexander.rose@weirdbyte.de>
*
@author Alexander Rose <alexander.rose@weirdbyte.de>
*/
export
const
outlines_frag
=
`
...
...
@@ -63,6 +63,7 @@ void main(void) {
float outline = 1.0;
float bestDepth = 1.0;
float transparentFlag = 0.0;
for (int y = -1; y <= 1; y++) {
for (int x = -1; x <= 1; x++) {
...
...
@@ -82,11 +83,12 @@ void main(void) {
if (abs(selfViewZTransparent - sampleViewZTransparent) > uMaxPossibleViewZDiff && selfDepthTransparent > sampleDepthTransparent && sampleDepthTransparent <= bestDepth) {
outline = 0.0;
bestDepth = sampleDepthTransparent;
transparentFlag = 1.0;
}
}
}
}
gl_FragColor = vec4(outline, packUnitIntervalToRG(bestDepth),
0.0
);
gl_FragColor = vec4(outline, packUnitIntervalToRG(bestDepth),
transparentFlag
);
}
`
;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/mol-gl/shader/postprocessing.frag.ts
+
5
−
2
View file @
25ab0d77
...
...
@@ -74,8 +74,10 @@ float getOutline(const in vec2 coords, const in float opaqueDepth, out float clo
float backgroundViewZ = uFar + 3.0 * uMaxPossibleViewZDiff;
vec2 invTexSize = 1.0 / uTexSize;
float selfDepth = min(opaqueDepth, getDepthTransparent(coords));
float selfViewZ = isBackground(selfDepth) ? backgroundViewZ : getViewZ(selfDepth);
float transparentDepth = getDepthTransparent(coords);
float opaqueSelfViewZ = isBackground(opaqueDepth) ? backgroundViewZ : getViewZ(opaqueDepth);
float transparentSelfViewZ = isBackground(transparentDepth) ? backgroundViewZ : getViewZ(transparentDepth);
float selfDepth = min(opaqueDepth, transparentDepth);
float pixelSize = getPixelSize(coords, selfDepth);
float outline = 1.0;
...
...
@@ -93,6 +95,7 @@ float getOutline(const in vec2 coords, const in float opaqueDepth, out float clo
float sampleOutlineDepth = unpackRGToUnitInterval(sampleOutlineCombined.gb);
float sampleOutlineViewZ = isBackground(sampleOutlineDepth) ? backgroundViewZ : getViewZ(sampleOutlineDepth);
float selfViewZ = sampleOutlineCombined.a == 0.0 ? opaqueSelfViewZ : transparentSelfViewZ;
if (sampleOutline == 0.0 && sampleOutlineDepth < closestTexel && abs(selfViewZ - sampleOutlineViewZ) > uMaxPossibleViewZDiff + (pixelSize * outlineDistanceFactor)) {
outline = 0.0;
closestTexel = sampleOutlineDepth;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment