mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-22 19:29:04 -05:00
Small improvements.
This commit is contained in:
@@ -83,11 +83,11 @@ return {
|
||||
Modules = {
|
||||
"sun",
|
||||
--"atmosphereearth",
|
||||
--"lodglobes/earth",
|
||||
"lodglobes/earth",
|
||||
--"lodglobes/moon",
|
||||
--"moon",
|
||||
--"atmospheremars",
|
||||
"lodglobes/mars",
|
||||
--"lodglobes/mars",
|
||||
--"toyvolume",
|
||||
--"earth",
|
||||
--"stars",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
earthEllipsoid = {6378137.0, 6378137.0, 6356752.314245} -- Earth's radii
|
||||
--earthEllipsoid = {6378137.0, 6378137.0, 6356752.314245} -- Earth's radii
|
||||
earthEllipsoid = {6378137.0, 6378137.0, 6378137.0} -- Earth's radii
|
||||
return {
|
||||
-- Earth barycenter module
|
||||
{
|
||||
@@ -54,6 +55,55 @@ return {
|
||||
CameraMinHeight = 300,
|
||||
InteractionDepthBelowEllipsoid = 0, -- Useful when having negative height map values
|
||||
SegmentsPerPatch = 64,
|
||||
Atmosphere = {
|
||||
-- Atmosphere radius in Km
|
||||
AtmoshereRadius = 6420,
|
||||
PlanetRadius = 6378.1366,
|
||||
PlanetAverageGroundReflectance = 0.1,
|
||||
Rayleigh = {
|
||||
Coefficients = {
|
||||
-- Wavelengths are given in 10^-9m
|
||||
Wavelengths = {680, 550, 440},
|
||||
-- Reflection coefficients are given in km^-1
|
||||
Scattering = {5.8E-3, 13.5E-3, 33.1E-3},
|
||||
-- In Rayleigh scattering, the coefficients of absorption and scattering are the same.
|
||||
},
|
||||
-- Thichkness of atmosphere if its density were uniform, in Km
|
||||
H_R = 8.0,
|
||||
},
|
||||
-- Default
|
||||
Mie = {
|
||||
Coefficients = {
|
||||
-- Reflection coefficients are given in km^-1
|
||||
Scattering = {4.0e-3, 4.0e-3, 4.0e-3},
|
||||
--Scattering = {2.0e-5, 2.0e-5, 2.0e-5},
|
||||
-- Extinction coefficients are a fraction of the Scattering coefficients
|
||||
Extinction = {4.0e-3/0.9, 4.0e-3/0.9, 4.0e-3/0.9}
|
||||
-- Height scale (atmosphere thickness for constant density) in Km
|
||||
},
|
||||
H_M = 1.2,
|
||||
-- Mie Phase Function Value (G e [-1.0, 1.0]. If G = 1.0, Mie phase function = Rayleigh Phase Function)
|
||||
G = 0.85
|
||||
},
|
||||
-- Clear Sky
|
||||
-- Mie = {
|
||||
-- Coefficients = {
|
||||
-- Scattering = {20e-3, 20e-3, 20e-3},
|
||||
-- Extinction = 1.0/0.9,
|
||||
-- }
|
||||
-- H_M = 1.2,
|
||||
-- G = 0.76,
|
||||
-- },
|
||||
-- Cloudy
|
||||
-- Mie = {
|
||||
-- Coefficients = {
|
||||
-- Scattering = {3e-3, 3e-3, 3e-3},
|
||||
-- Extinction = 1.0/0.9,
|
||||
-- }
|
||||
-- H_M = 3.0,
|
||||
-- G = 0.65,
|
||||
-- },
|
||||
},
|
||||
Layers = {
|
||||
ColorLayers = {
|
||||
|
||||
@@ -181,4 +231,4 @@ return {
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ void dCalculateRayRenderablePlanet(out dRay ray, out dvec4 planetPositionObjectC
|
||||
dvec4 objectCoords = dInverseTransformMatrix * dvec4(-dObjpos.xyz + worldCoords.xyz, 1.0);
|
||||
|
||||
// Planet Position in Object Space
|
||||
planetPositionObjectCoords = dInverseTransformMatrix * dvec4(-dObjpos.xyz + dObjpos.xyz, 1.0);
|
||||
planetPositionObjectCoords = dvec4(0.0,0.0,0.0,1.0);//dInverseTransformMatrix * dvec4(-dObjpos.xyz + dObjpos.xyz, 1.0);
|
||||
|
||||
// Camera Position in Object Space
|
||||
cameraPositionInObject = dInverseTransformMatrix * dvec4(-dObjpos.xyz + dCampos, 1.0);
|
||||
@@ -801,8 +801,8 @@ void main() {
|
||||
vec4 meanNormal = vec4(0.0);
|
||||
vec4 meanPosition = vec4(0.0);
|
||||
for (int i = 0; i < nAaSamples; i++) {
|
||||
meanNormal += texelFetch(mainNormalReflectanceTexture, ivec2(gl_FragCoord), i);
|
||||
meanColor += texelFetch(mainColorTexture, ivec2(gl_FragCoord), i);
|
||||
meanNormal += texelFetch(mainNormalReflectanceTexture, ivec2(gl_FragCoord), i);
|
||||
meanColor += texelFetch(mainColorTexture, ivec2(gl_FragCoord), i);
|
||||
meanPosition += texelFetch(mainPositionTexture, ivec2(gl_FragCoord), i);
|
||||
// geoDepth += denormalizeFloat(texelFetch(mainDepthTexture, ivec2(gl_FragCoord), i).x);
|
||||
}
|
||||
@@ -833,9 +833,10 @@ void main() {
|
||||
// Now we check is if the atmosphere is occluded, i.e., if the distance to the pixel
|
||||
// in the depth buffer is less than the distance to the atmosphere then the atmosphere
|
||||
// is occluded
|
||||
|
||||
// Fragments positions into G-Buffer are written in OS Eye Space (Camera Rig Coords)
|
||||
// when using their positions later, one must convert them to the planet's coords
|
||||
dvec3 tmpPos = dmat3(dInverseCamRotTransform) * dvec3(dInverseScaleTransformMatrix * meanPosition);
|
||||
dvec4 fragWorldCoords = dvec4(dCampos + tmpPos, 1.0);
|
||||
dvec4 fragWorldCoords = dvec4(dCampos + tmpPos, 1.0); // Fragment in World Coords
|
||||
dvec4 fragObjectCoords = dInverseTransformMatrix * dvec4(-dObjpos.xyz + fragWorldCoords.xyz, 1.0);
|
||||
double pixelDepth = distance(cameraPositionInObject.xyz, fragObjectCoords.xyz);
|
||||
|
||||
@@ -909,15 +910,23 @@ void main() {
|
||||
// Now we check is if the atmosphere is occluded, i.e., if the distance to the pixel
|
||||
// in the depth buffer is less than the distance to the atmosphere then the atmosphere
|
||||
// is occluded
|
||||
// Fragments positions into G-Buffer are written in OS Eye Space (Camera Rig Coords)
|
||||
// when using their positions later, one must convert them to the planet's coords
|
||||
|
||||
// OS Eye to World coords
|
||||
dvec4 tmpRInv = dInverseCamRotTransform * meanPosition;
|
||||
dvec4 fragWorldCoords= dvec4(dvec3(tmpRInv) + dCampos, 1.0);
|
||||
|
||||
// World to Object
|
||||
dvec4 fragObjectCoords = dInverseTransformMatrix * fragWorldCoords;
|
||||
|
||||
dvec3 tmpPos = dmat3(dInverseCamRotTransform) * dvec3(dInverseScaleTransformMatrix * meanPosition);
|
||||
dvec4 fragWorldCoords = dvec4(dCampos + tmpPos, 1.0);
|
||||
dvec4 fragObjectCoords = dInverseTransformMatrix * dvec4(-dObjpos.xyz + fragWorldCoords.xyz, 1.0);
|
||||
double pixelDepth = distance(cameraPositionInObject.xyz, fragObjectCoords.xyz);
|
||||
|
||||
if (pixelDepth < offset) {
|
||||
renderTarget = meanColor;
|
||||
} else {
|
||||
// TODO: Write the correct values in G-Buffer
|
||||
// if (pixelDepth < offset) {
|
||||
// renderTarget = meanColor;
|
||||
// } else {
|
||||
{
|
||||
// Following paper nomenclature
|
||||
double t = offset;
|
||||
vec3 attenuation;
|
||||
|
||||
Reference in New Issue
Block a user