mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-16 09:19:21 -06:00
Increased pre-calculated texture sizes for atmosphere and disabled sunRadiance attenuation temporarily.
This commit is contained in:
@@ -920,8 +920,7 @@ namespace openspace {
|
||||
//=============================================================================
|
||||
//================== Atmosphere Rendering and Uniforms Loading ================
|
||||
//=============================================================================
|
||||
//if (_atmosphereEnabled) {
|
||||
if (false) {
|
||||
if (_atmosphereEnabled) {
|
||||
// Object Space (in Km)
|
||||
glm::mat4 obj2World = glm::translate(glm::mat4(1.0), data.position.vec3() / 1000.0f);
|
||||
|
||||
|
||||
@@ -44,14 +44,24 @@ const int INSCATTER_SPHERICAL_INTEGRAL_SAMPLES = 16;
|
||||
|
||||
const float M_PI = 3.141592657;
|
||||
|
||||
const int TRANSMITTANCE_W = 256;
|
||||
const int TRANSMITTANCE_H = 64;
|
||||
// const int TRANSMITTANCE_W = 256;
|
||||
// const int TRANSMITTANCE_H = 64;
|
||||
|
||||
const int SKY_W = 64;
|
||||
const int SKY_H = 16;
|
||||
// const int SKY_W = 64;
|
||||
// const int SKY_H = 16;
|
||||
|
||||
// const int OTHER_TEXTURES_W = 64;
|
||||
// const int OTHER_TEXTURES_H = 16;
|
||||
|
||||
const int TRANSMITTANCE_W = 512;
|
||||
const int TRANSMITTANCE_H = 128;
|
||||
|
||||
const int SKY_W = 128;
|
||||
const int SKY_H = 32;
|
||||
|
||||
const int OTHER_TEXTURES_W = 128;
|
||||
const int OTHER_TEXTURES_H = 32;
|
||||
|
||||
const int OTHER_TEXTURES_W = 64;
|
||||
const int OTHER_TEXTURES_H = 16;
|
||||
|
||||
// cosines sampling
|
||||
const int SAMPLES_R = 32;
|
||||
|
||||
@@ -286,7 +286,7 @@ vec3 inscatterRadiance(inout vec3 x, inout float t, const vec3 v, const vec3 s,
|
||||
|
||||
// S[L](x,s,v)
|
||||
vec4 inscatterRadiance = max(texture4D(inscatterTexture, r, mu, muSun, nu), 0.0);
|
||||
|
||||
return inscatterRadiance.xyz;
|
||||
// After removing the initial path from camera pos to top of atmosphere or the
|
||||
// current camera position if inside atmosphere, t > 0
|
||||
if (t > 0.0) {
|
||||
@@ -617,6 +617,8 @@ void main() {
|
||||
|
||||
//renderTarget = vec4(analyticTransmittance(r, mu, tF).xyz, 1.0);
|
||||
//renderTarget = vec4(s, 1.0);
|
||||
//renderTarget vec4(vec3(mu), 1.0);
|
||||
//renderTarget = vec4(vec3(abs(mu)/2), 1.0);
|
||||
//renderTarget = HDR(vec4(abs(mu*mu), abs(mu*mu), abs(mu*mu), 1.0));
|
||||
//renderTarget = HDR(vec4(abs(Rt*Rt), abs(Rt*Rt), abs(Rt*Rt), 1.0));
|
||||
//renderTarget = HDR(vec4(abs(Rg*Rg), abs(Rg*Rg), abs(Rg*Rg), 1.0));
|
||||
@@ -641,10 +643,10 @@ void main() {
|
||||
//renderTarget = vec4(HDR(sunColor), 1.0);
|
||||
//renderTarget = vec4(HDR(sunColor), 1.0);
|
||||
vec4 finalRadiance = vec4(HDR(inscatterColor + groundColor + sunColor), 1.0);
|
||||
//vec4 finalRadiance = vec4(HDR(inscatterColor), 1.0);
|
||||
if ( finalRadiance.xyz == vec3(0.0))
|
||||
finalRadiance.w = 0.0;
|
||||
renderTarget = finalRadiance;
|
||||
|
||||
renderTarget = finalRadiance;
|
||||
} else {
|
||||
renderTarget = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
|
||||
@@ -22,14 +22,12 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
//#version __CONTEXT__
|
||||
#version 400
|
||||
#version __CONTEXT__
|
||||
//#version 400
|
||||
|
||||
layout(location = 0) in vec4 in_position;
|
||||
|
||||
out vec3 interpolatedNDCPos;
|
||||
out vec4 vertexPosObjVS;
|
||||
out vec3 interpolatedRayDirection;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
@@ -277,8 +277,8 @@ vec3 inscatterRadiance(inout vec3 x, inout float t, const vec3 v, const vec3 s,
|
||||
dRay ray;
|
||||
ray.direction = vec4(v, 0.0);
|
||||
ray.origin = vec4(x, 1.0);
|
||||
bool hitGround = dAtmosphereIntersection(vec3(0.0), ray, Rg+3,
|
||||
insideATM, offset, maxLength);
|
||||
bool hitGround = dAtmosphereIntersection(vec3(0.0), ray, Rg+1,
|
||||
insideATM, offset, maxLength);
|
||||
if (hitGround) {
|
||||
t = float(offset);
|
||||
}
|
||||
@@ -287,11 +287,11 @@ vec3 inscatterRadiance(inout vec3 x, inout float t, const vec3 v, const vec3 s,
|
||||
float r0 = length(x0);
|
||||
float mu0 = dot(x0, v) / r0;
|
||||
float muSun0 = dot(x0, s) / r0;
|
||||
|
||||
|
||||
// Transmittance from point r, direction mu, distance t
|
||||
// By Analytical calculation
|
||||
attenuation = analyticTransmittance(r, mu, t);
|
||||
|
||||
|
||||
// By Texture Access
|
||||
//attenuation = transmittance(r, mu, v, x0);
|
||||
|
||||
@@ -370,7 +370,7 @@ vec3 inscatterRadiance(inout vec3 x, inout float t, const vec3 v, const vec3 s,
|
||||
} else {
|
||||
// No intersection with atmosphere
|
||||
// The ray is traveling on space
|
||||
radiance = vec3(0.0f);
|
||||
radiance = vec3(0.0, 0.0, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
@@ -497,12 +497,13 @@ vec3 sunColor(const vec3 x, const float t, const vec3 v, const vec3 s, const flo
|
||||
if (t > 0.0f) {
|
||||
return vec3(0.0f);
|
||||
} else {
|
||||
vec3 transmittance = (r <= Rt) ?
|
||||
(mu < -sqrt(1.0f - (Rg/r)/(Rg/r)) ? vec3(0.0f) : transmittanceLUT(r, mu)) :
|
||||
vec3(1.0f);
|
||||
float sunColor = step(cos(M_PI / 180.0), dot(v, s)) * sunRadiance;
|
||||
// vec3 transmittance = (r <= Rt) ?
|
||||
// (mu < -sqrt(1.0f - (Rg/r)/(Rg/r)) ? vec3(0.0f) : transmittanceLUT(r, mu)) :
|
||||
// vec3(1.0f);
|
||||
float sunFinalColor = step(cos(M_PI / 180.0), dot(v, s)) * sunRadiance;
|
||||
|
||||
return transmittance * sunColor;
|
||||
//return transmittance * sunFinalColor;
|
||||
return vec3(sunFinalColor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,6 +550,9 @@ void main() {
|
||||
|
||||
//renderTarget = vec4(analyticTransmittance(r, mu, tF).xyz, 1.0);
|
||||
//renderTarget = vec4(s, 1.0);
|
||||
//renderTarget = vec4(x/100000, 1.0);
|
||||
//renderTarget = vec4(v/1, 1.0);
|
||||
//renderTarget = vec4(vec3(abs(mu)/2), 1.0);
|
||||
//renderTarget = HDR(vec4(abs(mu*mu), abs(mu*mu), abs(mu*mu), 1.0));
|
||||
//renderTarget = HDR(vec4(abs(Rt*Rt), abs(Rt*Rt), abs(Rt*Rt), 1.0));
|
||||
//renderTarget = HDR(vec4(abs(Rg*Rg), abs(Rg*Rg), abs(Rg*Rg), 1.0));
|
||||
@@ -572,16 +576,19 @@ void main() {
|
||||
//renderTarget = vec4(groundColor, 1.0);
|
||||
//renderTarget = vec4(HDR(sunColor), 1.0);
|
||||
//renderTarget = vec4(HDR(sunColor), 1.0);
|
||||
vec4 finalRadiance = vec4(HDR(inscatterColor), 1.0);
|
||||
vec4 finalRadiance = vec4(HDR(inscatterColor + sunColor), 1.0);
|
||||
//vec4 finalRadiance = vec4(inscatterColor, 1.0);
|
||||
//vec4 finalRadiance = vec4(HDR(inscatterColor + sunColor), 1.0);
|
||||
//vec4 finalRadiance = vec4(HDR(inscatterColor + groundColor + sunColor), 1.0);
|
||||
if ( finalRadiance.xyz == vec3(0.0))
|
||||
finalRadiance.w = 0.0;
|
||||
finalRadiance.w = 0.0;
|
||||
renderTarget = finalRadiance;
|
||||
|
||||
//renderTarget = vec4(1.0, 0.0, 0.0, 0.5);
|
||||
//renderTarget = vec4(1.0, 0.0, 0.0, 0.5);
|
||||
//renderTarget = vec4(0.0);
|
||||
} else {
|
||||
//renderTarget = vec4(1.0, 1.0, 0.0, 0.5);
|
||||
renderTarget = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
renderTarget = vec4(1.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user