Shader fixes
This commit is contained in:
parent
6a5c9cc10a
commit
6edaac2c9d
|
@ -39,8 +39,8 @@ void main() {
|
||||||
sumfactor += factor;
|
sumfactor += factor;
|
||||||
res += factor * col;
|
res += factor * col;
|
||||||
|
|
||||||
col = textureLod(tex, texCoord - s).r;
|
col = textureLod(tex, texCoord - s, 0.0).r;
|
||||||
factor = normpdf3(col - colf, 1.0, 0.0) * fw;
|
factor = normpdf3(col - colf, 1.0) * fw;
|
||||||
sumfactor += factor;
|
sumfactor += factor;
|
||||||
res += factor * col;
|
res += factor * col;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,9 @@
|
||||||
|
|
||||||
#include "compiled.inc"
|
#include "compiled.inc"
|
||||||
#include "std/gbuffer.glsl"
|
#include "std/gbuffer.glsl"
|
||||||
#include "std/shadows.glsl"
|
|
||||||
|
|
||||||
uniform sampler2D gbufferD;
|
uniform sampler2D gbufferD;
|
||||||
#ifndef _NoShadows
|
uniform sampler2DShadow shadowMap;
|
||||||
uniform sampler2D shadowMap;
|
|
||||||
#endif
|
|
||||||
uniform sampler2D snoise;
|
uniform sampler2D snoise;
|
||||||
|
|
||||||
#ifdef _CSM
|
#ifdef _CSM
|
||||||
|
@ -17,14 +14,10 @@ uniform sampler2D snoise;
|
||||||
uniform mat4 LWVP;
|
uniform mat4 LWVP;
|
||||||
#endif
|
#endif
|
||||||
uniform float shadowsBias;
|
uniform float shadowsBias;
|
||||||
// uniform vec3 lightPos;
|
|
||||||
uniform vec3 lightColor;
|
uniform vec3 lightColor;
|
||||||
uniform vec3 eye;
|
uniform vec3 eye;
|
||||||
uniform vec3 eyeLook;
|
uniform vec3 eyeLook;
|
||||||
uniform vec2 cameraProj;
|
uniform vec2 cameraProj;
|
||||||
// uniform float lightRadius;
|
|
||||||
// uniform int lightShadow;
|
|
||||||
// uniform vec2 lightPlane;
|
|
||||||
|
|
||||||
in vec2 texCoord;
|
in vec2 texCoord;
|
||||||
in vec3 viewRay;
|
in vec3 viewRay;
|
||||||
|
@ -35,20 +28,11 @@ const float tAbs = 0.0;
|
||||||
const float tExt = tScat + tAbs;
|
const float tExt = tScat + tAbs;
|
||||||
const float stepLen = 1.0 / volumSteps;
|
const float stepLen = 1.0 / volumSteps;
|
||||||
const float lighting = 0.4;
|
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));
|
|
||||||
// }
|
|
||||||
|
|
||||||
void rayStep(inout vec3 curPos, inout float curOpticalDepth, inout float scatteredLightAmount, float stepLenWorld, vec3 viewVecNorm) {
|
void rayStep(inout vec3 curPos, inout float curOpticalDepth, inout float scatteredLightAmount, float stepLenWorld, vec3 viewVecNorm) {
|
||||||
curPos += stepLenWorld * viewVecNorm;
|
curPos += stepLenWorld * viewVecNorm;
|
||||||
const float density = 1.0;
|
const float density = 1.0;
|
||||||
|
|
||||||
// float l1 = lighting(curPos) * stepLenWorld * tScat * density;
|
|
||||||
float l1 = lighting * stepLenWorld * tScat * density;
|
float l1 = lighting * stepLenWorld * tScat * density;
|
||||||
curOpticalDepth *= exp(-tExt * stepLenWorld * density);
|
curOpticalDepth *= exp(-tExt * stepLenWorld * density);
|
||||||
|
|
||||||
|
@ -59,7 +43,7 @@ void rayStep(inout vec3 curPos, inout float curOpticalDepth, inout float scatter
|
||||||
vec4 lightPosition = LWVP * vec4(curPos, 1.0);
|
vec4 lightPosition = LWVP * vec4(curPos, 1.0);
|
||||||
if (lightPosition.w > 0.0) {
|
if (lightPosition.w > 0.0) {
|
||||||
lightPosition.xyz /= lightPosition.w;
|
lightPosition.xyz /= lightPosition.w;
|
||||||
visibility = float(texture(shadowMap, lightPosition.xy).r > lightPosition.z - shadowsBias);
|
visibility = texture(shadowMap, vec3(lightPosition.xy, lightPosition.z - shadowsBias));
|
||||||
}
|
}
|
||||||
|
|
||||||
scatteredLightAmount += curOpticalDepth * l1 * visibility;
|
scatteredLightAmount += curOpticalDepth * l1 * visibility;
|
||||||
|
|
|
@ -19,30 +19,10 @@
|
||||||
"name": "shadowsBias",
|
"name": "shadowsBias",
|
||||||
"link": "_lightShadowsBias"
|
"link": "_lightShadowsBias"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "lightPos",
|
|
||||||
"link": "_lightPosition",
|
|
||||||
"ifdef": ["_Disabled"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "lightRadius",
|
|
||||||
"link": "_lightRadius",
|
|
||||||
"ifdef": ["_Disabled"]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "snoise",
|
"name": "snoise",
|
||||||
"link": "_blueNoise64"
|
"link": "_blueNoise64"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "lightPlane",
|
|
||||||
"link": "_lightPlane",
|
|
||||||
"ifdef": ["_Disabled"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "lightShadow",
|
|
||||||
"link": "_lightCastShadow",
|
|
||||||
"ifdef": ["_Disabled"]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "eye",
|
"name": "eye",
|
||||||
"link": "_cameraPosition"
|
"link": "_cameraPosition"
|
||||||
|
@ -89,35 +69,10 @@
|
||||||
"name": "shadowsBias",
|
"name": "shadowsBias",
|
||||||
"link": "_lightShadowsBias"
|
"link": "_lightShadowsBias"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "lightPos",
|
|
||||||
"link": "_lightPosition",
|
|
||||||
"ifdef": ["_Disabled"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "lightRadius",
|
|
||||||
"link": "_lightRadius",
|
|
||||||
"ifdef": ["_Disabled"]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "lightColor",
|
"name": "lightColor",
|
||||||
"link": "_lightColor"
|
"link": "_lightColor"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "snoise",
|
|
||||||
"link": "_noise8",
|
|
||||||
"ifdef": ["_Disabled"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "lightPlane",
|
|
||||||
"link": "_lightPlane",
|
|
||||||
"ifdef": ["_Disabled"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "lightShadow",
|
|
||||||
"link": "_lightCastShadow",
|
|
||||||
"ifdef": ["_Disabled"]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "eye",
|
"name": "eye",
|
||||||
"link": "_cameraPosition"
|
"link": "_cameraPosition"
|
||||||
|
|
|
@ -301,7 +301,7 @@ class ArmRPListItem(bpy.types.PropertyGroup):
|
||||||
('FXAA', 'FXAA', 'FXAA'),
|
('FXAA', 'FXAA', 'FXAA'),
|
||||||
('SMAA', 'SMAA', 'SMAA'),
|
('SMAA', 'SMAA', 'SMAA'),
|
||||||
('TAA', 'TAA', 'TAA')],
|
('TAA', 'TAA', 'TAA')],
|
||||||
name="Anti Aliasing", description="Post-process anti aliasing technique", default='FXAA', update=update_renderpath)
|
name="Anti Aliasing", description="Post-process anti aliasing technique", default='SMAA', update=update_renderpath)
|
||||||
rp_volumetriclight: BoolProperty(name="Volumetric Light", description="Use volumetric lighting", default=False, 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_ssr: BoolProperty(name="SSR", description="Screen space reflections", default=False, update=update_renderpath)
|
||||||
rp_ssgi: EnumProperty(
|
rp_ssgi: EnumProperty(
|
||||||
|
|
Loading…
Reference in a new issue