mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-12 02:02:20 +00:00
ability to specify environment lighting brightness
This commit is contained in:
@@ -419,6 +419,10 @@ impl DeferredLightRenderer {
|
||||
property("cameraPosition", &observer.position.translation),
|
||||
property("invViewProj", &inv_view_projection),
|
||||
property("skyboxLighting", &skybox_lighting),
|
||||
property(
|
||||
"environmentLightingBrightness",
|
||||
&scene.rendering_options.environment_lighting_brightness,
|
||||
),
|
||||
]);
|
||||
let material = RenderMaterial::from([
|
||||
binding(
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
(name: "cameraPosition", kind: Vector3()),
|
||||
(name: "invViewProj", kind: Matrix4()),
|
||||
(name: "skyboxLighting", kind: Bool()),
|
||||
(name: "environmentLightingBrightness", kind: Float()),
|
||||
]),
|
||||
binding: 0
|
||||
),
|
||||
@@ -147,7 +148,7 @@
|
||||
vec4 bakedLighting = texture(bakedLightingTexture, texCoord);
|
||||
|
||||
vec3 irradiance = S_SRGBToLinear(texture(irradianceMap, fragmentNormal)).rgb;
|
||||
vec3 diffuse = (bakedLighting.rgb + (properties.skyboxLighting ? irradiance : properties.ambientColor.rgb)) * albedo.rgb;
|
||||
vec3 diffuse = (bakedLighting.rgb + properties.environmentLightingBrightness * (properties.skyboxLighting ? irradiance : properties.ambientColor.rgb)) * albedo.rgb;
|
||||
|
||||
FragColor.rgb = (kD * diffuse + specular) * ambientOcclusion;
|
||||
FragColor.a = bakedLighting.a;
|
||||
|
||||
@@ -215,6 +215,11 @@ pub struct SceneRenderingOptions {
|
||||
/// A switch, that allows selecting the source of environment lighting. By default, it is set to
|
||||
/// [`EnvironmentLightingSource::SkyBox`].
|
||||
pub environment_lighting_source: EnvironmentLightingSource,
|
||||
|
||||
/// Environment lighting brightness. Default is 1.0. Environment lighting will be multiplied
|
||||
/// by this coefficient.
|
||||
#[visit(optional)]
|
||||
pub environment_lighting_brightness: f32,
|
||||
}
|
||||
|
||||
impl Default for SceneRenderingOptions {
|
||||
@@ -225,6 +230,7 @@ impl Default for SceneRenderingOptions {
|
||||
polygon_rasterization_mode: Default::default(),
|
||||
ambient_lighting_color: Color::opaque(100, 100, 100),
|
||||
environment_lighting_source: Default::default(),
|
||||
environment_lighting_brightness: 1.0,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -237,6 +243,7 @@ impl Clone for SceneRenderingOptions {
|
||||
polygon_rasterization_mode: self.polygon_rasterization_mode,
|
||||
ambient_lighting_color: self.ambient_lighting_color,
|
||||
environment_lighting_source: self.environment_lighting_source,
|
||||
environment_lighting_brightness: self.environment_lighting_brightness,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user