Skip to content

Commit

Permalink
Smaller improvements, add instancing effect
Browse files Browse the repository at this point in the history
  • Loading branch information
tobspr committed Nov 6, 2016
1 parent 5321b61 commit f2341f8
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 22 deletions.
28 changes: 28 additions & 0 deletions effects/basic_instancing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

# Terrain effect
# This effect uses prodecural shader splatting, you most likely want to modify
# it with your own texture-map generation code.

vertex:
inout: |
uniform samplerBuffer InstancingData;
transform: |
int data_index = gl_InstanceID * 4;
vec4 data_0 = texelFetch(InstancingData, data_index);
vec4 data_1 = texelFetch(InstancingData, data_index + 1);
vec4 data_2 = texelFetch(InstancingData, data_index + 2);
vec4 data_3 = texelFetch(InstancingData, data_index + 3);
mat4 transform_mat = mat4(data_0, data_1, data_2, data_3);
vOutput.position = (transform_mat * p3d_Vertex).xyz;
// Also transform normal, not 100% correct but works out nicely
vOutput.normal = mat3(transform_mat) * vOutput.normal;
fragment:

2 changes: 1 addition & 1 deletion rpcore/mount_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def __init__(self, pipeline):
self._mounted = False
self._do_cleanup = True
self._config_dir = None
self.debug("Auto-Detected base path to", self._base_path)

self.debug("Auto-Detected base path to", self._base_path)
atexit.register(self._on_exit_cleanup)

@property
Expand Down
6 changes: 2 additions & 4 deletions rpcore/shader/ambient_stage.frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,8 @@ void main() {

// Prevent total dark ao term
sky_ao_factor = max(0.2, sky_ao_factor);


// occlusion *= min(occlusion, sky_ao_factor);
// occlusion *= sky_ao_factor;
#else
float sky_ao_factor = 1.0;
#endif

// Get reflection directory
Expand Down
4 changes: 2 additions & 2 deletions rpcore/shader/includes/envprobes.inc.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void apply_cubemap(int id, Material m, out vec4 diffuse, out vec4 specular,
float roughness = get_effective_roughness(m);

float factor = 0.0;
float mipmap = m.linear_roughness * 30.0;
float mipmap = m.linear_roughness * 10.0;
float intersection_distance = 1.0;

Cubemap map = get_cubemap(id);
Expand All @@ -169,7 +169,7 @@ void apply_cubemap(int id, Material m, out vec4 diffuse, out vec4 specular,
mipmap *= 0.1;
}
#else
mipmap *= 0.1;
// mipmap *= 0.1;
#endif


Expand Down
2 changes: 1 addition & 1 deletion rplibs/pyqt_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from PyQt4.QtCore import *

def qt_connect(obj, signal_name, handler):
obj.connect(SIGNAL(signal_name), handler)
QObject.connect(obj, SIGNAL(signal_name), handler)

elif PYQT_VERSION == 5:
from PyQt5.QtGui import *
Expand Down
1 change: 0 additions & 1 deletion rpplugins/ao/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class Plugin(BasePlugin):

def on_stage_setup(self):
self.stage = self.create_stage(AOStage)

self.stage.quality = self.get_setting("blur_quality")

# Make the stages use our output
Expand Down
21 changes: 12 additions & 9 deletions rpplugins/clouds/shader/render_clouds.frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ const float METER = 1.0;

const float earth_radius = 6371.0 * KM;
const vec3 earth_mid = vec3(0, 0, -earth_radius);
const float cloud_start = earth_radius + 1.5 * KM;
const float cloud_end = earth_radius + 4.0 * KM;
const float cloud_start = earth_radius + 1.3 * KM;
const float cloud_end = earth_radius + 25.0 * KM;


float GetHeightFractionForPoint(vec3 inPosition, vec2 inCloudMinMax)
Expand Down Expand Up @@ -100,15 +100,16 @@ float SampleCloudDensity(vec3 p, vec3 weather_data, float mip_level)
// base_cloud = mix(high_frequency_noises.y * base_cloud, 1, base_cloud);

base_cloud -= high_frequency_noises.y * 0.23 * (1 - base_cloud);
base_cloud *= 3.0;
// base_cloud *= 3.0;
base_cloud *= 125.0 * 256.0 / GET_SETTING(clouds, raymarch_steps);

return saturate(base_cloud);
}


vec2 get_cloud_coord(vec3 pos) {
vec2 xy_coord = pos.xy / (cloud_end - cloud_start);
xy_coord.xy /= 1.0 + 0.05 * length(xy_coord);
xy_coord.xy /= 1.0 + 0.1 * length(xy_coord);
// xy_coord.xy += 0.5;
// xy_coord *= 0.5;
return xy_coord;
Expand All @@ -122,11 +123,11 @@ float HenyeyGreenstein(vec3 inLightVector, vec3 inViewVector, float inG)
}

void main() {
// int num_samples = GET_SETTING(clouds, raymarch_steps);
int num_samples = 256;
int num_samples = GET_SETTING(clouds, raymarch_steps);
// int num_samples = 256;

vec2 texcoord = get_half_texcoord();
vec3 wind_offs = vec3(0.2, 0.3, 0) * 0.022 * MainSceneData.frame_time;
vec3 wind_offs = vec3(0.2, 0.3, 0) * 0.052 * MainSceneData.frame_time;

vec3 pos = get_gbuffer_position(GBuffer, texcoord);
vec3 ray_start = MainSceneData.camera_pos;
Expand Down Expand Up @@ -169,7 +170,9 @@ void main() {
int zero_density_sample_count = 0;
float mip_level = 0;

vec3 p = trace_start + trace_step;
float jitter = abs(rand(ivec2(gl_FragCoord.xy)));

vec3 p = trace_start + (1 + jitter) * trace_step;

vec3 accum_color = vec3(0);

Expand Down Expand Up @@ -213,7 +216,7 @@ void main() {


// Don't render clouds at obligue angles
float horizon = pow(saturate(ray_dir.z * 1.0), 0.3);
float horizon = pow(saturate(ray_dir.z * 1.0), 0.1);
accum_color *= horizon;
accum_weight *= horizon;

Expand Down
2 changes: 1 addition & 1 deletion rpplugins/ssr/shader/reproject_lighting.frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@ void main() {
intersected_color = clamp(intersected_color, 0.0, 2 * current_ev);
#endif

// Finally store the result in the mip-chian
// Finally store the result in the mip-chain
result = vec4(intersected_color, 1) * fade;
}
4 changes: 2 additions & 2 deletions toolkit/day_time_editor/ui/compile_ui_qt4.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
rem Adjust the path to match your PyQt4 installation
SET PYQTPATH="C:\Projekte\Panda3D\built_x64\python\Lib\site-packages\PyQt4"

python "%PYQTPATH%\uic\pyuic.py" --from-imports main_window.ui -o main_window_generated.py
python "%PYQTPATH%\uic\pyuic.py" --from-imports point_insert.ui -o point_insert_dialog_generated.py
python -m PyQt4.uic.pyuic --from-imports main_window.ui -o main_window_generated.py
python -m PyQt4.uic.pyuic --from-imports point_insert.ui -o point_insert_dialog_generated.py
"%PYQTPATH%\pyrcc4.exe" -py3 resources.qrc -o resources_rc.py

pause
2 changes: 1 addition & 1 deletion toolkit/plugin_configurator/ui/compile_ui_qt4.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
rem Adjust the path to match your PyQt4 installation
SET PYQTPATH="C:\Projekte\Panda3D\built_x64\python\Lib\site-packages\PyQt4"

python "%PYQTPATH%\uic\pyuic.py" --from-imports main_window.ui -o main_window_generated.py
python -m PyQt4.uic.pyuic --from-imports main_window.ui -o main_window_generated.py
"%PYQTPATH%\pyrcc4.exe" -py3 resources.qrc -o resources_rc.py

pause

0 comments on commit f2341f8

Please sign in to comment.