Fast clear
This commit is contained in:
parent
93cc102bf5
commit
13bb02e337
|
@ -16,25 +16,24 @@ const float blurWeights[5] = float[] (0.227027, 0.1945946, 0.1216216, 0.054054,
|
|||
const float discardThreshold = 0.95;
|
||||
|
||||
void main() {
|
||||
vec2 tc = texCoord;
|
||||
vec3 nor = getNor(textureLod(gbuffer0, texCoord, 0.0).rg);
|
||||
|
||||
fragColor = textureLod(tex, tc, 0.0).r * blurWeights[0];
|
||||
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;
|
||||
|
||||
vec3 nor2 = getNor(textureLod(gbuffer0, tc + i * dirInv, 0.0).rg);
|
||||
vec3 nor2 = getNor(textureLod(gbuffer0, texCoord + i * dirInv, 0.0).rg);
|
||||
float influenceFactor = step(discardThreshold, dot(nor2, nor));
|
||||
float col = textureLod(tex, tc + posadd * dirInv, 0.0).r;
|
||||
float col = textureLod(tex, texCoord + posadd * dirInv, 0.0).r;
|
||||
float w = blurWeights[i] * influenceFactor;
|
||||
fragColor += col * w;
|
||||
weight += w;
|
||||
|
||||
nor2 = getNor(textureLod(gbuffer0, tc - i * dirInv, 0.0).rg);
|
||||
nor2 = getNor(textureLod(gbuffer0, texCoord - i * dirInv, 0.0).rg);
|
||||
influenceFactor = step(discardThreshold, dot(nor2, nor));
|
||||
col = textureLod(tex, tc - posadd * dirInv, 0.0).r;
|
||||
col = textureLod(tex, texCoord - posadd * dirInv, 0.0).r;
|
||||
w = blurWeights[i] * influenceFactor;
|
||||
fragColor += col * w;
|
||||
weight += w;
|
||||
|
|
|
@ -269,11 +269,11 @@ void main() {
|
|||
#endif
|
||||
|
||||
#ifdef _SSAO
|
||||
#ifdef _RTGI
|
||||
fragColor.rgb *= textureLod(ssaotex, texCoord, 0.0).rgb;
|
||||
#else
|
||||
// #ifdef _RTGI
|
||||
// fragColor.rgb *= textureLod(ssaotex, texCoord, 0.0).rgb;
|
||||
// #else
|
||||
fragColor.rgb *= textureLod(ssaotex, texCoord, 0.0).r;
|
||||
#endif
|
||||
// #endif
|
||||
#endif
|
||||
|
||||
// Show voxels
|
||||
|
|
|
@ -16,21 +16,31 @@
|
|||
#include "compiled.inc"
|
||||
#include "std/gbuffer.glsl"
|
||||
|
||||
const int kernelSize = 12;
|
||||
const vec2 kernel[12] = vec2[] (
|
||||
const int kernelSize = 8;
|
||||
const vec2 kernel[8] = vec2[] (
|
||||
vec2(1.0, 0.0),
|
||||
vec2(0.8660254, 0.4999999),
|
||||
vec2(0.5, 0.8660254),
|
||||
vec2(0.7071067,0.7071067),
|
||||
vec2(0.0, 1.0),
|
||||
vec2(-0.4999999, 0.8660254),
|
||||
vec2(-0.8660254, 0.5),
|
||||
vec2(-0.7071067,0.7071067),
|
||||
vec2(-1.0, 0.0),
|
||||
vec2(-0.8660254, -0.4999999),
|
||||
vec2(-0.5, -0.8660254),
|
||||
vec2(-0.7071067,-0.7071067),
|
||||
vec2(0.0, -1.0),
|
||||
vec2(0.4999999, -0.8660254),
|
||||
vec2(0.8660254, -0.5)
|
||||
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;
|
||||
|
@ -66,7 +76,7 @@ void main() {
|
|||
float radius = ssaoSize * randomVec.y;
|
||||
|
||||
fragColor = 0;
|
||||
for (int i = 0; i < 12; ++i) {
|
||||
for (int i = 0; i < kernelSize; ++i) {
|
||||
vec2 k = ((rotMat * kernel[i] * aspectRatio) / currentDistance) * radius;
|
||||
depth = textureLod(gbufferD, texCoord + k, 0.0).r * 2.0 - 1.0;
|
||||
vec3 pos = getPosNoEye(eyeLook, vray, depth, cameraProj) - currentPos;
|
||||
|
|
|
@ -439,6 +439,17 @@ class RenderPathDeferred {
|
|||
}
|
||||
#end
|
||||
|
||||
path.setTarget("gbuffer0"); // Only clear gbuffer0
|
||||
#if (rp_background == "Clear")
|
||||
{
|
||||
path.clearTarget(-1, 1.0);
|
||||
}
|
||||
#else
|
||||
{
|
||||
path.clearTarget(null, 1.0);
|
||||
}
|
||||
#end
|
||||
|
||||
#if rp_gbuffer2
|
||||
{
|
||||
path.setTarget("gbuffer2");
|
||||
|
@ -451,16 +462,6 @@ class RenderPathDeferred {
|
|||
}
|
||||
#end
|
||||
|
||||
#if (rp_background == "Clear")
|
||||
{
|
||||
path.clearTarget(-1, 1.0);
|
||||
}
|
||||
#else
|
||||
{
|
||||
path.clearTarget(null, 1.0);
|
||||
}
|
||||
#end
|
||||
|
||||
#if rp_stereo
|
||||
{
|
||||
path.drawStereo(drawMeshes);
|
||||
|
|
|
@ -26,7 +26,7 @@ def update_preset(self, context):
|
|||
rpdat.rp_gi = 'Off'
|
||||
rpdat.rp_render_to_texture = True
|
||||
rpdat.rp_supersampling = '1'
|
||||
rpdat.rp_antialiasing = 'SMAA'
|
||||
rpdat.rp_antialiasing = 'FXAA'
|
||||
rpdat.rp_compositornodes = True
|
||||
rpdat.rp_volumetriclight = False
|
||||
rpdat.rp_ssgi = 'SSAO'
|
||||
|
@ -297,7 +297,7 @@ class ArmRPListItem(bpy.types.PropertyGroup):
|
|||
('FXAA', 'FXAA', 'FXAA'),
|
||||
('SMAA', 'SMAA', 'SMAA'),
|
||||
('TAA', 'TAA', 'TAA')],
|
||||
name="Anti Aliasing", description="Post-process anti aliasing technique", default='SMAA', update=update_renderpath)
|
||||
name="Anti Aliasing", description="Post-process anti aliasing technique", default='FXAA', update=update_renderpath)
|
||||
rp_volumetriclight = BoolProperty(name="Volumetric Light", description="Use volumetric lighting", default=False, update=update_renderpath)
|
||||
rp_ssr = BoolProperty(name="SSR", description="Screen space reflections", default=False, update=update_renderpath)
|
||||
rp_ssgi = EnumProperty(
|
||||
|
|
Loading…
Reference in a new issue