mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-02 08:49:20 -05:00
addressed some more PR edit requests, mostly clarification;
bumped ghoul to match current master
This commit is contained in:
@@ -14,7 +14,9 @@ local celestial_globe_folder = asset.resource({
|
||||
Version = 1
|
||||
})
|
||||
|
||||
local ModelMars1 = {
|
||||
-- These models are in the same shadow group, so will cast onto and receive
|
||||
-- shadows from each other, as well as the Mars surface
|
||||
local ModelMarsSmall = {
|
||||
Identifier = "celestial-globe-mars1",
|
||||
Parent = mars.Mars.Identifier,
|
||||
Transform = {
|
||||
@@ -52,7 +54,7 @@ local ModelMars1 = {
|
||||
}
|
||||
}
|
||||
|
||||
local ModelMars2 = {
|
||||
local ModelMarsLarge = {
|
||||
Identifier = "celestial-globe-mars2",
|
||||
Parent = mars.Mars.Identifier,
|
||||
Transform = {
|
||||
@@ -94,7 +96,8 @@ local ModelMars2 = {
|
||||
}
|
||||
}
|
||||
|
||||
local ModelMars3 = {
|
||||
-- This model is in a different shadow group, so will not receive or cast shadows onto the other Mars models
|
||||
local ModelMarsOtherGroup = {
|
||||
Identifier = "celestial-globe-mars3",
|
||||
Parent = mars.Mars.Identifier,
|
||||
Transform = {
|
||||
@@ -136,6 +139,7 @@ local ModelMars3 = {
|
||||
}
|
||||
}
|
||||
|
||||
-- Models that are far away MUST have their own shadow groups, otherwise no shadows will be visible
|
||||
local ModelEarth = {
|
||||
Identifier = "celestial-globe-earth",
|
||||
Parent = earth.Earth.Identifier,
|
||||
@@ -214,9 +218,9 @@ local ModelMoon = {
|
||||
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.addSceneGraphNode(ModelMars1)
|
||||
openspace.addSceneGraphNode(ModelMars2)
|
||||
openspace.addSceneGraphNode(ModelMars3)
|
||||
openspace.addSceneGraphNode(ModelMarsSmall)
|
||||
openspace.addSceneGraphNode(ModelMarsLarge)
|
||||
openspace.addSceneGraphNode(ModelMarsOtherGroup)
|
||||
openspace.addSceneGraphNode(ModelEarth)
|
||||
openspace.addSceneGraphNode(ModelMoon)
|
||||
end)
|
||||
@@ -224,7 +228,7 @@ end)
|
||||
asset.onDeinitialize(function()
|
||||
openspace.removeSceneGraphNode(ModelMoon)
|
||||
openspace.removeSceneGraphNode(ModelEarth)
|
||||
openspace.removeSceneGraphNode(ModelMars3)
|
||||
openspace.removeSceneGraphNode(ModelMars2)
|
||||
openspace.removeSceneGraphNode(ModelMars1)
|
||||
openspace.removeSceneGraphNode(ModelMarsOtherGroup)
|
||||
openspace.removeSceneGraphNode(ModelMarsLarge)
|
||||
openspace.removeSceneGraphNode(ModelMarsSmall)
|
||||
end)
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
"celestial-globe-earth",
|
||||
"celestial-globe-mars1",
|
||||
"celestial-globe-mars2",
|
||||
"celestial-globe-mars3",
|
||||
"celestial-globe-moon",
|
||||
"Earth",
|
||||
"Moon",
|
||||
|
||||
+1
-1
Submodule ext/ghoul updated: 357a08bf2c...04688d7568
@@ -183,18 +183,20 @@ Fragment getFragment() {
|
||||
if (has_shadow_depth_map) {
|
||||
const float bias = 0.0005;
|
||||
vec3 coords = 0.5 + 0.5 * lightspace_position.xyz / lightspace_position.w;
|
||||
vec2 ssz = 1.f / textureSize(shadow_depth_map, 0);
|
||||
const int sz = 3;
|
||||
const float norm = pow(2.f * sz + 1, 2.f);
|
||||
float accum = 0.f;
|
||||
|
||||
for (int x = -sz; x <= sz; ++x) {
|
||||
for (int y = -sz; y <= sz; ++y) {
|
||||
float depth = texture(shadow_depth_map, coords.xy + vec2(x * ssz.x, y * ssz.y)).r;
|
||||
// Any fragment that is behind the stored depth is in shadow, multisampling for smoother shadows
|
||||
const int shadowFilterSize = 3;
|
||||
float accum = 0.f;
|
||||
vec2 stepSize = 1.f / textureSize(shadow_depth_map, 0);
|
||||
for (int x = -shadowFilterSize; x <= shadowFilterSize; ++x) {
|
||||
for (int y = -shadowFilterSize; y <= shadowFilterSize; ++y) {
|
||||
float depth = texture(shadow_depth_map, coords.xy + vec2(x * stepSize.x, y * stepSize.y)).r;
|
||||
accum += float(coords.z < 1.f && depth > coords.z - bias);
|
||||
}
|
||||
}
|
||||
|
||||
// Scale the accumulated shadow factor to [0, 1]
|
||||
const float norm = pow(2.f * shadowFilterSize + 1, 2.f);
|
||||
float shadowFactor = accum / norm;
|
||||
// Apply shadow to diffuse lighting (with ambient contribution)
|
||||
vec3 ambientLightColor = ambientIntensity * lightColor * diffuseAlbedo.rgb;
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace {
|
||||
constexpr openspace::properties::Property::PropertyInfo PerformHorizonCullingInfo = {
|
||||
"PerformHorizonCulling",
|
||||
"Perform horizon culling",
|
||||
"If this value is set to 'true', horizon culling will be performed.",
|
||||
"If this value is set to 'true', renderables below the horizon will be culled.",
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
|
||||
@@ -487,7 +487,7 @@ void FramebufferRenderer::registerShadowCaster(const std::string& shadowgroup,
|
||||
std::pair<GLuint, glm::dmat4> FramebufferRenderer::shadowInformation(
|
||||
const SceneGraphNode* node, const std::string& shadowgroup) const
|
||||
{
|
||||
ghoul_assert(_shadowMaps.contains(shadowgroup), "");
|
||||
ghoul_assert(_shadowMaps.contains(shadowgroup), "Shadow group not registered");
|
||||
return {
|
||||
_shadowMaps.at(shadowgroup).depthMap,
|
||||
_shadowMaps.at(shadowgroup).viewProjectionMatrix
|
||||
|
||||
Reference in New Issue
Block a user