Commit d0726be9 authored by langurmonkey's avatar langurmonkey

Merge branch 'master' into vr

parents c0274c7f 82fa7667
Pipeline #77996521 passed with stage
in 2 minutes and 40 seconds
......@@ -16,7 +16,7 @@
- scripting parameter check
- cameraTransition()
- more glsl leftovers
- shader errors on macOS [#288](https://gitlab.com/langurmonkey/gaiasky/issues/288) [#288](https://gitlab.com/langurmonkey/gaiasky/issues/288)
- shader errors on macOS [#288](https://gitlab.com/langurmonkey/gaiasky/issues/288)
- show notice with high/ultra quality
- tangent and binormal vectors on UV spheres
- ui inconsistencies
......
......@@ -48,6 +48,8 @@ This file contains the following sections:
### 1.1 Requirements
| | |
|-|-|
| **Operating system** | Linux / Windows 7+ / macOS, 64-bit |
| **CPU** | Intel Core i5 3rd Generation or similar |
| **GPU** | Intel HD 4000, Nvidia GeForce 9800 GT, Radeon HD 5670 / 1 GB VRAM / OpenGL 4.x |
......
......@@ -18,14 +18,14 @@ gs.stopSimulationTime()
gs.setCameraFocusInstantAndGo("Earth")
gs.print("We will now add lines between Earth-Moon, Earth-Sol, Earth-Mercury and Arcturus-Achernar")
gs.print("We will now add lines between Earth-Moon, Earth-Sun, Earth-Mercury and Arcturus-Achernar")
gs.print("You will have 30 seconds to observe and explore the system before we remove the lines and end the script")
gs.sleep(2)
earthp = gs.getObjectPosition("Earth")
moonp = gs.getObjectPosition("Moon")
solp = gs.getObjectPosition("Sol")
solp = gs.getObjectPosition("Sun")
mercuryp = gs.getObjectPosition("Mercury")
arcturusp = gs.getObjectPosition("Arcturus")
achernarp = gs.getObjectPosition("Achernar")
......
......@@ -14,7 +14,7 @@ gs.setRotationCameraSpeed(80)
gs.setTurningCameraSpeed(100)
gs.setCameraSpeed(30)
gs.setCameraFocus("Sol")
gs.setCameraFocus("Sun")
au_to_km = 149597900.0
text_x = 0.2
......
......@@ -22,7 +22,7 @@ gs.setVisibility("element.labels", False)
eclpos = gs.eclipticToInternalCartesian(0.0, 90.0, 7.5e8)
gs.setCameraPosition(eclpos)
gs.setCameraFocus("Sol", -1)
gs.setCameraFocus("Sun", -1)
# Set free camera
......
......@@ -6,7 +6,7 @@ from py4j.java_gateway import JavaGateway, GatewayParameters
gateway = JavaGateway(gateway_parameters=GatewayParameters(auto_convert=True))
gs = gateway.entry_point
gs.setCameraFocus("Sol")
gs.setCameraFocus("Sun")
gs.sleep(3)
gs.setCinematicCamera(True)
......
......@@ -2,6 +2,8 @@
#define exposure 0.65
#include shader/lib_logdepthbuff.glsl
uniform vec3 v3LightPos;
uniform float g;
uniform float g2;
......@@ -11,12 +13,11 @@ in vec3 v_direction;
// Calculated colors
in vec4 v_frontColor;
in vec3 v_frontSecondaryColor;
// Depth buffer value
in float v_depth;
// Height normalized
in float v_heightNormalized;
// Fade factor between hieght-driven opacity and luminosity-driven opacity
in float v_fadeFactor;
in vec3 v_fragPosView;
out vec4 fragColor;
......@@ -38,5 +39,5 @@ void main(void) {
fragColor.a = (v_heightNormalized * (1.0 - v_fadeFactor) + lma * v_fadeFactor) * scl;
fragColor.rgb = fragColor.rgb * 0.95;
gl_FragDepth = v_depth;
gl_FragDepth = getDepthValue(length(v_fragPosView));
}
#version 330 core
#include shader/lib_logdepthbuff.glsl
uniform mat4 u_projViewTrans;
uniform mat4 u_worldTrans;
in vec3 a_position;
out float v_depth;
out vec3 v_fragPosView;
#include shader/lib_atmscattering.glsl
......@@ -50,7 +50,5 @@ void main(void) {
#endif // gravitationalWaves
gl_Position = u_projViewTrans * pos;
// Logarithmic depth buffer
v_depth = getDepthValue(length(pos.xyz));
v_fragPosView = gl_Position.xyz;
}
......@@ -63,10 +63,12 @@ vec4 fetchCloudColor(vec2 texCoord, vec4 defaultValue) {
in vec3 v_lightDir;
in vec3 v_lightCol;
in vec3 v_viewDir;
in vec3 v_fragPosView;
in float v_depth;
out vec4 fragColor;
#include shader/lib_logdepthbuff.glsl
void main() {
vec2 g_texCoord0 = v_texCoord0;
......@@ -84,5 +86,5 @@ void main() {
fragColor = clamp(fragColor, 0.0, 1.0);
gl_FragDepth = v_depth;
gl_FragDepth = getDepthValue(length(v_fragPosView));
}
\ No newline at end of file
#version 330 core
#include shader/lib_logdepthbuff.glsl
#define nop() {}
////////////////////////////////////////////////////////////////////////////////////
......@@ -268,9 +266,7 @@ uniform DirectionalLight u_dirLights[numDirectionalLights];
out vec3 v_lightDir;
out vec3 v_lightCol;
out vec3 v_viewDir;
// Depth buffer value
out float v_depth;
out vec3 v_fragPosView;
void main() {
v_opacity = u_opacity;
......@@ -293,9 +289,7 @@ void main() {
#endif // gravitationalWaves
gl_Position = u_projViewTrans * pos;
// Logarithmic depth buffer
v_depth = getDepthValue(length(pos.xyz));
v_fragPosView = gl_Position.xyz;
#ifdef shadowMapFlag
vec4 spos = u_shadowMapProjViewTrans * pos;
......
......@@ -94,7 +94,10 @@ uniform vec4 u_fogColor;
in float v_fog;
#endif // fogFlag
in float v_depth;
#include shader/lib_logdepthbuff.glsl
in vec3 v_fragPosView;
out vec4 fragColor;
......@@ -183,6 +186,6 @@ void main() {
// Prevent saturation
fragColor = clamp(fragColor, 0.0, 1.0);
gl_FragDepth = v_depth;
gl_FragDepth = getDepthValue(length(v_fragPosView));
}
\ No newline at end of file
......@@ -40,7 +40,10 @@ in vec3 v_ambientLight;
#endif //lightingFlag
in float v_depth;
#include shader/lib_logdepthbuff.glsl
in vec3 v_fragPosView;
out vec4 fragColor;
......@@ -76,5 +79,5 @@ void main() {
// Prevent saturation
fragColor = clamp(fragColor, 0.0, 1.0);
gl_FragDepth = v_depth;
gl_FragDepth = getDepthValue(length(v_fragPosView));
}
\ No newline at end of file
......@@ -105,7 +105,10 @@ in float v_fog;
#define fetchColorNight(texCoord) vec4(0.0, 0.0, 0.0, 0.0)
#endif // nightTextureFlag
in float v_depth;
#include shader/lib_logdepthbuff.glsl
in vec3 v_fragPosView;
out vec4 fragColor;
void main() {
......@@ -192,5 +195,5 @@ void main() {
// Prevent saturation
fragColor.rgb = clamp(fragColor.rgb, 0.0, 0.98);
gl_FragDepth = v_depth;
gl_FragDepth = getDepthValue(length(v_fragPosView));
}
\ No newline at end of file
......@@ -141,8 +141,7 @@ out vec3 v_ambientLight;
//////////////////////////////////////////////
// LOGARITHMIC DEPTH BUFFER
//////////////////////////////////////////////
#include shader/lib_logdepthbuff.glsl
out float v_depth;
out vec3 v_fragPosView;
void main() {
......@@ -175,9 +174,7 @@ void main() {
gl_Position = u_projViewTrans * pos;
// Logarithmic depth buffer
v_depth = getDepthValue(length(pos.xyz));
v_fragPosView = gl_Position.xyz;
#ifdef shadowMapFlag
vec4 spos = u_shadowMapProjViewTrans * pos;
......
#version 330 core
#include shader/lib_dither8x8.glsl
#include shader/lib_logdepthbuff.glsl
////////////////////////////////////////////////////////////////////////////////////
////////// POSITION ATTRIBUTE - FRAGMENT
......@@ -11,13 +12,10 @@ uniform vec4 u_diffuseColor;
in vec4 v_position;
#define pullPosition() { return v_position;}
// Varyings computed in the vertex shader
in float v_opacity;
in vec3 v_viewDir;
in vec3 v_fragPosView;
in float v_depth;
out vec4 fragColor;
void main() {
......@@ -41,6 +39,6 @@ void main() {
if(fragColor.a == 0.0 || dither(gl_FragCoord.xy, fragColor.a) < 0.5){
discard;
} else {
gl_FragDepth = v_depth;
gl_FragDepth = getDepthValue(length(v_fragPosView));
}
}
#version 330 core
#include shader/lib_logdepthbuff.glsl
uniform sampler2D u_texture;
uniform float u_scale;
uniform float u_opacity;
......@@ -8,7 +10,7 @@ uniform float u_opacity;
in vec4 v_color;
in vec2 v_texCoords;
in float v_opacity;
in float v_depth;
in vec3 v_fragPosView;
// OUTPUT
layout (location = 0) out vec4 fragColor;
......@@ -26,5 +28,5 @@ void main(void){
fragColor = vec4(v_color.rgb, aa * v_color.a);
gl_FragDepth = v_depth;
gl_FragDepth = getDepthValue(length(v_fragPosView));
}
#version 330 core
#include shader/lib_logdepthbuff.glsl
in vec4 a_position;
in vec4 a_color;
in vec2 a_texCoord0;
......@@ -18,7 +16,7 @@ uniform vec3 u_pos;
out vec4 v_color;
out vec2 v_texCoords;
out float v_opacity;
out float v_depth;
out vec3 v_fragPosView;
void main()
{
......@@ -28,7 +26,5 @@ void main()
v_texCoords = a_texCoord0;
gl_Position = u_projTrans * a_position;
// Logarithmic depth buffer
v_depth = getDepthValue(length(u_pos));
v_fragPosView = gl_Position.xyz;
}
#version 330 core
in float v_depth;
#include shader/lib_logdepthbuff.glsl
in vec3 v_fragPosView;
in vec4 v_col;
out vec4 fragColor;
void main() {
fragColor = v_col;
// Normal depth buffer
// gl_FragDepth = gl_FragCoord.z;
// Logarithmic depth buffer
gl_FragDepth = v_depth;
gl_FragDepth = getDepthValue(length(v_fragPosView));
}
\ No newline at end of file
#version 330 core
#include shader/lib_logdepthbuff.glsl
in vec4 a_position;
in vec4 a_color;
uniform mat4 u_projModelView;
out vec4 v_col;
out float v_depth;
out vec3 v_fragPosView;
#ifdef relativisticEffects
uniform vec3 u_velDir; // Velocity vector
......@@ -39,9 +37,7 @@ void main() {
#endif // gravitationalWaves
gl_Position = u_projModelView * pos;
// Logarithmic depth buffer
v_depth = getDepthValue(length(pos.xyz));
v_fragPosView = gl_Position.xyz;
v_col = a_color;
}
#version 330 core
#include shader/lib_logdepthbuff.glsl
uniform float u_alpha;
in float v_depth;
in vec3 v_fragPosView;
in vec4 v_col;
out vec4 fragColor;
void main() {
fragColor = vec4(v_col.rgb, v_col.a * u_alpha);
gl_FragDepth = v_depth;
gl_FragDepth = getDepthValue(length(v_fragPosView));
}
#version 330 core
#include shader/lib_logdepthbuff.glsl
in vec4 a_position;
in vec4 a_color;
......@@ -11,7 +9,7 @@ uniform vec3 u_parentPos;
uniform float u_pointSize;
out vec4 v_col;
out float v_depth;
out vec3 v_fragPosView;
#ifdef relativisticEffects
uniform vec3 u_velDir;// Velocity vector
......@@ -45,9 +43,7 @@ void main() {
#endif// gravitationalWaves
gl_Position = u_projModelView * pos;
// Logarithmic depth buffer
v_depth = getDepthValue(length(pos.xyz));
v_fragPosView = gl_Position.xyz;
gl_PointSize = u_pointSize;
v_col = a_color;
......
#version 330 core
#include shader/lib_logdepthbuff.glsl
in vec4 v_col;
in vec2 v_uv;
in float v_depth;
in vec3 v_fragPosView;
out vec4 fragColor;
#define PI 3.14159
......@@ -17,5 +20,5 @@ void main() {
float cplus = pow(core, 10.0);
fragColor = vec4(v_col.rgb + cplus, 1.0) * v_col.a * alpha ;
gl_FragDepth = v_depth;
gl_FragDepth = getDepthValue(length(v_fragPosView));
}
\ No newline at end of file
#version 330 core
#include shader/lib_logdepthbuff.glsl
in vec4 a_position;
in vec4 a_color;
in vec2 a_uv;
......@@ -11,7 +9,7 @@ uniform vec2 u_viewport;
out vec4 v_col;
out vec2 v_uv;
out float v_depth;
out vec3 v_fragPosView;
#ifdef relativisticEffects
uniform vec3 u_velDir;// Velocity vector
......@@ -42,9 +40,7 @@ void main() {
#endif// gravitationalWaves
gl_Position = u_projModelView * pos;
// Logarithmic depth buffer
v_depth = getDepthValue(length(pos.xyz));
v_fragPosView = gl_Position.xyz;
v_col = a_color;
v_uv = a_uv;
......
......@@ -2,12 +2,13 @@
#include shader/lib_math.glsl
#include shader/lib_dither8x8.glsl
#include shader/lib_logdepthbuff.glsl
uniform float u_ar;
uniform float u_alpha;
in vec4 v_col;
in float v_depth;
in vec3 v_fragPosView;
in float v_dust;
out vec4 fragColor;
......@@ -47,5 +48,5 @@ void main() {
}
// Logarithmic depth buffer
gl_FragDepth = v_depth;
gl_FragDepth = getDepthValue(length(v_fragPosView));
}
......@@ -2,7 +2,6 @@
#include shader/lib_math.glsl
#include shader/lib_geometry.glsl
#include shader/lib_logdepthbuff.glsl
uniform float u_pointAlphaMin;
uniform float u_pointAlphaMax;
......@@ -37,7 +36,7 @@ in vec4 a_color;
in vec2 a_additional;
out vec4 v_col;
out float v_depth;
out vec3 v_fragPosView;
out float v_dust;
#define pc_to_u 3.085e7
......@@ -49,9 +48,6 @@ void main() {
vec3 pos = a_position.xyz - u_camPos;
float dist = length(pos);
// Logarithmic depth buffer
v_depth = getDepthValue(dist);
#ifdef relativisticEffects
pos = computeRelativisticAberration(pos, dist, u_velDir, u_vc);
#endif // relativisticEffects
......@@ -69,6 +65,7 @@ void main() {
dscale = pow(dscale, 10.0) * 1.5;
gl_Position = u_projModelView * vec4(pos, 1.0);
v_fragPosView = gl_Position.xyz;
gl_PointSize = a_additional.x * u_sizeFactor * u_ar * dscale;
}
......@@ -231,7 +231,9 @@ in vec3 v_lightCol;
// Logarithmic depth
in float v_depth;
// Fragment position in world space
in vec3 v_fragPos;
in vec3 v_fragPosWorld;
// Fragment in view space
in vec3 v_fragPosView;
#ifdef environmentCubemapFlag
in vec3 v_reflect;
......@@ -331,6 +333,7 @@ mat3 cotangentFrame(vec3 N, vec3 p, vec2 uv){
}
#include shader/lib_atmfog.glsl
#include shader/lib_logdepthbuff.glsl
void main() {
vec2 texCoords = v_texCoord0;
......@@ -363,7 +366,7 @@ void main() {
// Perturb the normal to get reflect direction
pullNormal();
mat3 TBN = cotangentFrame(g_normal, -v_viewDir, texCoords);
vec3 reflectDir = normalize(reflect(-v_fragPos, normalize(TBN * N)));
vec3 reflectDir = normalize(reflect(-v_fragPosWorld, normalize(TBN * N)));
#endif // environmentCubemapFlag
#else
// Normal in tangent space
......@@ -411,5 +414,5 @@ void main() {
discard;
}
// Logarithmic depth buffer
gl_FragDepth = v_depth;
gl_FragDepth = getDepthValue(length(v_fragPosView.xyz));
}
......@@ -295,20 +295,13 @@ uniform DirectionalLight u_dirLights[numDirectionalLights];
out vec3 v_lightDir;
out vec3 v_lightCol;
out vec3 v_viewDir;
out vec3 o_fragPosition;
out vec3 v_fragPos;
out float o_fragHeight;
out vec3 v_fragPosWorld;
out vec3 v_fragPosView;
#ifdef environmentCubemapFlag
out vec3 v_reflect;
#endif
//////////////////////////////////////////////
// LOGARITHMIC DEPTH BUFFER
//////////////////////////////////////////////
#include shader/lib_logdepthbuff.glsl
out float v_depth;
void main() {
computeAtmosphericScatteringGround();
......@@ -325,14 +318,9 @@ void main() {
pos.xyz = computeGravitationalWaves(pos.xyz, u_gw, u_gwmat3, u_ts, u_omgw, u_hterms);
#endif // gravitationalWaves
o_fragPosition = pos.xyz;
v_fragPos = pos.xyz;
o_fragHeight = 0.0;
v_fragPosWorld = pos.xyz;
gl_Position = u_projViewTrans * pos;
// Logarithmic depth buffer
v_depth = getDepthValue(length(pos.xyz));
v_fragPosView = gl_Position.xyz;
#ifdef shadowMapFlag
vec4 spos = u_shadowMapProjViewTrans * pos;
......
#version 330 core
#include shader/lib_geometry.glsl
#include shader/lib_logdepthbuff.glsl
#include shader/lib_doublefloat.glsl
in vec4 a_color;
......@@ -39,7 +38,7 @@ uniform vec2 u_t;
#endif // gravitationalWaves
out vec4 v_col;
out float v_depth;
out vec3 v_fragPosView;
#define M_TO_U 1e-9
#define D_TO_S 86400.0
......@@ -123,9 +122,6 @@ void main() {
cubemapSizeFactor = 1.0 - cosphi * 0.65;
}
// Logarithmic depth buffer
v_depth = getDepthValue(dist);
#ifdef relativisticEffects
pos = computeRelativisticAberration(pos, dist, u_velDir, u_vc);
#endif // relativisticEffects
......@@ -137,6 +133,7 @@ void main() {
v_col = a_color * u_alpha;
gl_Position = u_projModelView * vec4(pos, 0.0);
v_fragPosView = gl_Position.xyz;
float distNorm = dist / 300.0;
gl_PointSize = clamp(u_size / distNorm, 1.5, 3.5) * u_scaleFactor * cubemapSizeFactor * a_size;
}
#version 330 core
#include shader/lib_logdepthbuff.glsl
uniform float u_ar;
uniform float u_falloff;
in vec4 v_col;
in float v_depth;
in vec3 v_fragPosView;
out vec4 fragColor;
......@@ -22,7 +24,5 @@ void main() {
discard;
fragColor = vec4(v_col.rgb * programmatic(dist), 1.0) * v_col.a;
// Logarithmic depth buffer
gl_FragDepth = v_depth;
gl_FragDepth = getDepthValue(length(v_fragPosView));
}
#version 330 core
#include shader/lib_geometry.glsl
#include shader/lib_logdepthbuff.glsl
in vec4 a_position;
in vec4 a_color;
......@@ -33,7 +32,7 @@ uniform int u_cubemap;
#endif // gravitationalWaves
out vec4 v_col;
out float v_depth;
out vec3 v_fragPosView;
void main() {
vec3 pos = a_position.xyz - u_camPos;
......@@ -60,8 +59,6 @@ void main() {
v_col = vec4(a_color.rgb, a_color.a * u_alpha);
gl_Position = u_projModelView * vec4(pos, 0.0);
v_fragPosView = gl_Position.xyz;
gl_PointSize = a_size * u_sizeFactor * cubemapSizeFactor;
// Logarithmic depth buffer
v_depth = getDepthValue(length(pos));
}
#version 330 core
#include shader/lib_logdepthbuff.glsl
uniform sampler2D u_texture0;
// v_texCoords are UV coordinates in [0..1]
in vec2 v_texCoords;
in vec4 v_color;
in float v_depth;
in vec3 v_fragPosView;
out vec4 fragColor;
......@@ -18,5 +20,5 @@ void main() {
fragColor = draw();
// Logarithmic depth buffer
gl_FragDepth = v_depth;
gl_FragDepth = getDepthValue(length(v_fragPosView));
}
......@@ -2,7 +2,6 @@
#include shader/lib_math.glsl
#include shader/lib_geometry.glsl
#include shader/lib_logdepthbuff.glsl
in vec4 a_position;
in vec2 a_texCoord0;
......@@ -32,7 +31,7 @@ uniform float u_omgw;// Wave frequency
out vec4 v_color;
out vec2 v_texCoords;
out float v_depth;
out vec3 v_fragPosView;
void main()
{
......@@ -43,9 +42,6 @@ void main()
vec3 pos = u_pos - u_camShift;
// Logarithmic depth buffer
v_depth = getDepthValue(length(pos));
#ifdef relativisticEffects
pos = computeRelativisticAberration(pos, length(pos), u_velDir, u_vc);
#endif// relativisticEffects
......@@ -95,4 +91,5 @@ void main()
// Position
gl_Position = transform * a_position;
v_fragPosView = gl_Position.xyz;