Skip to content
Snippets Groups Projects
Commit 4fa135da authored by Alexander Rose's avatar Alexander Rose
Browse files

fix near clipping avoidance in impostor shaders

parent 9870cb40
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@ Note that since we don't clearly distinguish between a public and private interf
Fix impostor bond visuals not correctly updating on `sizeFactor` changes
Fix degenerate case in PCA
Fix near clipping avoidance in impostor shaders
## [v3.31.2] - 2023-02-12
......
/**
* Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
* Copyright (c) 2020-2023 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
......@@ -71,8 +71,10 @@ void main() {
vViewPosition = mvPosition.xyz;
gl_Position = uProjection * mvPosition;
mvPosition.z -= 2.0 * (length(vEnd - vStart) + vSize); // avoid clipping
gl_Position.z = (uProjection * mvPosition).z;
if (gl_Position.z < -gl_Position.w) {
mvPosition.z -= 2.0 * (length(vEnd - vStart) + vSize); // avoid clipping
gl_Position.z = (uProjection * mvPosition).z;
}
#include clip_instance
}
......
/**
* Copyright (c) 2019-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
* Copyright (c) 2019-2023 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
......@@ -96,8 +96,10 @@ void main(void){
vModelPosition = (uModel * aTransform * position4).xyz; // for clipping in frag shader
mvPosition.z -= 2.0 * vRadius; // avoid clipping
gl_Position.z = (uProjection * vec4(mvPosition.xyz, 1.0)).z;
if (gl_Position.z < -gl_Position.w) {
mvPosition.z -= 2.0 * vRadius; // avoid clipping
gl_Position.z = (uProjection * vec4(mvPosition.xyz, 1.0)).z;
}
#include clip_instance
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment