Shader fixes
This commit is contained in:
parent
c7f9d50e55
commit
835792f7fc
|
@ -12,7 +12,8 @@ uniform vec2 dirInv; // texStep
|
|||
in vec2 texCoord;
|
||||
out float fragColor;
|
||||
|
||||
const float blurWeights[5] = float[] (0.227027, 0.1945946, 0.1216216, 0.054054, 0.016216);
|
||||
// const float blurWeights[5] = float[] (0.227027, 0.1945946, 0.1216216, 0.054054, 0.016216);
|
||||
const float blurWeights[10] = float[] (0.132572, 0.125472, 0.106373, 0.08078, 0.05495, 0.033482, 0.018275, 0.008934, 0.003912, 0.001535);
|
||||
const float discardThreshold = 0.95;
|
||||
|
||||
void main() {
|
||||
|
@ -21,8 +22,8 @@ void main() {
|
|||
fragColor = textureLod(tex, texCoord, 0.0).r * blurWeights[0];
|
||||
float weight = blurWeights[0];
|
||||
|
||||
for (int i = 1; i < 5; ++i) {
|
||||
float posadd = i + 0.5;
|
||||
for (int i = 1; i < 8; ++i) {
|
||||
float posadd = i;// + 0.5;
|
||||
|
||||
vec3 nor2 = getNor(textureLod(gbuffer0, texCoord + i * dirInv, 0.0).rg);
|
||||
float influenceFactor = step(discardThreshold, dot(nor2, nor));
|
||||
|
|
|
@ -255,7 +255,8 @@ void main() {
|
|||
#endif
|
||||
|
||||
#ifdef _VoxelGITemporal
|
||||
envl.rgb *= 1.0 - (traceAO(voxpos, n, voxels) * voxelBlend + traceAO(voxpos, n, voxelsLast) * (1.0 - voxelBlend));
|
||||
envl.rgb *= 1.0 - (traceAO(voxpos, n, voxels) * voxelBlend +
|
||||
traceAO(voxpos, n, voxelsLast) * (1.0 - voxelBlend));
|
||||
#else
|
||||
envl.rgb *= 1.0 - traceAO(voxpos, n, voxels);
|
||||
#endif
|
||||
|
|
|
@ -11,8 +11,8 @@ out float fragColor;
|
|||
|
||||
void main() {
|
||||
float d0 = textureLod(texdepth, texCoord, 0.0).r;
|
||||
float d1 = textureLod(texdepth, texCoord + vec2(1.0, 0.0) * screenSizeInv, 0.0).r;
|
||||
float d2 = textureLod(texdepth, texCoord + vec2(0.0, 1.0) * screenSizeInv, 0.0).r;
|
||||
float d3 = textureLod(texdepth, texCoord + vec2(1.0, 1.0) * screenSizeInv, 0.0).r;
|
||||
float d1 = textureLod(texdepth, texCoord + vec2(screenSizeInv.x, 0.0), 0.0).r;
|
||||
float d2 = textureLod(texdepth, texCoord + vec2(0.0, screenSizeInv.y), 0.0).r;
|
||||
float d3 = textureLod(texdepth, texCoord + vec2(screenSizeInv.x, screenSizeInv.y), 0.0).r;
|
||||
fragColor = max(max(d0, d1), max(d2, d3));
|
||||
}
|
||||
|
|
|
@ -1,54 +1,16 @@
|
|||
// Alchemy AO
|
||||
// Compute kernel
|
||||
// var kernel:Array<Float> = [];
|
||||
// var kernelSize = 8;
|
||||
// for (i in 0...kernelSize) {
|
||||
// var angle = i / kernelSize;
|
||||
// angle *= 3.1415926535 * 2.0;
|
||||
// var x1 = Math.cos(angle);
|
||||
// var y1 = Math.sin(angle);
|
||||
// x1 = Std.int(x1 * 10000000) / 10000000;
|
||||
// y1 = Std.int(y1 * 10000000) / 10000000;
|
||||
// trace(x1, y1);
|
||||
// }
|
||||
// Alchemy AO / Scalable Ambient Obscurance
|
||||
#version 450
|
||||
|
||||
#include "compiled.inc"
|
||||
#include "std/gbuffer.glsl"
|
||||
|
||||
const int kernelSize = 8;
|
||||
const vec2 kernel[8] = vec2[] (
|
||||
vec2(1.0, 0.0),
|
||||
vec2(0.7071067,0.7071067),
|
||||
vec2(0.0, 1.0),
|
||||
vec2(-0.7071067,0.7071067),
|
||||
vec2(-1.0, 0.0),
|
||||
vec2(-0.7071067,-0.7071067),
|
||||
vec2(0.0, -1.0),
|
||||
vec2(-0.7071067,-0.7071067)
|
||||
);
|
||||
// const vec2 kernel[12] = vec2[] (
|
||||
// vec2(1.0, 0.0),
|
||||
// vec2(0.8660254, 0.4999999),
|
||||
// vec2(0.5, 0.8660254),
|
||||
// vec2(0.0, 1.0),
|
||||
// vec2(-0.4999999, 0.8660254),
|
||||
// vec2(-0.8660254, 0.5),
|
||||
// vec2(-1.0, 0.0),
|
||||
// vec2(-0.8660254, -0.4999999),
|
||||
// vec2(-0.5, -0.8660254),
|
||||
// vec2(0.0, -1.0),
|
||||
// vec2(0.4999999, -0.8660254),
|
||||
// vec2(0.8660254, -0.5)
|
||||
// );
|
||||
|
||||
uniform sampler2D gbufferD;
|
||||
uniform sampler2D gbuffer0;
|
||||
uniform sampler2D snoise;
|
||||
uniform vec2 cameraProj;
|
||||
uniform vec3 eye;
|
||||
uniform vec3 eyeLook;
|
||||
uniform vec2 screenSize;
|
||||
uniform vec2 aspectRatio;
|
||||
uniform mat4 invVP;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec3 viewRay;
|
||||
|
@ -66,29 +28,25 @@ void main() {
|
|||
|
||||
vec3 vray = normalize(viewRay);
|
||||
vec3 currentPos = getPosNoEye(eyeLook, vray, depth, cameraProj);
|
||||
// vec3 currentPos = getPos2NoEye(eye, invVP, depth, texCoord);
|
||||
float currentDistance = length(currentPos);
|
||||
float currentDistanceA = currentDistance * 0.002;
|
||||
float currentDistanceB = min(currentDistance * 0.25, 1.0);
|
||||
|
||||
vec2 randomVec = textureLod(snoise, (texCoord * screenSize) / 8.0, 0.0).xy * 2.0 - 1.0;
|
||||
mat2 rotMat = mat2(vec2(cos(randomVec.x * PI), -sin(randomVec.x * PI)),
|
||||
vec2(sin(randomVec.x * PI), cos(randomVec.x * PI)));
|
||||
float radius = ssaoSize * randomVec.y;
|
||||
float currentDistanceA = currentDistance * ssaoScale * (1.0 / ssaoRadius);
|
||||
float currentDistanceB = currentDistance * 0.0005;
|
||||
ivec2 px = ivec2(texCoord * screenSize);
|
||||
float phi = (3 * px.x ^ px.y + px.x * px.y) * 10;
|
||||
|
||||
fragColor = 0;
|
||||
for (int i = 0; i < kernelSize; ++i) {
|
||||
vec2 k = ((rotMat * kernel[i] * aspectRatio) / currentDistance) * radius;
|
||||
const int samples = 8;
|
||||
const float samplesInv = PI2 * (1.0 / samples);
|
||||
for (int i = 0; i < samples; ++i) {
|
||||
float theta = samplesInv * (i + 0.5) + phi;
|
||||
vec2 k = vec2(cos(theta), sin(theta)) / currentDistanceA;
|
||||
depth = textureLod(gbufferD, texCoord + k, 0.0).r * 2.0 - 1.0;
|
||||
vec3 pos = getPosNoEye(eyeLook, vray, depth, cameraProj) - currentPos;
|
||||
|
||||
float angle = dot(pos, n);
|
||||
angle *= step(0.1, angle / length(pos)); // Fix intersect
|
||||
angle -= currentDistanceA;
|
||||
angle = max(0.0, angle);
|
||||
angle /= dot(pos, pos) / currentDistanceB + 0.015; // Fix darkening
|
||||
fragColor += angle;
|
||||
// vec3 pos = getPosNoEye(eyeLook, vray, depth, cameraProj) - currentPos;
|
||||
vec3 pos = getPos2NoEye(eye, invVP, depth, texCoord + k) - currentPos;
|
||||
fragColor += max(0, dot(pos, n) - currentDistanceB) / (dot(pos, pos) + 0.015);
|
||||
}
|
||||
|
||||
fragColor *= ssaoStrength / kernelSize;
|
||||
fragColor *= (ssaoStrength * 0.3) / samples;
|
||||
fragColor = 1.0 - fragColor;
|
||||
}
|
||||
|
|
|
@ -6,10 +6,6 @@
|
|||
"compare_mode": "always",
|
||||
"cull_mode": "none",
|
||||
"links": [
|
||||
{
|
||||
"name": "snoise",
|
||||
"link": "_noise8"
|
||||
},
|
||||
{
|
||||
"name": "invVP",
|
||||
"link": "_inverseViewProjectionMatrix"
|
||||
|
@ -29,10 +25,6 @@
|
|||
{
|
||||
"name": "screenSize",
|
||||
"link": "_screenSize"
|
||||
},
|
||||
{
|
||||
"name": "aspectRatio",
|
||||
"link": "_aspectRatio"
|
||||
}
|
||||
],
|
||||
"texture_params": [],
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
// Alchemy AO / Scalable Ambient Obscurance
|
||||
#version 450
|
||||
|
||||
#include "compiled.inc"
|
||||
#include "std/gbuffer.glsl"
|
||||
|
||||
uniform sampler2D gbufferD;
|
||||
uniform sampler2D gbuffer0;
|
||||
uniform vec2 cameraProj;
|
||||
uniform vec3 eye;
|
||||
uniform vec3 eyeLook;
|
||||
uniform vec2 screenSize;
|
||||
uniform mat4 invVP;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec3 viewRay;
|
||||
out float fragColor;
|
||||
|
||||
void main() {
|
||||
float depth = textureLod(gbufferD, texCoord, 0.0).r * 2.0 - 1.0;
|
||||
if (depth == 1.0) { fragColor = 1.0; return; }
|
||||
|
||||
vec2 enc = textureLod(gbuffer0, texCoord, 0.0).rg;
|
||||
vec3 n;
|
||||
n.z = 1.0 - abs(enc.x) - abs(enc.y);
|
||||
n.xy = n.z >= 0.0 ? enc.xy : octahedronWrap(enc.xy);
|
||||
n = normalize(n);
|
||||
|
||||
vec3 vray = normalize(viewRay);
|
||||
vec3 currentPos = getPosNoEye(eyeLook, vray, depth, cameraProj);
|
||||
// vec3 currentPos = getPos2NoEye(eye, invVP, depth, texCoord);
|
||||
float currentDistance = length(currentPos);
|
||||
float currentDistanceA = currentDistance * ssaoScale * (1.0 / ssaoRadius);
|
||||
float currentDistanceB = currentDistance * 0.0005;
|
||||
float currentDistanceC = currentDistance * 5.0;
|
||||
ivec2 px = ivec2(texCoord * screenSize);
|
||||
float phi = (3 * px.x ^ px.y + px.x * px.y) * 10;
|
||||
|
||||
fragColor = 0;
|
||||
const int samples = 8;
|
||||
const float samplesInv = PI2 * (1.0 / samples);
|
||||
for (int i = 0; i < samples; ++i) {
|
||||
float theta = samplesInv * (i + 0.5) + phi;
|
||||
vec2 k = vec2(cos(theta), sin(theta)) / currentDistanceA;
|
||||
depth = textureLod(gbufferD, texCoord + k, 0.0).r * 2.0 - 1.0;
|
||||
// vec3 pos = getPosNoEye(eyeLook, vray, depth, cameraProj) - currentPos;
|
||||
vec3 pos = getPos2NoEye(eye, invVP, depth, texCoord + k) - currentPos;
|
||||
fragColor += (max(0, dot(pos, n) - currentDistanceB) / (dot(pos, pos) + 0.015));
|
||||
}
|
||||
|
||||
for (int i = 0; i < samples; ++i) {
|
||||
float theta = samplesInv * (i + 0.5) + phi;
|
||||
vec2 k = vec2(cos(theta), sin(theta)) / currentDistanceC;
|
||||
depth = textureLod(gbufferD, texCoord + k, 0.0).r * 2.0 - 1.0;
|
||||
vec3 pos = getPos2NoEye(eye, invVP, depth, texCoord + k) - currentPos;
|
||||
fragColor += (max(0, dot(pos, n) - currentDistanceB) / (dot(pos, pos) + 0.015));
|
||||
}
|
||||
|
||||
fragColor *= (ssaoStrength * 0.4) / samples;
|
||||
fragColor = 1.0 - fragColor;
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"contexts": [
|
||||
{
|
||||
"name": "ssgi_pass",
|
||||
"depth_write": false,
|
||||
"compare_mode": "always",
|
||||
"cull_mode": "none",
|
||||
"links": [
|
||||
{
|
||||
"name": "invVP",
|
||||
"link": "_inverseViewProjectionMatrix"
|
||||
},
|
||||
{
|
||||
"name": "eye",
|
||||
"link": "_cameraPosition"
|
||||
},
|
||||
{
|
||||
"name": "eyeLook",
|
||||
"link": "_cameraLook"
|
||||
},
|
||||
{
|
||||
"name": "cameraProj",
|
||||
"link": "_cameraPlaneProj"
|
||||
},
|
||||
{
|
||||
"name": "screenSize",
|
||||
"link": "_screenSize"
|
||||
}
|
||||
],
|
||||
"texture_params": [],
|
||||
"vertex_shader": "../include/pass_viewray.vert.glsl",
|
||||
"fragment_shader": "ssgi_pass.frag.glsl"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -6,11 +6,11 @@
|
|||
|
||||
uniform sampler2D gbufferD;
|
||||
uniform sampler2D gbuffer0; // Normal
|
||||
#ifdef _RTGI
|
||||
uniform sampler2D gbuffer1; // Basecol
|
||||
#endif
|
||||
// #ifdef _RTGI
|
||||
// uniform sampler2D gbuffer1; // Basecol
|
||||
// #endif
|
||||
uniform mat4 P;
|
||||
uniform mat4 tiV;
|
||||
uniform mat3 V3;
|
||||
|
||||
uniform vec2 cameraProj;
|
||||
|
||||
|
@ -28,7 +28,6 @@ out float fragColor;
|
|||
vec3 hitCoord;
|
||||
vec2 coord;
|
||||
float depth;
|
||||
float occ = 0.0;
|
||||
// #ifdef _RTGI
|
||||
// vec3 col = vec3(0.0);
|
||||
// #endif
|
||||
|
@ -53,17 +52,18 @@ float getDeltaDepth(vec3 hitCoord) {
|
|||
|
||||
void rayCast(vec3 dir) {
|
||||
hitCoord = vpos;
|
||||
dir *= ssgiRayStep;
|
||||
dir *= ssgiRayStep * 2;
|
||||
float dist = 0.1;
|
||||
for (int i = 0; i < ssgiMaxSteps; i++) {
|
||||
hitCoord += dir;
|
||||
float delta = getDeltaDepth(hitCoord);
|
||||
if (delta > 0.0 && delta < 0.2) {
|
||||
// if (delta > 0.0 && delta < 0.2) {
|
||||
if (delta > 0.0) {
|
||||
dist = distance(vpos, hitCoord);
|
||||
break;
|
||||
}
|
||||
}
|
||||
occ += dist;
|
||||
fragColor += dist;
|
||||
// #ifdef _RTGI
|
||||
// col += textureLod(gbuffer1, coord, 0.0).rgb * ((ssgiRayStep * ssgiMaxSteps) - dist);
|
||||
// #endif
|
||||
|
@ -77,39 +77,32 @@ vec3 tangent(const vec3 n) {
|
|||
}
|
||||
|
||||
void main() {
|
||||
fragColor = 0;
|
||||
vec4 g0 = textureLod(gbuffer0, texCoord, 0.0);
|
||||
float d = textureLod(gbufferD, texCoord, 0.0).r * 2.0 - 1.0;
|
||||
|
||||
vec2 enc = g0.rg;
|
||||
vec4 n;
|
||||
vec3 n;
|
||||
n.z = 1.0 - abs(enc.x) - abs(enc.y);
|
||||
n.xy = n.z >= 0.0 ? enc.xy : octahedronWrap(enc.xy);
|
||||
n.w = 1.0;
|
||||
n = tiV * n;
|
||||
n.xyz = normalize(n.xyz);
|
||||
n = normalize(V3 * n);
|
||||
|
||||
vpos = getPosView(viewRay, d, cameraProj);
|
||||
|
||||
rayCast(n.xyz);
|
||||
vec3 o1 = normalize(tangent(n.xyz));
|
||||
vec3 o2 = normalize(cross(o1, n.xyz));
|
||||
rayCast(n);
|
||||
vec3 o1 = normalize(tangent(n));
|
||||
vec3 o2 = (cross(o1, n));
|
||||
vec3 c1 = 0.5f * (o1 + o2);
|
||||
vec3 c2 = 0.5f * (o1 - o2);
|
||||
rayCast(mix(n.xyz, o1, angleMix));
|
||||
rayCast(mix(n.xyz, o2, angleMix));
|
||||
rayCast(mix(n.xyz, -c1, angleMix));
|
||||
rayCast(mix(n.xyz, -c2, angleMix));
|
||||
rayCast(mix(n, o1, angleMix));
|
||||
rayCast(mix(n, o2, angleMix));
|
||||
rayCast(mix(n, -c1, angleMix));
|
||||
rayCast(mix(n, -c2, angleMix));
|
||||
|
||||
#ifdef _SSGICone9
|
||||
rayCast(mix(n.xyz, -o1, angleMix));
|
||||
rayCast(mix(n.xyz, -o2, angleMix));
|
||||
rayCast(mix(n.xyz, c1, angleMix));
|
||||
rayCast(mix(n.xyz, c2, angleMix));
|
||||
rayCast(mix(n, -o1, angleMix));
|
||||
rayCast(mix(n, -o2, angleMix));
|
||||
rayCast(mix(n, c1, angleMix));
|
||||
rayCast(mix(n, c2, angleMix));
|
||||
#endif
|
||||
|
||||
// #ifdef _RTGI
|
||||
// fragColor.rgb = vec3((occ + col * occ) * strength);
|
||||
// #else
|
||||
fragColor = occ * strength;
|
||||
// #endif
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
"link": "_projectionMatrix"
|
||||
},
|
||||
{
|
||||
"name": "tiV",
|
||||
"link": "_transposeInverseViewMatrix"
|
||||
"name": "V3",
|
||||
"link": "_viewMatrix3"
|
||||
},
|
||||
{
|
||||
"name": "invP",
|
||||
|
|
|
@ -153,16 +153,22 @@ float traceAO(const vec3 origin, const vec3 normal, sampler3D voxels) {
|
|||
vec3 o2 = normalize(cross(o1, normal));
|
||||
vec3 c1 = 0.5f * (o1 + o2);
|
||||
vec3 c2 = 0.5f * (o1 - o2);
|
||||
|
||||
#ifdef HLSL
|
||||
const float factor = voxelgiOcc * 0.97;
|
||||
#else
|
||||
const float factor = voxelgiOcc * 0.97;
|
||||
#endif
|
||||
|
||||
#ifdef _VoxelCones1
|
||||
return traceConeAO(voxels, origin, normal, aperture, MAX_DISTANCE) * voxelgiOcc;
|
||||
return traceConeAO(voxels, origin, normal, aperture, MAX_DISTANCE) * factor;
|
||||
#endif
|
||||
|
||||
#ifdef _VoxelCones3
|
||||
float col = traceConeAO(voxels, origin, normal, aperture, MAX_DISTANCE);
|
||||
col += traceConeAO(voxels, origin, mix(normal, o1, angleMix), aperture, MAX_DISTANCE);
|
||||
col += traceConeAO(voxels, origin, mix(normal, -c2, angleMix), aperture, MAX_DISTANCE);
|
||||
return (col / 3.0) * voxelgiOcc;
|
||||
return (col / 3.0) * factor;
|
||||
#endif
|
||||
|
||||
#ifdef _VoxelCones5
|
||||
|
@ -171,7 +177,7 @@ float traceAO(const vec3 origin, const vec3 normal, sampler3D voxels) {
|
|||
col += traceConeAO(voxels, origin, mix(normal, o2, angleMix), aperture, MAX_DISTANCE);
|
||||
col += traceConeAO(voxels, origin, mix(normal, -c1, angleMix), aperture, MAX_DISTANCE);
|
||||
col += traceConeAO(voxels, origin, mix(normal, -c2, angleMix), aperture, MAX_DISTANCE);
|
||||
return (col / 5.0) * voxelgiOcc;
|
||||
return (col / 5.0) * factor;
|
||||
#endif
|
||||
|
||||
#ifdef _VoxelCones9
|
||||
|
@ -185,7 +191,7 @@ float traceAO(const vec3 origin, const vec3 normal, sampler3D voxels) {
|
|||
col += traceConeAO(voxels, origin, mix(normal, -o2, angleMix), aperture, MAX_DISTANCE);
|
||||
col += traceConeAO(voxels, origin, mix(normal, c1, angleMix), aperture, MAX_DISTANCE);
|
||||
col += traceConeAO(voxels, origin, mix(normal, c2, angleMix), aperture, MAX_DISTANCE);
|
||||
return (col / 9.0) * voxelgiOcc;
|
||||
return (col / 9.0) * factor;
|
||||
#endif
|
||||
|
||||
return 0.0;
|
||||
|
|
|
@ -154,8 +154,8 @@ class RenderPathDeferred {
|
|||
#if ((rp_ssgi == "RTGI") || (rp_ssgi == "RTAO"))
|
||||
{
|
||||
path.loadShader("shader_datas/ssgi_pass/ssgi_pass");
|
||||
path.loadShader("shader_datas/ssgi_blur_pass/ssgi_blur_pass_x");
|
||||
path.loadShader("shader_datas/ssgi_blur_pass/ssgi_blur_pass_y");
|
||||
path.loadShader("shader_datas/blur_edge_pass/blur_edge_pass_x");
|
||||
path.loadShader("shader_datas/blur_edge_pass/blur_edge_pass_y");
|
||||
}
|
||||
#elseif (rp_ssgi == "SSAO")
|
||||
{
|
||||
|
@ -490,7 +490,7 @@ class RenderPathDeferred {
|
|||
}
|
||||
#end
|
||||
|
||||
#if (rp_ssr || (rp_ssgi != "Off"))
|
||||
#if (rp_ssr_half || rp_ssgi_half)
|
||||
path.setTarget("half");
|
||||
path.bindTarget("_main", "texdepth");
|
||||
path.drawShader("shader_datas/downsample_depth/downsample_depth");
|
||||
|
@ -500,29 +500,33 @@ class RenderPathDeferred {
|
|||
{
|
||||
if (armory.data.Config.raw.rp_ssgi != false) {
|
||||
path.setTarget("singlea");
|
||||
#if rp_ssgi_half
|
||||
path.bindTarget("half", "gbufferD");
|
||||
path.bindTarget("gbuffer0", "gbuffer0");
|
||||
#if (rp_ssgi == "RTGI")
|
||||
path.bindTarget("gbuffer1", "gbuffer1");
|
||||
#else
|
||||
path.bindTarget("_main", "gbufferD");
|
||||
#end
|
||||
path.bindTarget("gbuffer0", "gbuffer0");
|
||||
// #if (rp_ssgi == "RTGI")
|
||||
// path.bindTarget("gbuffer1", "gbuffer1");
|
||||
// #end
|
||||
path.drawShader("shader_datas/ssgi_pass/ssgi_pass");
|
||||
|
||||
path.setTarget("singleb");
|
||||
path.bindTarget("gbuffer0", "gbuffer0");
|
||||
path.bindTarget("singlea", "tex");
|
||||
path.drawShader("shader_datas/ssgi_blur_pass/ssgi_blur_pass_x");
|
||||
path.bindTarget("gbuffer0", "gbuffer0");
|
||||
path.drawShader("shader_datas/blur_edge_pass/blur_edge_pass_x");
|
||||
|
||||
path.setTarget("singlea");
|
||||
path.bindTarget("gbuffer0", "gbuffer0");
|
||||
path.bindTarget("singleb", "tex");
|
||||
path.drawShader("shader_datas/ssgi_blur_pass/ssgi_blur_pass_y");
|
||||
path.bindTarget("gbuffer0", "gbuffer0");
|
||||
path.drawShader("shader_datas/blur_edge_pass/blur_edge_pass_y");
|
||||
}
|
||||
}
|
||||
#elseif (rp_ssgi == "SSAO")
|
||||
{
|
||||
if (armory.data.Config.raw.rp_ssgi != false) {
|
||||
path.setTarget("singlea");
|
||||
path.bindTarget("half", "gbufferD");
|
||||
path.bindTarget("_main", "gbufferD");
|
||||
path.bindTarget("gbuffer0", "gbuffer0");
|
||||
path.drawShader("shader_datas/ssao_pass/ssao_pass");
|
||||
|
||||
|
@ -808,7 +812,11 @@ class RenderPathDeferred {
|
|||
|
||||
path.setTarget(targeta);
|
||||
path.bindTarget("tex", "tex");
|
||||
#if rp_ssr_half
|
||||
path.bindTarget("half", "gbufferD");
|
||||
#else
|
||||
path.bindTarget("_main", "gbufferD");
|
||||
#end
|
||||
path.bindTarget("gbuffer0", "gbuffer0");
|
||||
path.bindTarget("gbuffer1", "gbuffer1");
|
||||
path.drawShader("shader_datas/ssr_pass/ssr_pass");
|
||||
|
|
|
@ -257,11 +257,9 @@ def build():
|
|||
if rpdat.rp_ssgi == 'SSAO':
|
||||
assets.add_shader_pass('ssao_pass')
|
||||
assets.add_shader_pass('blur_edge_pass')
|
||||
assets.add(assets_path + 'noise8.png')
|
||||
assets.add_embedded_data('noise8.png')
|
||||
else:
|
||||
assets.add_shader_pass('ssgi_pass')
|
||||
assets.add_shader_pass('ssgi_blur_pass')
|
||||
assets.add_shader_pass('blur_edge_pass')
|
||||
if rpdat.arm_ssgi_half_res:
|
||||
assets.add_khafile_def('rp_ssgi_half')
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ def make_gi(context_id):
|
|||
return con_voxel
|
||||
|
||||
def make_ao(context_id):
|
||||
con_voxel = mat_state.data.add_context({ 'name': context_id, 'depth_write': False, 'compare_mode': 'always', 'cull_mode': 'none', 'color_write_red': False, 'color_write_green': False, 'color_write_blue': False, 'color_write_alpha': False, 'conservative_raster': True })
|
||||
con_voxel = mat_state.data.add_context({ 'name': context_id, 'depth_write': False, 'compare_mode': 'always', 'cull_mode': 'none', 'color_write_red': False, 'color_write_green': False, 'color_write_blue': False, 'color_write_alpha': False, 'conservative_raster': False })
|
||||
wrd = bpy.data.worlds['Arm']
|
||||
rpdat = arm.utils.get_rp()
|
||||
|
||||
|
@ -267,7 +267,7 @@ def make_ao(context_id):
|
|||
frag.write('struct SPIRV_Cross_Input { float3 wpos : TEXCOORD0; };')
|
||||
frag.write('struct SPIRV_Cross_Output { float4 FragColor : SV_TARGET0; };')
|
||||
frag.write('void main(SPIRV_Cross_Input stage_input) {')
|
||||
frag.write(' if (abs(stage_input.wpos.x) > ' + rpdat.rp_voxelgi_resolution_z + ' || abs(stage_input.wpos.y) > 1 || abs(stage_input.wpos.z) > 1) return;')
|
||||
frag.write(' if (abs(stage_input.wpos.z) > ' + rpdat.rp_voxelgi_resolution_z + ' || abs(stage_input.wpos.x) > 1 || abs(stage_input.wpos.y) > 1) return;')
|
||||
voxRes = str(rpdat.rp_voxelgi_resolution)
|
||||
voxResZ = str(int(int(rpdat.rp_voxelgi_resolution) * float(rpdat.rp_voxelgi_resolution_z)))
|
||||
frag.write(' voxels[int3(' + voxRes + ', ' + voxRes + ', ' + voxResZ + ') * (stage_input.wpos * 0.5 + 0.5)] = 1.0;')
|
||||
|
|
|
@ -465,6 +465,7 @@ class ArmRPListItem(bpy.types.PropertyGroup):
|
|||
arm_ocean_freq = FloatProperty(name="Freq", default=0.16, update=assets.invalidate_shader_cache)
|
||||
arm_ocean_fade = FloatProperty(name="Fade", default=1.8, update=assets.invalidate_shader_cache)
|
||||
arm_ssgi_strength = FloatProperty(name="Strength", default=1.0, update=assets.invalidate_shader_cache)
|
||||
arm_ssgi_radius = FloatProperty(name="Radius", default=1.0, update=assets.invalidate_shader_cache)
|
||||
arm_ssgi_step = FloatProperty(name="Step", default=2.0, update=assets.invalidate_shader_cache)
|
||||
arm_ssgi_max_steps = IntProperty(name="Max Steps", default=8, update=assets.invalidate_shader_cache)
|
||||
arm_ssgi_rays = EnumProperty(
|
||||
|
|
|
@ -896,7 +896,7 @@ class ArmRenderPathPanel(bpy.types.Panel):
|
|||
self.prop(row, rpdat, 'arm_ssgi_half_res')
|
||||
self.prop(col, rpdat, 'arm_ssgi_rays')
|
||||
row = self.row(col, align=True, alignment='EXPAND')
|
||||
self.prop(row, rpdat, 'arm_ssgi_step')
|
||||
self.prop(row, rpdat, 'arm_ssgi_radius')
|
||||
self.prop(row, rpdat, 'arm_ssgi_strength')
|
||||
self.prop(col, rpdat, 'arm_ssgi_max_steps')
|
||||
self.separator(box)
|
||||
|
|
|
@ -483,11 +483,13 @@ const vec3 seaBaseColor = vec3(""" + str(round(rpdat.arm_ocean_base_color[0] * 1
|
|||
const vec3 seaWaterColor = vec3(""" + str(round(rpdat.arm_ocean_water_color[0] * 100) / 100) + """, """ + str(round(rpdat.arm_ocean_water_color[1] * 100) / 100) + """, """ + str(round(rpdat.arm_ocean_water_color[2] * 100) / 100) + """);
|
||||
const float seaFade = """ + str(round(rpdat.arm_ocean_fade * 100) / 100) + """;
|
||||
""")
|
||||
if rpdat.rp_ssgi == 'SSAO' or rpdat.rp_volumetriclight:
|
||||
if rpdat.rp_ssgi == 'SSAO' or rpdat.rp_ssgi == 'RTAO' or rpdat.rp_volumetriclight:
|
||||
f.write(
|
||||
"""const float ssaoSize = """ + str(round((rpdat.arm_ssgi_step / 32) * 100) / 100) + """;
|
||||
const float ssaoStrength = """ + str(round((rpdat.arm_ssgi_strength / 2) * 100) / 100) + """;
|
||||
"""const float ssaoRadius = """ + str(round(rpdat.arm_ssgi_radius * 100) / 100) + """;
|
||||
const float ssaoStrength = """ + str(round(rpdat.arm_ssgi_strength * 100) / 100) + """;
|
||||
const float ssaoScale = """ + ("2.0" if rpdat.arm_ssgi_half_res else "20.0") + """;
|
||||
""")
|
||||
|
||||
if rpdat.rp_ssgi == 'RTGI' or rpdat.rp_ssgi == 'RTAO':
|
||||
f.write(
|
||||
"""const int ssgiMaxSteps = """ + str(rpdat.arm_ssgi_max_steps) + """;
|
||||
|
|
Loading…
Reference in New Issue