Forward renderer effects
This commit is contained in:
parent
abd0ab0c6c
commit
67f5bf0c6a
123
Shaders/blur_bilat_pass/blur_bilat_pass.frag.glsl
Normal file
123
Shaders/blur_bilat_pass/blur_bilat_pass.frag.glsl
Normal file
|
@ -0,0 +1,123 @@
|
|||
// Exclusive to volumetric light for now
|
||||
#version 450
|
||||
|
||||
#include "compiled.glsl"
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform vec2 dir;
|
||||
uniform vec2 screenSize;
|
||||
|
||||
in vec2 texCoord;
|
||||
out vec4 fragColor;
|
||||
|
||||
const float weight[10] = float[] (0.132572, 0.125472, 0.106373, 0.08078, 0.05495, 0.033482, 0.018275, 0.008934, 0.003912, 0.001535);
|
||||
|
||||
float normpdf(float x, float sigma) {
|
||||
return 0.39894 * exp(-0.5 * x * x / (sigma * sigma)) / sigma;
|
||||
}
|
||||
|
||||
float normpdf3(vec3 v, float sigma) {
|
||||
return 0.39894 * exp(-0.5 * dot(v, v) / (sigma * sigma)) / sigma;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 step = (dir / screenSize.xy);
|
||||
vec3 colf = texture(tex, texCoord).rgb * weight[0];
|
||||
|
||||
vec3 col;
|
||||
float sumfactor = 0.0;
|
||||
float factor;
|
||||
float f = 1.0 / normpdf(0.0, 0.1);
|
||||
|
||||
col = texture(tex, texCoord + step * 1.5).rgb;
|
||||
factor = normpdf3(col - colf, 0.1) * f * weight[1];
|
||||
sumfactor += factor;
|
||||
fragColor.rgb = factor * col;
|
||||
|
||||
col = texture(tex, texCoord - step * 1.5).rgb;
|
||||
factor = normpdf3(col - colf, 0.1) * f * weight[1];
|
||||
sumfactor += factor;
|
||||
fragColor.rgb += factor * col;
|
||||
|
||||
col = texture(tex, texCoord + step * 1.5).rgb;
|
||||
factor = normpdf3(col - colf, 0.1) * f * weight[2];
|
||||
sumfactor += factor;
|
||||
fragColor.rgb += factor * col;
|
||||
|
||||
col = texture(tex, texCoord - step * 1.5).rgb;
|
||||
factor = normpdf3(col - colf, 0.1) * f * weight[2];
|
||||
sumfactor += factor;
|
||||
fragColor.rgb += factor * col;
|
||||
|
||||
col = texture(tex, texCoord + step * 1.5).rgb;
|
||||
factor = normpdf3(col - colf, 0.1) * f * weight[3];
|
||||
sumfactor += factor;
|
||||
fragColor.rgb += factor * col;
|
||||
|
||||
col = texture(tex, texCoord - step * 1.5).rgb;
|
||||
factor = normpdf3(col - colf, 0.1) * f * weight[3];
|
||||
sumfactor += factor;
|
||||
fragColor.rgb += factor * col;
|
||||
|
||||
col = texture(tex, texCoord + step * 1.5).rgb;
|
||||
factor = normpdf3(col - colf, 0.1) * f * weight[4];
|
||||
sumfactor += factor;
|
||||
fragColor.rgb += factor * col;
|
||||
|
||||
col = texture(tex, texCoord - step * 1.5).rgb;
|
||||
factor = normpdf3(col - colf, 0.1) * f * weight[4];
|
||||
sumfactor += factor;
|
||||
fragColor.rgb += factor * col;
|
||||
|
||||
col = texture(tex, texCoord + step * 1.5).rgb;
|
||||
factor = normpdf3(col - colf, 0.1) * f * weight[5];
|
||||
sumfactor += factor;
|
||||
fragColor.rgb += factor * col;
|
||||
|
||||
col = texture(tex, texCoord - step * 1.5).rgb;
|
||||
factor = normpdf3(col - colf, 0.1) * f * weight[5];
|
||||
sumfactor += factor;
|
||||
fragColor.rgb += factor * col;
|
||||
|
||||
col = texture(tex, texCoord + step * 1.5).rgb;
|
||||
factor = normpdf3(col - colf, 0.1) * f * weight[6];
|
||||
sumfactor += factor;
|
||||
fragColor.rgb += factor * col;
|
||||
|
||||
col = texture(tex, texCoord - step * 1.5).rgb;
|
||||
factor = normpdf3(col - colf, 0.1) * f * weight[6];
|
||||
sumfactor += factor;
|
||||
fragColor.rgb += factor * col;
|
||||
|
||||
col = texture(tex, texCoord + step * 1.5).rgb;
|
||||
factor = normpdf3(col - colf, 0.1) * f * weight[7];
|
||||
sumfactor += factor;
|
||||
fragColor.rgb += factor * col;
|
||||
|
||||
col = texture(tex, texCoord - step * 1.5).rgb;
|
||||
factor = normpdf3(col - colf, 0.1) * f * weight[7];
|
||||
sumfactor += factor;
|
||||
fragColor.rgb += factor * col;
|
||||
|
||||
col = texture(tex, texCoord + step * 1.5).rgb;
|
||||
factor = normpdf3(col - colf, 0.1) * f * weight[8];
|
||||
sumfactor += factor;
|
||||
fragColor.rgb += factor * col;
|
||||
|
||||
col = texture(tex, texCoord - step * 1.5).rgb;
|
||||
factor = normpdf3(col - colf, 0.1) * f * weight[8];
|
||||
sumfactor += factor;
|
||||
fragColor.rgb += factor * col;
|
||||
|
||||
col = texture(tex, texCoord + step * 1.5).rgb;
|
||||
factor = normpdf3(col - colf, 0.1) * f * weight[9];
|
||||
sumfactor += factor;
|
||||
fragColor.rgb += factor * col;
|
||||
|
||||
col = texture(tex, texCoord - step * 1.5).rgb;
|
||||
factor = normpdf3(col - colf, 0.1) * f * weight[9];
|
||||
sumfactor += factor;
|
||||
fragColor.rgb += factor * col;
|
||||
|
||||
fragColor.rgb /= sumfactor;
|
||||
}
|
70
Shaders/blur_bilat_pass/blur_bilat_pass.json
Normal file
70
Shaders/blur_bilat_pass/blur_bilat_pass.json
Normal file
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
"contexts": [
|
||||
{
|
||||
"name": "blur_bilat_pass_x",
|
||||
"color_write_alpha": false,
|
||||
"depth_write": false,
|
||||
"compare_mode": "always",
|
||||
"cull_mode": "none",
|
||||
"links": [
|
||||
{
|
||||
"name": "dir",
|
||||
"link": "_vec2x"
|
||||
},
|
||||
{
|
||||
"name": "screenSize",
|
||||
"link": "_screenSize"
|
||||
}
|
||||
],
|
||||
"texture_params": [],
|
||||
"vertex_shader": "../include/pass.vert.glsl",
|
||||
"fragment_shader": "blur_bilat_pass.frag.glsl"
|
||||
},
|
||||
{
|
||||
"name": "blur_bilat_pass_y",
|
||||
"color_write_alpha": false,
|
||||
"depth_write": false,
|
||||
"compare_mode": "always",
|
||||
"cull_mode": "none",
|
||||
"links": [
|
||||
{
|
||||
"name": "dir",
|
||||
"link": "_vec2y"
|
||||
},
|
||||
{
|
||||
"name": "screenSize",
|
||||
"link": "_screenSize"
|
||||
}
|
||||
],
|
||||
"texture_params": [],
|
||||
"vertex_shader": "../include/pass.vert.glsl",
|
||||
"fragment_shader": "blur_bilat_pass.frag.glsl"
|
||||
},
|
||||
{
|
||||
"name": "blur_bilat_pass_y_blend",
|
||||
"color_write_alpha": false,
|
||||
"depth_write": false,
|
||||
"compare_mode": "always",
|
||||
"cull_mode": "none",
|
||||
"blend_source": "blend_one",
|
||||
"blend_destination": "blend_one",
|
||||
"blend_operation": "add",
|
||||
"alpha_blend_source": "blend_one",
|
||||
"alpha_blend_destination": "blend_one",
|
||||
"alpha_blend_operation": "add",
|
||||
"links": [
|
||||
{
|
||||
"name": "dir",
|
||||
"link": "_vec2y"
|
||||
},
|
||||
{
|
||||
"name": "screenSize",
|
||||
"link": "_screenSize"
|
||||
}
|
||||
],
|
||||
"texture_params": [],
|
||||
"vertex_shader": "../include/pass.vert.glsl",
|
||||
"fragment_shader": "blur_bilat_pass.frag.glsl"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -26,30 +26,28 @@ uniform vec2 lightPlane;
|
|||
in vec4 wvpposition;
|
||||
out vec4 fragColor;
|
||||
|
||||
const float tScat = 0.08;
|
||||
const float tScat = 0.04;
|
||||
const float tAbs = 0.0;
|
||||
const float tExt = 0.0; //tScat + tAbs;
|
||||
// const float stepLen = 1.0 / 11.0;
|
||||
const float stepLen = 1.0 / 80; // Temporary..
|
||||
const float tExt = tScat + tAbs;
|
||||
const float stepLen = 1.0 / 20.0;
|
||||
|
||||
// const float lighting = 0.4;
|
||||
float lighting(vec3 p) {
|
||||
vec3 L = lightPos.xyz - p.xyz;
|
||||
float Ldist = length(lightPos.xyz - p.xyz);
|
||||
vec3 Lnorm = L / Ldist;
|
||||
const float lighting = 0.4;
|
||||
// float lighting(vec3 p) {
|
||||
// vec3 L = lightPos.xyz - p.xyz;
|
||||
// float Ldist = length(lightPos.xyz - p.xyz);
|
||||
// vec3 Lnorm = L / Ldist;
|
||||
|
||||
float linearAtenuation = min(1.0, max(0.0, (lightRadius - Ldist) / lightRadius));
|
||||
return linearAtenuation; //* min(1.0, 1.0 / (Ldist * Ldist));
|
||||
}
|
||||
// float linearAtenuation = min(1.0, max(0.0, (lightRadius - Ldist) / lightRadius));
|
||||
// return linearAtenuation; //* min(1.0, 1.0 / (Ldist * Ldist));
|
||||
// }
|
||||
|
||||
void rayStep(inout vec3 curPos, inout float curOpticalDepth, inout float scatteredLightAmount, float stepLenWorld, vec3 viewVecNorm) {
|
||||
curPos += stepLenWorld * viewVecNorm;
|
||||
float density = 1.0;
|
||||
const float density = 1.0;
|
||||
|
||||
float l1 = lighting(curPos) * stepLenWorld * tScat * density;
|
||||
// float l1 = lighting(curPos) * stepLenWorld * tScat * density;
|
||||
float l1 = lighting * stepLenWorld * tScat * density;
|
||||
curOpticalDepth *= exp(-tExt * stepLenWorld * density);
|
||||
// vec3 lightDir = (lightPos - curPos);
|
||||
// vec3 lightDirNorm = -normalize(lightDir);
|
||||
|
||||
float visibility = 1.0;
|
||||
vec4 lampPos = LWVP * vec4(curPos, 1.0);
|
||||
|
@ -69,7 +67,8 @@ void main() {
|
|||
vec2 texCoord = screenPosition * 0.5 + 0.5;
|
||||
// texCoord += vec2(0.5 / screenSize); // Half pixel offset
|
||||
|
||||
float pixelRayMarchNoise = texture(snoise, texCoord).r;
|
||||
// float pixelRayMarchNoise = texture(snoise, texCoord).r * 2.0 - 1.0;
|
||||
// pixelRayMarchNoise *= 0.2;
|
||||
|
||||
float depth = texture(gbufferD, texCoord).r * 2.0 - 1.0;
|
||||
vec3 worldPos = getPos2(invVP, depth, texCoord);
|
||||
|
@ -88,102 +87,11 @@ void main() {
|
|||
float curOpticalDepth = exp(-tExt * stepLenWorld);
|
||||
float scatteredLightAmount = 0.0;
|
||||
|
||||
curPos += stepLenWorld * viewVecNorm * (2.0 * pixelRayMarchNoise - 1.0);
|
||||
curPos += stepLenWorld * viewVecNorm;// * pixelRayMarchNoise;
|
||||
|
||||
// for(float l = stepLen; l < 0.99999; l += stepLen) {// Do not do the first and last steps
|
||||
// Raw steps for now..
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
for (float l = stepLen; l < 0.99999; l += stepLen) { // Do not do the first and last steps
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
}
|
||||
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
|
||||
|
||||
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
|
||||
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
// }
|
||||
|
||||
// curOpticalDepth
|
||||
fragColor = vec4(vec3(scatteredLightAmount * volumAirColor * normalize(lightColor.rgb) * volumAirTurbidity), 0.0); // * ((1.0 - depth) * 10.0)
|
||||
fragColor = vec4(vec3(scatteredLightAmount * volumAirColor * normalize(lightColor.rgb) * volumAirTurbidity), 1.0);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,8 @@
|
|||
},
|
||||
{
|
||||
"name": "snoise",
|
||||
"link": "_noise8"
|
||||
"link": "_noise8",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
"name": "lightPlane",
|
||||
|
|
|
@ -10,16 +10,16 @@ uniform sampler2D gbufferD;
|
|||
//!uniform sampler2D shadowMap;
|
||||
//!uniform samplerCube shadowMapCube;
|
||||
#endif
|
||||
uniform sampler2D snoise;
|
||||
// uniform sampler2D snoise;
|
||||
|
||||
uniform mat4 LWVP;
|
||||
uniform float shadowsBias;
|
||||
// uniform vec3 lightPos;
|
||||
uniform vec3 lightColor;
|
||||
uniform vec3 eye;
|
||||
uniform vec3 eyeLook;
|
||||
uniform vec2 cameraProj;
|
||||
uniform vec3 lightPos;
|
||||
uniform vec3 lightColor;
|
||||
uniform float lightRadius;
|
||||
uniform float shadowsBias;
|
||||
// uniform float lightRadius;
|
||||
// uniform int lightShadow;
|
||||
// uniform vec2 lightPlane;
|
||||
|
||||
|
@ -29,28 +29,26 @@ out vec4 fragColor;
|
|||
|
||||
const float tScat = 0.08;
|
||||
const float tAbs = 0.0;
|
||||
const float tExt = 0.0; //tScat + tAbs;
|
||||
// const float stepLen = 1.0 / 11.0;
|
||||
const float stepLen = 1.0 / 80; // Temporary..
|
||||
const float tExt = tScat + tAbs;
|
||||
const float stepLen = 1.0 / 20.0;
|
||||
|
||||
// const float lighting = 0.4;
|
||||
float lighting(vec3 p) {
|
||||
vec3 L = lightPos.xyz - p.xyz;
|
||||
float Ldist = length(lightPos.xyz - p.xyz);
|
||||
vec3 Lnorm = L / Ldist;
|
||||
const float lighting = 0.4;
|
||||
// float lighting(vec3 p) {
|
||||
// vec3 L = lightPos.xyz - p.xyz;
|
||||
// float Ldist = length(lightPos.xyz - p.xyz);
|
||||
// vec3 Lnorm = L / Ldist;
|
||||
|
||||
float linearAtenuation = min(1.0, max(0.0, (lightRadius - Ldist) / lightRadius));
|
||||
return linearAtenuation; //* min(1.0, 1.0 / (Ldist * Ldist));
|
||||
}
|
||||
// float linearAtenuation = min(1.0, max(0.0, (lightRadius - Ldist) / lightRadius));
|
||||
// return linearAtenuation; //* min(1.0, 1.0 / (Ldist * Ldist));
|
||||
// }
|
||||
|
||||
void rayStep(inout vec3 curPos, inout float curOpticalDepth, inout float scatteredLightAmount, float stepLenWorld, vec3 viewVecNorm) {
|
||||
curPos += stepLenWorld * viewVecNorm;
|
||||
float density = 1.0;
|
||||
const float density = 1.0;
|
||||
|
||||
float l1 = lighting(curPos) * stepLenWorld * tScat * density;
|
||||
// float l1 = lighting(curPos) * stepLenWorld * tScat * density;
|
||||
float l1 = lighting * stepLenWorld * tScat * density;
|
||||
curOpticalDepth *= exp(-tExt * stepLenWorld * density);
|
||||
// vec3 lightDir = (lightPos - curPos);
|
||||
// vec3 lightDirNorm = -normalize(lightDir);
|
||||
|
||||
float visibility = 1.0;
|
||||
vec4 lampPos = LWVP * vec4(curPos, 1.0);
|
||||
|
@ -58,14 +56,11 @@ void rayStep(inout vec3 curPos, inout float curOpticalDepth, inout float scatter
|
|||
lampPos.xyz /= lampPos.w;
|
||||
visibility = float(texture(shadowMap, lampPos.xy).r > lampPos.z - shadowsBias);
|
||||
}
|
||||
// Cubemap
|
||||
// visibility = float(texture(shadowMapCube, -l).r + shadowsBias > lpToDepth(lp, lightPlane));
|
||||
|
||||
scatteredLightAmount += curOpticalDepth * l1 * visibility;
|
||||
}
|
||||
|
||||
void main() {
|
||||
float pixelRayMarchNoise = texture(snoise, texCoord).r;
|
||||
|
||||
float depth = texture(gbufferD, texCoord).r * 2.0 - 1.0;
|
||||
vec3 worldPos = getPos(eye, eyeLook, viewRay, depth, cameraProj);
|
||||
|
@ -84,102 +79,11 @@ void main() {
|
|||
float curOpticalDepth = exp(-tExt * stepLenWorld);
|
||||
float scatteredLightAmount = 0.0;
|
||||
|
||||
curPos += stepLenWorld * viewVecNorm * (2.0 * pixelRayMarchNoise - 1.0);
|
||||
curPos += stepLenWorld * viewVecNorm;
|
||||
|
||||
// for(float l = stepLen; l < 0.99999; l += stepLen) {// Do not do the first and last steps
|
||||
// Raw steps for now..
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
for (float l = stepLen; l < 0.99999; l += stepLen) { // Do not do the first and last steps
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
}
|
||||
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
|
||||
|
||||
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
|
||||
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
rayStep(curPos, curOpticalDepth, scatteredLightAmount, stepLenWorld, viewVecNorm);
|
||||
// }
|
||||
|
||||
// curOpticalDepth
|
||||
fragColor = vec4(vec3(scatteredLightAmount * volumAirColor * normalize(lightColor.rgb) * volumAirTurbidity), 1.0); // * ((1.0 - depth) * 10.0)
|
||||
fragColor = vec4(vec3(scatteredLightAmount * volumAirColor * normalize(lightColor.rgb) * volumAirTurbidity), 1.0);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
"compare_mode": "always",
|
||||
"cull_mode": "none",
|
||||
"links": [
|
||||
{
|
||||
"name": "invVP",
|
||||
"link": "_inverseViewProjectionMatrix"
|
||||
},
|
||||
{
|
||||
"name": "LWVP",
|
||||
"link": "_biasLampWorldViewProjectionMatrix"
|
||||
|
@ -16,11 +20,13 @@
|
|||
},
|
||||
{
|
||||
"name": "lightPos",
|
||||
"link": "_lampPosition"
|
||||
"link": "_lampPosition",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
"name": "lightRadius",
|
||||
"link": "_lampRadius"
|
||||
"link": "_lampRadius",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
"name": "lightColor",
|
||||
|
@ -28,7 +34,78 @@
|
|||
},
|
||||
{
|
||||
"name": "snoise",
|
||||
"link": "_noise8"
|
||||
"link": "_noise8",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
"name": "lightPlane",
|
||||
"link": "_lampPlane",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
"name": "lightShadow",
|
||||
"link": "_lampCastShadow",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
"name": "eye",
|
||||
"link": "_cameraPosition"
|
||||
},
|
||||
{
|
||||
"name": "eyeLook",
|
||||
"link": "_cameraLook"
|
||||
},
|
||||
{
|
||||
"name": "cameraProj",
|
||||
"link": "_cameraPlaneProj"
|
||||
}
|
||||
],
|
||||
"texture_params": [],
|
||||
"vertex_shader": "../include/pass_viewray.vert.glsl",
|
||||
"fragment_shader": "volumetric_light_quad.frag.glsl"
|
||||
},
|
||||
{
|
||||
"name": "volumetric_light_quad_blend",
|
||||
"depth_write": false,
|
||||
"compare_mode": "always",
|
||||
"cull_mode": "none",
|
||||
"blend_source": "blend_one",
|
||||
"blend_destination": "blend_one",
|
||||
"blend_operation": "add",
|
||||
"alpha_blend_source": "blend_one",
|
||||
"alpha_blend_destination": "blend_one",
|
||||
"alpha_blend_operation": "add",
|
||||
"links": [
|
||||
{
|
||||
"name": "invVP",
|
||||
"link": "_inverseViewProjectionMatrix"
|
||||
},
|
||||
{
|
||||
"name": "LWVP",
|
||||
"link": "_biasLampWorldViewProjectionMatrix"
|
||||
},
|
||||
{
|
||||
"name": "shadowsBias",
|
||||
"link": "_lampShadowsBias"
|
||||
},
|
||||
{
|
||||
"name": "lightPos",
|
||||
"link": "_lampPosition",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
"name": "lightRadius",
|
||||
"link": "_lampRadius",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
"name": "lightColor",
|
||||
"link": "_lampColor"
|
||||
},
|
||||
{
|
||||
"name": "snoise",
|
||||
"link": "_noise8",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
"name": "lightPlane",
|
||||
|
|
|
@ -58,6 +58,23 @@ class RenderPathCreator {
|
|||
path.loadShader("shader_datas/copy_pass/copy_pass");
|
||||
}
|
||||
#end
|
||||
|
||||
#if (rp_supersampling == 4)
|
||||
{
|
||||
var t = new RenderTargetRaw();
|
||||
t.name = "buf";
|
||||
t.width = 0;
|
||||
t.height = 0;
|
||||
t.format = 'RGBA32';
|
||||
t.displayp = getDisplayp();
|
||||
var ss = getSuperSampling();
|
||||
if (ss != 1) t.scale = ss;
|
||||
t.depth_buffer = "main";
|
||||
path.createRenderTarget(t);
|
||||
|
||||
path.loadShader("shader_datas/supersample_resolve/supersample_resolve");
|
||||
}
|
||||
#end
|
||||
}
|
||||
#end
|
||||
|
||||
|
@ -77,6 +94,100 @@ class RenderPathCreator {
|
|||
#end
|
||||
}
|
||||
#end
|
||||
|
||||
#if ((rp_antialiasing == "SMAA") || (rp_antialiasing == "TAA"))
|
||||
{
|
||||
var t = new RenderTargetRaw();
|
||||
t.name = "bufa";
|
||||
t.width = 0;
|
||||
t.height = 0;
|
||||
t.displayp = getDisplayp();
|
||||
t.format = "RGBA32";
|
||||
var ss = getSuperSampling();
|
||||
if (ss != 1) t.scale = ss;
|
||||
path.createRenderTarget(t);
|
||||
}
|
||||
{
|
||||
var t = new RenderTargetRaw();
|
||||
t.name = "bufb";
|
||||
t.width = 0;
|
||||
t.height = 0;
|
||||
t.displayp = getDisplayp();
|
||||
t.format = "RGBA32";
|
||||
var ss = getSuperSampling();
|
||||
if (ss != 1) t.scale = ss;
|
||||
path.createRenderTarget(t);
|
||||
}
|
||||
path.loadShader("shader_datas/smaa_edge_detect/smaa_edge_detect");
|
||||
path.loadShader("shader_datas/smaa_blend_weight/smaa_blend_weight");
|
||||
path.loadShader("shader_datas/smaa_neighborhood_blend/smaa_neighborhood_blend");
|
||||
|
||||
#if (rp_antialiasing == "TAA")
|
||||
{
|
||||
path.loadShader("shader_datas/taa_pass/taa_pass");
|
||||
}
|
||||
#end
|
||||
#end
|
||||
|
||||
#if rp_volumetriclight
|
||||
{
|
||||
path.loadShader("shader_datas/volumetric_light_quad/volumetric_light_quad");
|
||||
path.loadShader("shader_datas/volumetric_light/volumetric_light");
|
||||
path.loadShader("shader_datas/blur_bilat_pass/blur_bilat_pass_x");
|
||||
path.loadShader("shader_datas/blur_bilat_pass/blur_bilat_pass_y_blend");
|
||||
{
|
||||
var t = new RenderTargetRaw();
|
||||
t.name = "bufvola";
|
||||
t.width = 0;
|
||||
t.height = 0;
|
||||
t.displayp = getDisplayp();
|
||||
t.format = "R8";
|
||||
// var ss = getSuperSampling();
|
||||
t.scale = 0.5;
|
||||
path.createRenderTarget(t);
|
||||
}
|
||||
{
|
||||
var t = new RenderTargetRaw();
|
||||
t.name = "bufvolb";
|
||||
t.width = 0;
|
||||
t.height = 0;
|
||||
t.displayp = getDisplayp();
|
||||
t.format = "R8";
|
||||
// var ss = getSuperSampling();
|
||||
t.scale = 0.5;
|
||||
path.createRenderTarget(t);
|
||||
}
|
||||
}
|
||||
#end
|
||||
|
||||
#if rp_bloom
|
||||
{
|
||||
var t = new RenderTargetRaw();
|
||||
t.name = "bloomtex";
|
||||
t.width = 0;
|
||||
t.height = 0;
|
||||
t.scale = 0.25;
|
||||
t.format = getHdrFormat();
|
||||
path.createRenderTarget(t);
|
||||
}
|
||||
|
||||
{
|
||||
var t = new RenderTargetRaw();
|
||||
t.name = "bloomtex2";
|
||||
t.width = 0;
|
||||
t.height = 0;
|
||||
t.scale = 0.25;
|
||||
t.format = getHdrFormat();
|
||||
path.createRenderTarget(t);
|
||||
}
|
||||
|
||||
{
|
||||
path.loadShader("shader_datas/bloom_pass/bloom_pass");
|
||||
path.loadShader("shader_datas/blur_gaus_pass/blur_gaus_pass_x");
|
||||
path.loadShader("shader_datas/blur_gaus_pass/blur_gaus_pass_y");
|
||||
path.loadShader("shader_datas/blur_gaus_pass/blur_gaus_pass_y_blend");
|
||||
}
|
||||
#end
|
||||
}
|
||||
|
||||
static function commands() {
|
||||
|
@ -194,9 +305,92 @@ class RenderPathCreator {
|
|||
|
||||
#if rp_render_to_texture
|
||||
{
|
||||
path.setTarget("");
|
||||
#if rp_volumetriclight
|
||||
{
|
||||
path.setTarget("bufvola");
|
||||
path.bindTarget("_main", "gbufferD");
|
||||
bindShadowMap();
|
||||
if (path.lampIsSun()) {
|
||||
path.drawShader("shader_datas/volumetric_light_quad/volumetric_light_quad");
|
||||
}
|
||||
else {
|
||||
path.drawLampVolume("shader_datas/volumetric_light/volumetric_light");
|
||||
}
|
||||
|
||||
path.setTarget("bufvolb");
|
||||
path.bindTarget("bufvola", "tex");
|
||||
path.drawShader("shader_datas/blur_bilat_pass/blur_bilat_pass_x");
|
||||
|
||||
path.setTarget("lbuf");
|
||||
path.bindTarget("bufvolb", "tex");
|
||||
path.drawShader("shader_datas/blur_bilat_pass/blur_bilat_pass_y_blend");
|
||||
}
|
||||
#end
|
||||
|
||||
#if rp_bloom
|
||||
{
|
||||
path.setTarget("bloomtex");
|
||||
path.bindTarget("lbuf", "tex");
|
||||
path.drawShader("shader_datas/bloom_pass/bloom_pass");
|
||||
|
||||
path.setTarget("bloomtex2");
|
||||
path.bindTarget("bloomtex", "tex");
|
||||
path.drawShader("shader_datas/blur_gaus_pass/blur_gaus_pass_x");
|
||||
|
||||
path.setTarget("bloomtex");
|
||||
path.bindTarget("bloomtex2", "tex");
|
||||
path.drawShader("shader_datas/blur_gaus_pass/blur_gaus_pass_y");
|
||||
|
||||
path.setTarget("bloomtex2");
|
||||
path.bindTarget("bloomtex", "tex");
|
||||
path.drawShader("shader_datas/blur_gaus_pass/blur_gaus_pass_x");
|
||||
|
||||
path.setTarget("bloomtex");
|
||||
path.bindTarget("bloomtex2", "tex");
|
||||
path.drawShader("shader_datas/blur_gaus_pass/blur_gaus_pass_y");
|
||||
|
||||
path.setTarget("bloomtex2");
|
||||
path.bindTarget("bloomtex", "tex");
|
||||
path.drawShader("shader_datas/blur_gaus_pass/blur_gaus_pass_x");
|
||||
|
||||
path.setTarget("bloomtex");
|
||||
path.bindTarget("bloomtex2", "tex");
|
||||
path.drawShader("shader_datas/blur_gaus_pass/blur_gaus_pass_y");
|
||||
|
||||
path.setTarget("bloomtex2");
|
||||
path.bindTarget("bloomtex", "tex");
|
||||
path.drawShader("shader_datas/blur_gaus_pass/blur_gaus_pass_x");
|
||||
|
||||
path.setTarget("lbuf");
|
||||
path.bindTarget("bloomtex2", "tex");
|
||||
path.drawShader("shader_datas/blur_gaus_pass/blur_gaus_pass_y_blend");
|
||||
}
|
||||
#end
|
||||
|
||||
#if (rp_supersampling == 4)
|
||||
var framebuffer = "buf";
|
||||
#else
|
||||
var framebuffer = "";
|
||||
#end
|
||||
|
||||
#if ((rp_antialiasing == "Off") || (rp_antialiasing == "FXAA"))
|
||||
{
|
||||
path.setTarget(framebuffer);
|
||||
}
|
||||
#else
|
||||
{
|
||||
path.setTarget("buf");
|
||||
}
|
||||
#end
|
||||
|
||||
path.bindTarget("lbuf", "tex");
|
||||
|
||||
#if rp_compositordepth
|
||||
{
|
||||
path.bindTarget("_main", "gbufferD");
|
||||
}
|
||||
#end
|
||||
|
||||
#if rp_compositornodes
|
||||
{
|
||||
path.drawShader("shader_datas/compositor_pass/compositor_pass");
|
||||
|
@ -206,6 +400,57 @@ class RenderPathCreator {
|
|||
path.drawShader("shader_datas/copy_pass/copy_pass");
|
||||
}
|
||||
#end
|
||||
|
||||
#if ((rp_antialiasing == "SMAA") || (rp_antialiasing == "TAA"))
|
||||
{
|
||||
path.setTarget("bufa");
|
||||
path.clearTarget(0x00000000);
|
||||
path.bindTarget("lbuf", "colorTex");
|
||||
path.drawShader("shader_datas/smaa_edge_detect/smaa_edge_detect");
|
||||
|
||||
path.setTarget("bufb");
|
||||
path.clearTarget(0x00000000);
|
||||
path.bindTarget("bufa", "edgesTex");
|
||||
path.drawShader("shader_datas/smaa_blend_weight/smaa_blend_weight");
|
||||
|
||||
// #if (rp_antialiasing == "TAA")
|
||||
// path.setTarget("bufa");
|
||||
// #else
|
||||
path.setTarget(framebuffer);
|
||||
// #end
|
||||
path.bindTarget("lbuf", "colorTex");
|
||||
path.bindTarget("bufb", "blendTex");
|
||||
// #if (rp_antialiasing == "TAA")
|
||||
// {
|
||||
// path.bindTarget("gbuffer2", "sveloc");
|
||||
// }
|
||||
// #end
|
||||
path.drawShader("shader_datas/smaa_neighborhood_blend/smaa_neighborhood_blend");
|
||||
|
||||
// #if (rp_antialiasing == "TAA")
|
||||
// {
|
||||
// path.setTarget(framebuffer);
|
||||
// path.bindTarget("bufa", "tex");
|
||||
// path.bindTarget("taa", "tex2");
|
||||
// path.bindTarget("gbuffer2", "sveloc");
|
||||
// path.drawShader("shader_datas/taa_pass/taa_pass");
|
||||
|
||||
// path.setTarget("taa");
|
||||
// path.bindTarget("bufa", "tex");
|
||||
// path.drawShader("shader_datas/copy_pass/copy_pass");
|
||||
// }
|
||||
// #end
|
||||
}
|
||||
#end
|
||||
|
||||
#if (rp_supersampling == 4)
|
||||
{
|
||||
var final = "";
|
||||
path.setTarget(final);
|
||||
path.bindTarget(framebuffer, "tex");
|
||||
path.drawShader("shader_datas/supersample_resolve/supersample_resolve");
|
||||
}
|
||||
#end
|
||||
}
|
||||
#end
|
||||
|
||||
|
@ -425,8 +670,30 @@ class RenderPathCreator {
|
|||
{
|
||||
path.loadShader("shader_datas/volumetric_light_quad/volumetric_light_quad");
|
||||
path.loadShader("shader_datas/volumetric_light/volumetric_light");
|
||||
path.loadShader("shader_datas/blur_edge_pass/blur_edge_pass_x");
|
||||
path.loadShader("shader_datas/blur_edge_pass/blur_edge_pass_y_blend_add");
|
||||
path.loadShader("shader_datas/blur_bilat_pass/blur_bilat_pass_x");
|
||||
path.loadShader("shader_datas/blur_bilat_pass/blur_bilat_pass_y_blend");
|
||||
{
|
||||
var t = new RenderTargetRaw();
|
||||
t.name = "bufvola";
|
||||
t.width = 0;
|
||||
t.height = 0;
|
||||
t.displayp = getDisplayp();
|
||||
t.format = "R8";
|
||||
// var ss = getSuperSampling();
|
||||
t.scale = 0.5;
|
||||
path.createRenderTarget(t);
|
||||
}
|
||||
{
|
||||
var t = new RenderTargetRaw();
|
||||
t.name = "bufvolb";
|
||||
t.width = 0;
|
||||
t.height = 0;
|
||||
t.displayp = getDisplayp();
|
||||
t.format = "R8";
|
||||
// var ss = getSuperSampling();
|
||||
t.scale = 0.5;
|
||||
path.createRenderTarget(t);
|
||||
}
|
||||
}
|
||||
#end
|
||||
|
||||
|
@ -780,7 +1047,7 @@ class RenderPathCreator {
|
|||
|
||||
#if rp_volumetriclight
|
||||
{
|
||||
path.setTarget("buf");
|
||||
path.setTarget("bufvola");
|
||||
path.bindTarget("_main", "gbufferD");
|
||||
bindShadowMap();
|
||||
if (path.lampIsSun()) {
|
||||
|
@ -789,15 +1056,14 @@ class RenderPathCreator {
|
|||
else {
|
||||
path.drawLampVolume("shader_datas/volumetric_light/volumetric_light");
|
||||
}
|
||||
path.setTarget("gbuffer1");
|
||||
path.bindTarget("buf", "tex");
|
||||
path.bindTarget("gbuffer0", "gbuffer0");
|
||||
path.drawShader("shader_datas/blur_edge_pass/blur_edge_pass_x");
|
||||
|
||||
path.setTarget("bufvolb");
|
||||
path.bindTarget("bufvola", "tex");
|
||||
path.drawShader("shader_datas/blur_bilat_pass/blur_bilat_pass_x");
|
||||
|
||||
path.setTarget("tex");
|
||||
path.bindTarget("gbuffer1", "tex");
|
||||
path.bindTarget("gbuffer0", "gbuffer0");
|
||||
path.drawShader("shader_datas/blur_edge_pass/blur_edge_pass_y_blend_add");
|
||||
path.bindTarget("bufvolb", "tex");
|
||||
path.drawShader("shader_datas/blur_bilat_pass/blur_bilat_pass_y_blend");
|
||||
}
|
||||
#end
|
||||
}
|
||||
|
|
|
@ -273,7 +273,7 @@ def build():
|
|||
assets.add_khafile_def('rp_volumetriclight')
|
||||
assets.add_shader_pass('volumetric_light_quad')
|
||||
assets.add_shader_pass('volumetric_light')
|
||||
assets.add_shader_pass('blur_edge_pass')
|
||||
assets.add_shader_pass('blur_bilat_pass')
|
||||
|
||||
if rpdat.rp_decals:
|
||||
assets.add_khafile_def('rp_decals')
|
||||
|
|
|
@ -952,10 +952,10 @@ class ArmRenderPathPanel(bpy.types.Panel):
|
|||
if wrd.arm_rplist_index >= 0 and len(wrd.arm_rplist) > 0:
|
||||
rpdat = wrd.arm_rplist[wrd.arm_rplist_index]
|
||||
if len(arm.api.drivers) > 0:
|
||||
if len(rpdat.rp_driver_list) == 0:
|
||||
rpdat.rp_driver_list.add().name = 'Armory'
|
||||
for d in arm.api.drivers:
|
||||
rpdat.rp_driver_list.add().name = d['driver_name']
|
||||
rpdat.rp_driver_list.clear()
|
||||
rpdat.rp_driver_list.add().name = 'Armory'
|
||||
for d in arm.api.drivers:
|
||||
rpdat.rp_driver_list.add().name = arm.api.drivers[d]['driver_name']
|
||||
layout.prop_search(rpdat, "rp_driver", rpdat, "rp_driver_list", "Driver")
|
||||
layout.separator()
|
||||
if rpdat.rp_driver != 'Armory' and arm.api.drivers[rpdat.rp_driver]['draw_props'] != None:
|
||||
|
|
Loading…
Reference in a new issue