Skip to content

Commit

Permalink
Add more setting to volumetrics plugin, use skyao in environment map …
Browse files Browse the repository at this point in the history
…capture, various improvements
  • Loading branch information
tobspr committed Nov 16, 2016
1 parent e13f07e commit 9366241
Show file tree
Hide file tree
Showing 26 changed files with 494 additions and 291 deletions.
28 changes: 16 additions & 12 deletions config/daytime.yaml

Large diffs are not rendered by default.

119 changes: 62 additions & 57 deletions config/plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,55 +26,55 @@ enabled:
overrides:
ao:
blur_quality: MEDIUM
blur_normal_factor: 1.2
blur_depth_factor: 0.9
occlusion_strength: 1.6
clip_length: 2
blur_normal_factor: 2.97
blur_depth_factor: 0.88158
occlusion_strength: 2.19
clip_length: 4
technique: SSAO
ssao_sample_radius: 80.0
ssao_sample_radius: 95.29
ssao_sequence: halton_3D_8
ssao_bias: 0.0333
ssao_max_distance: 6.9
ssao_bias: 0.0143
ssao_max_distance: 7.5
hbao_sample_radius: 255.0
hbao_ray_count: 4
hbao_ray_steps: 3
hbao_tangent_bias: 0.65
hbao_tangent_bias: 0.64997
hbao_max_distance: 11.5
ssvo_sequence: halton_2D_8
ssvo_sphere_radius: 18.0
ssvo_max_distance: 0.82
alchemy_sample_radius: 210.0
ssvo_max_distance: 3.19
alchemy_sample_radius: 38.86
alchemy_sequence: halton_2D_8
alchemy_max_distance: 4.75
ue4ao_sample_radius: 110.5
alchemy_max_distance: 5.86
ue4ao_sample_radius: 50.14286
ue4ao_sample_sequence: halton_2D_8
ue4ao_max_distance: 1.87
ue4ao_max_distance: 1.47

bloom:
num_mipmaps: 8
bloom_strength: 1.0
num_mipmaps: 6
bloom_strength: 0.8003
remove_fireflies: False
lens_dirt_factor: 0.7
lens_dirt_factor: 0.0

clouds:
raymarch_steps: 160

color_correction:
tonemap_operator: uncharted2
tonemap_operator: exponential2
reinhard_version: rgb
exponential_factor: 1.0
uc2t_shoulder_strength: 0.22
uc2t_linear_strength: 0.3
uc2t_linear_angle: 0.1
uc2t_toe_strength: 0.2
uc2t_toe_numerator: 0.01
uc2t_toe_denumerator: 0.3
uc2t_reference_white: 11.2
vignette_strength: 0.35
film_grain_strength: 0.125
color_lut: film_luts/default_lut.png
exponential_factor: 1.23
uc2t_shoulder_strength: 0.3352
uc2t_linear_strength: 0.5339
uc2t_linear_angle: 0.1797
uc2t_toe_strength: 0.3919
uc2t_toe_numerator: 0.0029
uc2t_toe_denumerator: 0.2787
uc2t_reference_white: 10.05
vignette_strength: 0.1286
film_grain_strength: 0.1286
color_lut: film_luts/saturation_lut.png
use_chromatic_aberration: True
chromatic_aberration_strength: 0.5
chromatic_aberration_strength: 0.019
chromatic_aberration_samples: 2
manual_camera_parameters: False
min_exposure_value: 0.01
Expand All @@ -87,10 +87,10 @@ overrides:
sharpen_twice: False

dof:
focal_point: 10.0
focal_size: 2.5
blur_strength: 0.5
near_blur_strength: 0.5
focal_point: 1000.0
focal_size: 994.0
blur_strength: 0.0
near_blur_strength: 0.4286

env_probes:
probe_resolution: 128
Expand All @@ -116,60 +116,60 @@ overrides:
num_samples: 12

pssm:
max_distance: 100.0
logarithmic_factor: 2.4
max_distance: 50.0
logarithmic_factor: 3.0
sun_distance: 100.0
split_count: 5
split_count: 4
resolution: 1024
border_bias: 0.058
use_pcf: True
filter_sequence: halton_2D_16
filter_radius: 0.55
fixed_bias: 0.48
slope_bias: 0.11
normal_bias: 0.39
filter_sequence: halton_2D_32
filter_radius: 0.7
fixed_bias: 0.11429
slope_bias: 0.0
normal_bias: 0.67
use_pcss: False
pcss_sequence: halton_2D_16
pcss_penumbra_size: 11.0
pcss_min_penumbra_size: 5.0
pcss_penumbra_size: 2.38
pcss_min_penumbra_size: 7.0
use_distant_shadows: True
dist_shadow_resolution: 1024
dist_shadow_clipsize: 1000.0
dist_shadow_sundist: 500.0
dist_shadow_resolution: 4096
dist_shadow_clipsize: 400.0
dist_shadow_sundist: 300.0
scene_shadow_resolution: 512
scene_shadow_sundist: 100.0
scene_shadow_sundist: 300.0

scattering:
scattering_method: eric_bruneton
ground_reflectance: 0.1
ground_reflectance: 0.1231
rayleigh_factor: 0.5
rayleigh_height_scale: 8.0
mie_height_scale: 1.3
mie_phase_factor: 0.3
beta_mie_scattering: 4.0
enable_godrays: False
atmosphere_start: 100.0
atmosphere_start: 549.61

skin_shading:
quality: medium
blur_scale: 0.43

sky_ao:
sample_radius: 6.0
max_radius: 200.0
sample_radius: 17.17
max_radius: 500.0
resolution: 1024
sample_sequence: poisson_2D_32
ao_multiplier: 0.25
ao_bias: 0.3
blend_factor: 0.05
capture_height: 250.0
ao_multiplier: 0.83
ao_bias: 0.0
blend_factor: 0.01
capture_height: 568.75

smaa:
use_reprojection: True
smaa_quality: ultra
jitter_pattern: halton8
history_length: 8
jitter_amount: 0.3
jitter_amount: 0.16143

ssr:
effect_scale: 1.0
Expand All @@ -184,7 +184,12 @@ overrides:

volumetrics:
enable_volumetric_shadows: True
volumetric_shadow_intensity: 1.0
volumetric_shadow_intensity: 8.31
volumetric_shadow_brightness: 0.36
volumetric_shadow_pow: 1.15999
volumetric_max_distance: 79.41429
volumetric_shadow_fadein_distance: 9.49
volumetric_num_steps: 128

vxgi:
grid_resolution: 256
Expand Down
2 changes: 1 addition & 1 deletion config/stages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ global_stage_order:
- PSSMDistShadowStage
- PSSMSceneShadowStage
- ScatteringEnvmapStage
- SkyAOCaptureStage
- EnvironmentCaptureStage
- VoxelizationStage
- SkyAOCaptureStage

# Main scene
- GBufferStage
Expand Down
2 changes: 2 additions & 0 deletions rpcore/gui/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,11 @@ def toggle_gui_visible(self):
if not self.fullscreen_node.is_hidden():
self.fullscreen_node.hide()
self.overlay_node.hide()
self.error_msg_handler.hide()
else:
self.fullscreen_node.show()
self.overlay_node.show()
self.error_msg_handler.show()

def toggle_keybindings_visible(self):
""" Shows / Hides the FPS graph """
Expand Down
6 changes: 6 additions & 0 deletions rpcore/gui/error_message_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,9 @@ def clear_messages(self):
""" Clears all messages / removes them """
self._error_node.node().remove_all_children()
self._num_errors = 0

def show(self):
self._error_node.show()

def hide(self):
self._error_node.hide()
2 changes: 1 addition & 1 deletion rpcore/pluginbase/day_setting_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class ScalarType(BaseType):

def __init__(self, data):
BaseType.__init__(self, data)
self.unit = data.pop("unit")
self.unit = data.pop("unit", "none")
self.minvalue, self.maxvalue = data.pop("range")
self.logarithmic_factor = data.pop("logarithmic_factor", 1.0)
if self.unit not in ("degree", "meter", "percent", "klux", "none"):
Expand Down
1 change: 1 addition & 0 deletions rpcore/render_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def create(self, base=None):
self._init_debugger()

self.plugin_mgr.trigger_hook("stage_setup")
self.plugin_mgr.trigger_hook("post_stage_setup")

self._create_common_defines()
self._initialize_managers()
Expand Down
32 changes: 27 additions & 5 deletions rpcore/shader/includes/forward_shading.inc.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ uniform int maxLightIndex;
uniform mat4 PSSMSceneSunShadowMVP;
#endif

#if HAVE_PLUGIN(sky_ao)
#pragma include "/$$rp/rpplugins/sky_ao/shader/sky_ao.inc.glsl"
#endif

#if VIEWSPACE_SHADING

Expand Down Expand Up @@ -148,7 +151,22 @@ uniform int maxLightIndex;
DEFAULT_ENVMAP_BRIGHTNESS;
#endif

shading_result += (0.1 + 0.3 * m.basecolor) * diff_env;
#if HAVE_PLUGIN(env_probes)
const float sky_ambient_factor = TimeOfDay.env_probes.sky_ambient_scale;
const float ambient_factor = TimeOfDay.env_probes.ambient_scale;
#else
const float sky_ambient_factor = 0.05;
const float ambient_factor = 0.1;
#endif

#if HAVE_PLUGIN(sky_ao)
float sky_ao = compute_sky_ao(m.position, m.normal);
#else
float sky_ao = 1.0;
#endif
shading_result += (sky_ambient_factor + ambient_factor * sqrt(m.basecolor)) * sky_ao * diff_env;



// Emission
if (m.shading_model == SHADING_MODEL_EMISSIVE) {
Expand Down Expand Up @@ -218,7 +236,6 @@ float get_sun_shadow_factor(vec3 position, vec3 normal) {
// float shadow = get_sun_shadow_factor(m.position, m.normal);

float shadow = 1.0;

return apply_light(m, view_vector, l, sun_color, 1.0, shadow, vec3(1));


Expand All @@ -234,18 +251,23 @@ float get_sun_shadow_factor(vec3 position, vec3 normal) {
// sun shadows
vec3 get_sun_shading(Material m) {
#if HAVE_PLUGIN(scattering)
float shadow = 0.0;
vec3 shading_result = vec3(0);
vec3 sun_vector = get_sun_vector();
vec3 sun_color = get_sun_color() * get_sun_color_scale(sun_vector);

if (sun_vector.z >= SUN_VECTOR_HORIZON) {
float NxL = saturate(dot(sun_vector, m.normal));
if (NxL > 0.0) {
float shadow_term = get_sun_shadow_factor(m.position, m.normal);
shading_result += NxL * sun_color * shadow_term * m.basecolor;
shadow = NxL * get_sun_shadow_factor(m.position, m.normal);
}
}
return shading_result;
#if HAVE_PLUGIN(env_probes)
const float factor = TimeOfDay.env_probes.sun_ambient_scale;
#else
const float factor = 1.0;
#endif
return shadow * sun_color * factor * m.basecolor;
#else
return vec3(0);
#endif
Expand Down
2 changes: 1 addition & 1 deletion rpcore/util/movement_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def update(self, task):

# z-force is inddpendent of camera direction
translated_direction.add_z(
self.movement[2] * delta * 40.0 * self.speed)
self.movement[2] * delta * 120.0 * self.speed)

self.velocity += translated_direction * 0.15

Expand Down
6 changes: 3 additions & 3 deletions rpplugins/bloom/shader/apply_bloom.frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ void main() {
// Apply dirt
vec3 lens_dirt = textureLod(LensDirtTex, texcoord, 0).xyz;
float base_dirt_factor = GET_SETTING(bloom, lens_dirt_factor);
float dirt_factor = saturate(2.0 * get_luminance(bloom_result) - 0.05) * 4.0;
dirt_factor *= base_dirt_factor;
bloom_result *= 0.5 + 0.5 * (1 - base_dirt_factor) + dirt_factor * pow(lens_dirt, vec3(2.0));
vec3 dirt_factor = pow(lens_dirt, vec3(1.0));

bloom_result = mix(bloom_result, bloom_result * dirt_factor, base_dirt_factor);

// Blend scene color and bloom color
result = scene_result + bloom_result;
Expand Down
16 changes: 4 additions & 12 deletions rpplugins/color_correction/shader/post_fx.frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,9 @@ void main() {

#if !DEBUG_MODE

// Physically correct vignette, using the cos4 law.
// Get the angle between the camera direction and the view direction
vec3 material_dir = normalize(MainSceneData.camera_pos -
calculate_surface_pos(1, texcoord));
vec3 cam_dir = normalize(MainSceneData.camera_pos -
calculate_surface_pos(1, vec2(0.5)));

// According to the cos4 law, the brightness at angle alpha is cos^4(alpha).
// Since dot() returns the cosine, we can just pow it to get a physically
// correct vignette.
float cos_angle = dot(cam_dir, material_dir);
float vignette = pow(cos_angle, 2.0);

vec2 ccord = (texcoord - 0.5) * vec2(1.0, ASPECT_RATIO);
float vignette = 1 - saturate(length(ccord));

// Chromatic abberation
#if GET_SETTING(color_correction, use_chromatic_aberration)
Expand Down Expand Up @@ -83,5 +74,6 @@ void main() {
vec3 scene_color = textureLod(ShadedScene, texcoord, 0).xyz;
#endif // !DEBUG_MODE


result = vec4(scene_color, 1);
}
Loading

0 comments on commit 9366241

Please sign in to comment.