mirror of
https://github.com/lubosz/overte.git
synced 2025-04-25 00:03:16 +02:00
Unifying the lighting pass for scaterring and not
This commit is contained in:
parent
8f2bf2b423
commit
1eb4acf815
11 changed files with 137 additions and 178 deletions
|
@ -34,16 +34,15 @@
|
|||
vec3 color = vec3(0.0);
|
||||
|
||||
<@if isScattering@>
|
||||
vec3 fresnel = vec3(0.028); // Default Di-electric fresnel value for skin
|
||||
float metallic = 0.0;
|
||||
<@else@>
|
||||
color += emissive * isEmissiveEnabled();
|
||||
<@endif@>
|
||||
|
||||
vec3 fresnel = vec3(0.03); // Default Di-electric fresnel value
|
||||
if (metallic > 0.5) {
|
||||
fresnel = albedo;
|
||||
metallic = 1.0;
|
||||
}
|
||||
color += emissive * isEmissiveEnabled();
|
||||
<@endif@>
|
||||
|
||||
<@endfunc@>
|
||||
|
||||
|
@ -87,7 +86,7 @@ vec3 evalAmbientSphereGlobalColor(mat4 invViewMat, float shadowAttenuation, floa
|
|||
|
||||
<$declareDeferredCurvature()$>
|
||||
|
||||
vec3 evalAmbientSphereGlobalColorScattering(mat4 invViewMat, float shadowAttenuation, float obscurance, vec3 position, vec3 normal, vec3 albedo, float roughness, float scattering, vec4 blurredCurvature, vec4 diffusedCurvature) {
|
||||
vec3 evalAmbientSphereGlobalColorScattering(mat4 invViewMat, float shadowAttenuation, float obscurance, vec3 position, vec3 normal, vec3 albedo, float metallic, vec3 emissive, float roughness, float scattering, vec4 blurredCurvature, vec4 diffusedCurvature) {
|
||||
|
||||
<$prepareGlobalLight(1)$>
|
||||
|
||||
|
@ -155,10 +154,10 @@ vec3 evalSkyboxGlobalColor(mat4 invViewMat, float shadowAttenuation, float obscu
|
|||
|
||||
<$declareDeferredCurvature()$>
|
||||
|
||||
vec3 evalSkyboxGlobalColorScattering(mat4 invViewMat, float shadowAttenuation, float obscurance, vec3 position, vec3 normal, vec3 albedo, float roughness, float scattering, vec4 blurredCurvature, vec4 diffusedCurvature) {
|
||||
vec3 evalSkyboxGlobalColorScattering(mat4 invViewMat, float shadowAttenuation, float obscurance, vec3 position, vec3 normal, vec3 albedo, float metallic, vec3 emissive, float roughness, float scattering, vec4 blurredCurvature, vec4 diffusedCurvature) {
|
||||
<$prepareGlobalLight(1)$>
|
||||
|
||||
vec3 midNormal = normalize((blurredCurvature.xyz - 0.5f) * 2.0f);
|
||||
vec3 midNormal = normalize((blurredCurvature.xyz - 0.5f) * 2.0f);
|
||||
vec3 lowNormal = normalize((diffusedCurvature.xyz - 0.5f) * 2.0f);
|
||||
float highCurvature = unpackCurvature(blurredCurvature.w);
|
||||
float lowCurvature = unpackCurvature(diffusedCurvature.w);
|
||||
|
|
|
@ -25,46 +25,23 @@ void evalLightingDirectional(out vec3 diffuse, out vec3 specular, Light light,
|
|||
|
||||
<@if supportScattering@>
|
||||
|
||||
<@include SubsurfaceScattering.slh@>
|
||||
<$declareSubsurfaceScatteringBRDF()$>
|
||||
<$declareSkinSpecularLighting()$>
|
||||
|
||||
void evalLightingDirectionalScattering(out vec3 diffuse, out vec3 specular, Light light,
|
||||
vec3 eyeDir, vec3 normal, float roughness,
|
||||
float metallic, vec3 fresnel, vec3 albedo, float shadow,
|
||||
float scattering, vec3 midNormal, vec3 lowNormal, float curvature) {
|
||||
|
||||
vec3 fragLightDir = -normalize(getLightDirection(light));
|
||||
vec3 brdf = evalSkinBRDF(fragLightDir, normal, midNormal, lowNormal, curvature);
|
||||
float scatteringLevel = getScatteringLevel();
|
||||
vec4 shading;
|
||||
float standardDiffuse = clamp(dot(normal, fragLightDir), 0.0, 1.0);
|
||||
{ // Key Sun Lighting
|
||||
// Diffuse Lighting
|
||||
//float diffuse = clamp(dot(normal, fragLightDir), 0.0, 1.0);
|
||||
|
||||
// Specular Lighting
|
||||
vec3 halfDir = normalize(eyeDir + fragLightDir);
|
||||
evalFragShading(diffuse, specular,
|
||||
normal, fragLightDir, eyeDir,
|
||||
metallic, fresnel, roughness,
|
||||
scattering, vec4(midNormal, curvature), vec4(lowNormal, curvature));
|
||||
|
||||
float specular = skinSpecular(normal, fragLightDir, eyeDir, roughness, 1.0);
|
||||
vec3 lightEnergy = shadow * getLightColor(light) * getLightIntensity(light);
|
||||
|
||||
vec3 fresnelColor = fresnelSchlick(fresnel, fragLightDir, halfDir);
|
||||
float power = specularDistribution(roughness, normal, halfDir);
|
||||
//vec3 specular = power * fresnelColor * standardDiffuse;
|
||||
diffuse *= albedo * lightEnergy;
|
||||
|
||||
shading = vec4(vec3(specular), (1 - fresnelColor.x));
|
||||
}
|
||||
|
||||
|
||||
if (scatteringLevel < 0.1) {
|
||||
brdf = vec3(standardDiffuse);
|
||||
}
|
||||
brdf = mix(vec3(standardDiffuse), brdf, scatteringLevel * scattering);
|
||||
|
||||
|
||||
diffuse = albedo * brdf.xyz * shadow * getLightColor(light) * getLightIntensity(light);
|
||||
|
||||
specular = shading.rgb * shadow * getLightColor(light) * getLightIntensity(light);
|
||||
specular *= lightEnergy;
|
||||
}
|
||||
|
||||
<@endif@>
|
||||
|
|
|
@ -46,10 +46,6 @@ void evalLightingPoint(out vec3 diffuse, out vec3 specular, Light light,
|
|||
|
||||
<@if supportScattering@>
|
||||
|
||||
<@include SubsurfaceScattering.slh@>
|
||||
<$declareSubsurfaceScatteringBRDF()$>
|
||||
<$declareSkinSpecularLighting()$>
|
||||
|
||||
void evalLightingPointScattering(out vec3 diffuse, out vec3 specular, Light light,
|
||||
vec3 fragLightVec, vec3 fragEyeDir, vec3 normal, float roughness,
|
||||
float metallic, vec3 fresnel, vec3 albedo, float shadow,
|
||||
|
@ -65,36 +61,14 @@ void evalLightingPointScattering(out vec3 diffuse, out vec3 specular, Light ligh
|
|||
vec3 lightEnergy = radialAttenuation * shadow * getLightColor(light) * getLightIntensity(light);
|
||||
|
||||
// Eval shading
|
||||
vec3 brdf = evalSkinBRDF(fragLightDir, normal, midNormal, lowNormal, curvature);
|
||||
float scatteringLevel = getScatteringLevel();
|
||||
vec4 shading;
|
||||
float standardDiffuse = clamp(dot(normal, fragLightDir), 0.0, 1.0);
|
||||
{ // Key Sun Lighting
|
||||
// Diffuse Lighting
|
||||
//float diffuse = clamp(dot(normal, fragLightDir), 0.0, 1.0);
|
||||
evalFragShading(diffuse, specular,
|
||||
normal, fragLightDir, fragEyeDir,
|
||||
metallic, fresnel, roughness,
|
||||
scattering, vec4(midNormal, curvature), vec4(lowNormal, curvature));
|
||||
|
||||
// Specular Lighting
|
||||
vec3 halfDir = normalize(fragEyeDir + fragLightDir);
|
||||
diffuse *= albedo * lightEnergy;
|
||||
|
||||
float specular = skinSpecular(normal, fragLightDir, fragEyeDir, roughness, 1.0);
|
||||
|
||||
vec3 fresnelColor = fresnelSchlick(fresnel, fragLightDir, halfDir);
|
||||
float power = specularDistribution(roughness, normal, halfDir);
|
||||
//vec3 specular = power * fresnelColor * standardDiffuse;
|
||||
|
||||
shading = vec4(vec3(specular), (1 - fresnelColor.x));
|
||||
}
|
||||
|
||||
|
||||
if (scatteringLevel < 0.1) {
|
||||
brdf = vec3(standardDiffuse);
|
||||
}
|
||||
brdf = mix(vec3(standardDiffuse), brdf, scatteringLevel * scattering);
|
||||
|
||||
|
||||
diffuse = albedo * brdf.xyz * lightEnergy;
|
||||
|
||||
specular = shading.rgb * lightEnergy;
|
||||
specular *= lightEnergy;
|
||||
|
||||
if (getLightShowContour(light) > 0.0) {
|
||||
// Show edge
|
||||
|
|
|
@ -11,9 +11,6 @@
|
|||
|
||||
<@func declareLightingSpot(supportScattering)@>
|
||||
|
||||
|
||||
<@include DeferredLighting.slh@>
|
||||
|
||||
void evalLightingSpot(out vec3 diffuse, out vec3 specular, Light light,
|
||||
vec4 fragLightDirLen, float cosSpotAngle, vec3 fragEyeDir, vec3 normal, float roughness,
|
||||
float metallic, vec3 fresnel, vec3 albedo, float shadow) {
|
||||
|
@ -49,10 +46,6 @@ void evalLightingSpot(out vec3 diffuse, out vec3 specular, Light light,
|
|||
|
||||
<@if supportScattering@>
|
||||
|
||||
<@include SubsurfaceScattering.slh@>
|
||||
<$declareSubsurfaceScatteringBRDF()$>
|
||||
<$declareSkinSpecularLighting()$>
|
||||
|
||||
void evalLightingSpotScattering(out vec3 diffuse, out vec3 specular, Light light,
|
||||
vec4 fragLightDirLen, float cosSpotAngle, vec3 fragEyeDir, vec3 normal, float roughness,
|
||||
float metallic, vec3 fresnel, vec3 albedo, float shadow,
|
||||
|
@ -68,36 +61,14 @@ void evalLightingSpotScattering(out vec3 diffuse, out vec3 specular, Light light
|
|||
vec3 lightEnergy = angularAttenuation * radialAttenuation * shadow * getLightColor(light) * getLightIntensity(light);
|
||||
|
||||
// Eval shading
|
||||
vec3 brdf = evalSkinBRDF(fragLightDir, normal, midNormal, lowNormal, curvature);
|
||||
float scatteringLevel = getScatteringLevel();
|
||||
vec4 shading;
|
||||
float standardDiffuse = clamp(dot(normal, fragLightDir), 0.0, 1.0);
|
||||
{ // Key Sun Lighting
|
||||
// Diffuse Lighting
|
||||
//float diffuse = clamp(dot(normal, fragLightDir), 0.0, 1.0);
|
||||
evalFragShading(diffuse, specular,
|
||||
normal, fragLightDir, fragEyeDir,
|
||||
metallic, fresnel, roughness,
|
||||
scattering, vec4(midNormal, curvature), vec4(lowNormal, curvature));
|
||||
|
||||
// Specular Lighting
|
||||
vec3 halfDir = normalize(fragEyeDir + fragLightDir);
|
||||
diffuse *= albedo * lightEnergy;
|
||||
|
||||
float specular = skinSpecular(normal, fragLightDir, fragEyeDir, roughness, 1.0);
|
||||
|
||||
vec3 fresnelColor = fresnelSchlick(fresnel, fragLightDir, halfDir);
|
||||
float power = specularDistribution(roughness, normal, halfDir);
|
||||
//vec3 specular = power * fresnelColor * standardDiffuse;
|
||||
|
||||
shading = vec4(vec3(specular), (1 - fresnelColor.x));
|
||||
}
|
||||
|
||||
|
||||
if (scatteringLevel < 0.1) {
|
||||
brdf = vec3(standardDiffuse);
|
||||
}
|
||||
brdf = mix(vec3(standardDiffuse), brdf, scatteringLevel * scattering);
|
||||
|
||||
|
||||
diffuse = albedo * brdf.xyz * lightEnergy;
|
||||
|
||||
specular = shading.rgb * lightEnergy;
|
||||
specular *= lightEnergy;
|
||||
|
||||
if (getLightShowContour(light) > 0.0) {
|
||||
// Show edges
|
||||
|
|
|
@ -66,14 +66,48 @@ float isShowContour() {
|
|||
|
||||
<@endfunc@>
|
||||
|
||||
<@func declareBeckmannSpecular()@>
|
||||
|
||||
uniform sampler2D scatteringSpecularBeckmann;
|
||||
|
||||
float fetchSpecularBeckmann(float ndoth, float roughness) {
|
||||
return pow(2.0 * texture(scatteringSpecularBeckmann, vec2(ndoth, roughness)).r, 10.0);
|
||||
}
|
||||
|
||||
float fresnelSchlickScalar(float fresnelColor, vec3 lightDir, vec3 halfDir) {
|
||||
float base = 1.0 - clamp(dot(lightDir, halfDir), 0.0, 1.0);
|
||||
float exponential = pow(base, 5.0);
|
||||
return (exponential)+fresnelColor * (1.0 - exponential);
|
||||
}
|
||||
|
||||
vec2 skinSpecular(vec3 N, vec3 L, vec3 V, float roughness, float intensity) {
|
||||
vec2 result = vec2(0.0, 1.0);
|
||||
float ndotl = dot(N, L);
|
||||
if (ndotl > 0.0) {
|
||||
vec3 h = L + V;
|
||||
vec3 H = normalize(h);
|
||||
float ndoth = dot(N, H);
|
||||
float PH = fetchSpecularBeckmann(ndoth, roughness);
|
||||
float F = fresnelSchlickScalar(0.028, H, V);
|
||||
float frSpec = max(PH * F / dot(h, h), 0.0);
|
||||
result.x = ndotl * intensity * frSpec;
|
||||
result.y -= F;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
<@endfunc@>
|
||||
|
||||
<@func declareEvalPBRShading()@>
|
||||
|
||||
vec3 fresnelSchlick(vec3 fresnelColor, vec3 lightDir, vec3 halfDir) {
|
||||
return fresnelColor + (1.0 - fresnelColor) * pow(1.0 - clamp(dot(lightDir, halfDir), 0.0, 1.0), 5);
|
||||
vec3 fresnelSchlickColor(vec3 fresnelColor, vec3 lightDir, vec3 halfDir) {
|
||||
float base = 1.0 - clamp(dot(lightDir, halfDir), 0.0, 1.0);
|
||||
float exponential = pow(base, 5.0);
|
||||
return vec3(exponential) + fresnelColor * (1.0 - exponential);
|
||||
}
|
||||
|
||||
|
||||
|
||||
float specularDistribution(float roughness, vec3 normal, vec3 halfDir) {
|
||||
float ndoth = clamp(dot(halfDir, normal), 0.0, 1.0);
|
||||
float gloss2 = pow(0.001 + roughness, 4);
|
||||
|
@ -96,7 +130,7 @@ vec4 evalPBRShading(vec3 fragNormal, vec3 fragLightDir, vec3 fragEyeDir, float m
|
|||
|
||||
// Specular Lighting
|
||||
vec3 halfDir = normalize(fragEyeDir + fragLightDir);
|
||||
vec3 fresnelColor = fresnelSchlick(fresnel, fragLightDir, halfDir);
|
||||
vec3 fresnelColor = fresnelSchlickColor(fresnel, fragLightDir, halfDir);
|
||||
float power = specularDistribution(roughness, fragNormal, halfDir);
|
||||
vec3 specular = power * fresnelColor * diffuse;
|
||||
|
||||
|
@ -104,73 +138,42 @@ vec4 evalPBRShading(vec3 fragNormal, vec3 fragLightDir, vec3 fragEyeDir, float m
|
|||
}
|
||||
<@endfunc@>
|
||||
|
||||
|
||||
|
||||
<$declareEvalPBRShading()$>
|
||||
|
||||
// Return xyz the specular/reflection component and w the diffuse component
|
||||
vec4 evalFragShading(vec3 fragNormal, vec3 fragLightDir, vec3 fragEyeDir, float metallic, vec3 specular, float roughness) {
|
||||
return evalPBRShading(fragNormal, fragLightDir, fragEyeDir, metallic, specular, roughness);
|
||||
}
|
||||
<!
|
||||
uniform sampler2D scatteringSpecularBeckmann;
|
||||
|
||||
float fetchSpecularBeckmann(float ndoth, float roughness) {
|
||||
return pow(2.0 * texture(scatteringSpecularBeckmann, vec2(ndoth, roughness)).r, 10.0);
|
||||
vec4 evalFragShading(vec3 fragNormal, vec3 fragLightDir, vec3 fragEyeDir, float metallic, vec3 fresnel, float roughness) {
|
||||
return evalPBRShading(fragNormal, fragLightDir, fragEyeDir, metallic, fresnel, roughness);
|
||||
}
|
||||
|
||||
float fresnelReflectance(vec3 H, vec3 V, float Fo) {
|
||||
float base = 1.0 - dot(V, H);
|
||||
float exponential = pow(base, 5.0);
|
||||
return exponential + Fo * (1.0 - exponential);
|
||||
}
|
||||
|
||||
float skinSpecular(vec3 N, vec3 L, vec3 V, float roughness, float intensity) {
|
||||
float result = 0.0;
|
||||
float ndotl = dot(N, L);
|
||||
if (ndotl > 0.0) {
|
||||
vec3 h = L + V;
|
||||
vec3 H = normalize(h);
|
||||
float ndoth = dot(N, H);
|
||||
float PH = fetchSpecularBeckmann(ndoth, roughness);
|
||||
float F = fresnelReflectance(H, V, 0.028);
|
||||
float frSpec = max(PH * F / dot(h, h), 0.0);
|
||||
result = ndotl * intensity * frSpec;
|
||||
<$declareBeckmannSpecular()$>
|
||||
<@include SubsurfaceScattering.slh@>
|
||||
<$declareSubsurfaceScatteringBRDF()$>
|
||||
|
||||
void evalFragShading(out vec3 diffuse, out vec3 specular,
|
||||
vec3 fragNormal, vec3 fragLightDir, vec3 fragEyeDir,
|
||||
float metallic, vec3 fresnel, float roughness,
|
||||
float scattering, vec4 midNormalCurvature, vec4 lowNormalCurvature) {
|
||||
if (scattering > 0.0) {
|
||||
vec3 brdf = evalSkinBRDF(fragLightDir, fragNormal, midNormalCurvature.xyz, lowNormalCurvature.xyz, lowNormalCurvature.w);
|
||||
float NdotL = clamp(dot(fragNormal, fragLightDir), 0.0, 1.0);
|
||||
diffuse = mix(vec3(NdotL), brdf, scattering);
|
||||
|
||||
// Specular Lighting
|
||||
vec3 halfDir = normalize(fragEyeDir + fragLightDir);
|
||||
vec2 specularBrdf = skinSpecular(fragNormal, fragLightDir, fragEyeDir, roughness, 1.0);
|
||||
|
||||
diffuse *= specularBrdf.y;
|
||||
specular = vec3(specularBrdf.x);
|
||||
|
||||
} else {
|
||||
vec4 shading = evalPBRShading(fragNormal, fragLightDir, fragEyeDir, metallic, specular, roughness);
|
||||
diffuse = vec3(shading.w);
|
||||
specular = shading.xyz;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Eval shading
|
||||
vec3 brdf = evalSkinBRDF(fragLightDir, normal, midNormal, lowNormal, curvature);
|
||||
float scatteringLevel = getScatteringLevel();
|
||||
vec4 shading;
|
||||
float standardDiffuse = clamp(dot(normal, fragLightDir), 0.0, 1.0);
|
||||
{ // Key Sun Lighting
|
||||
// Diffuse Lighting
|
||||
//float diffuse = clamp(dot(normal, fragLightDir), 0.0, 1.0);
|
||||
|
||||
// Specular Lighting
|
||||
vec3 halfDir = normalize(fragEyeDir + fragLightDir);
|
||||
|
||||
float specular = skinSpecular(normal, fragLightDir, fragEyeDir, roughness, 1.0);
|
||||
|
||||
vec3 fresnelColor = fresnelSchlick(fresnel, fragLightDir, halfDir);
|
||||
float power = specularDistribution(roughness, normal, halfDir);
|
||||
//vec3 specular = power * fresnelColor * standardDiffuse;
|
||||
|
||||
shading = vec4(vec3(specular), (1 - fresnelColor.x));
|
||||
}
|
||||
|
||||
|
||||
if (scatteringLevel < 0.1) {
|
||||
brdf = vec3(standardDiffuse);
|
||||
}
|
||||
brdf = mix(vec3(standardDiffuse), brdf, scatteringLevel * scattering);
|
||||
|
||||
|
||||
diffuse = albedo * brdf.xyz * lightEnergy;
|
||||
|
||||
specular = shading.rgb * lightEnergy;
|
||||
|
||||
!>
|
||||
|
||||
<@endif@>
|
||||
|
|
|
@ -140,6 +140,8 @@ RenderDeferredTask::RenderDeferredTask(CullFunctor cullFunctor) {
|
|||
// Render transparent objects forward in LightingBuffer
|
||||
addJob<DrawDeferred>("DrawTransparentDeferred", transparents, shapePlumber);
|
||||
|
||||
addJob<DebugSubsurfaceScattering>("DebugScattering", deferredLightingInputs);
|
||||
|
||||
|
||||
// Lighting Buffer ready for tone mapping
|
||||
addJob<ToneMappingDeferred>("ToneMapping");
|
||||
|
@ -151,7 +153,6 @@ RenderDeferredTask::RenderDeferredTask(CullFunctor cullFunctor) {
|
|||
|
||||
// Debugging stages
|
||||
{
|
||||
addJob<DebugSubsurfaceScattering>("DebugScattering", deferredLightingInputs);
|
||||
|
||||
// Debugging Deferred buffer job
|
||||
const auto debugFramebuffers = render::Varying(DebugDeferredBuffer::Inputs(diffusedCurvatureFramebuffer, curvatureFramebuffer));
|
||||
|
|
|
@ -39,7 +39,7 @@ void main(void) {
|
|||
frag.diffuse,
|
||||
frag.specularVal.xyz);
|
||||
_fragColor = vec4(color, 1.0);
|
||||
} else if (frag.mode == FRAG_MODE_SCATTERING) {
|
||||
} else { //if (frag.mode == FRAG_MODE_SCATTERING) {
|
||||
|
||||
vec4 blurredCurvature = fetchCurvature(_texCoord0);
|
||||
vec4 diffusedCurvature = fetchDiffusedCurvature(_texCoord0);
|
||||
|
@ -51,12 +51,14 @@ void main(void) {
|
|||
frag.position.xyz,
|
||||
frag.normal,
|
||||
frag.diffuse,
|
||||
frag.metallic,
|
||||
frag.emissive,
|
||||
frag.roughness,
|
||||
frag.scattering,
|
||||
blurredCurvature,
|
||||
diffusedCurvature);
|
||||
_fragColor = vec4(color, 1.0);
|
||||
} else {
|
||||
/* } else {
|
||||
vec3 color = evalAmbientSphereGlobalColor(
|
||||
getViewInverse(),
|
||||
shadowAttenuation,
|
||||
|
@ -67,6 +69,6 @@ void main(void) {
|
|||
frag.metallic,
|
||||
frag.emissive,
|
||||
frag.roughness);
|
||||
_fragColor = vec4(color, frag.normalVal.a);
|
||||
_fragColor = vec4(color, frag.normalVal.a);*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ void main(void) {
|
|||
frag.diffuse,
|
||||
frag.specularVal.xyz);
|
||||
_fragColor = vec4(color, 1.0);
|
||||
} else if (frag.mode == FRAG_MODE_SCATTERING) {
|
||||
} else {// if (frag.mode == FRAG_MODE_SCATTERING) {
|
||||
|
||||
vec4 blurredCurvature = fetchCurvature(_texCoord0);
|
||||
vec4 diffusedCurvature = fetchDiffusedCurvature(_texCoord0);
|
||||
|
@ -51,12 +51,14 @@ void main(void) {
|
|||
frag.position.xyz,
|
||||
frag.normal,
|
||||
frag.diffuse,
|
||||
frag.metallic,
|
||||
frag.emissive,
|
||||
frag.roughness,
|
||||
frag.scattering,
|
||||
blurredCurvature,
|
||||
diffusedCurvature);
|
||||
_fragColor = vec4(color, 1.0);
|
||||
} else {
|
||||
/* } else {
|
||||
vec3 color = evalSkyboxGlobalColor(
|
||||
getViewInverse(),
|
||||
shadowAttenuation,
|
||||
|
@ -69,5 +71,6 @@ void main(void) {
|
|||
frag.roughness);
|
||||
|
||||
_fragColor = vec4(color, frag.normalVal.a);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ void main(void) {
|
|||
vec3 diffuse;
|
||||
vec3 specular;
|
||||
|
||||
if ((isScatteringEnabled() > 0.0) && (frag.mode == FRAG_MODE_SCATTERING)) {
|
||||
if (frag.mode == FRAG_MODE_SCATTERING) {
|
||||
vec4 blurredCurvature = fetchCurvature(texCoord);
|
||||
vec4 diffusedCurvature = fetchDiffusedCurvature(texCoord);
|
||||
vec3 midNormal = normalize((blurredCurvature.xyz - 0.5f) * 2.0f);
|
||||
|
@ -79,7 +79,7 @@ void main(void) {
|
|||
evalLightingPointScattering(diffuse, specular, light,
|
||||
fragLightVecLen2.xyz, fragEyeDir, frag.normal, frag.roughness,
|
||||
frag.metallic, frag.specular, frag.diffuse, 1.0,
|
||||
frag.scattering, midNormal, lowNormal, lowCurvature);
|
||||
frag.scattering * isScatteringEnabled(), midNormal, lowNormal, lowCurvature);
|
||||
} else {
|
||||
evalLightingPoint(diffuse, specular, light,
|
||||
fragLightVecLen2.xyz, fragEyeDir, frag.normal, frag.roughness,
|
||||
|
|
|
@ -70,7 +70,7 @@ void main(void) {
|
|||
|
||||
vec3 diffuse;
|
||||
vec3 specular;
|
||||
if ((isScatteringEnabled() > 0.0) && (frag.mode == FRAG_MODE_SCATTERING)) {
|
||||
if (frag.mode == FRAG_MODE_SCATTERING) {
|
||||
vec4 blurredCurvature = fetchCurvature(texCoord);
|
||||
vec4 diffusedCurvature = fetchDiffusedCurvature(texCoord);
|
||||
vec3 midNormal = normalize((blurredCurvature.xyz - 0.5f) * 2.0f);
|
||||
|
@ -80,7 +80,7 @@ void main(void) {
|
|||
evalLightingSpotScattering(diffuse, specular, light,
|
||||
fragLightDirLen.xyzw, cosSpotAngle, fragEyeDir, frag.normal, frag.roughness,
|
||||
frag.metallic, frag.specular, frag.diffuse, 1.0,
|
||||
frag.scattering, midNormal, lowNormal, lowCurvature);
|
||||
frag.scattering * isScatteringEnabled(), midNormal, lowNormal, lowCurvature);
|
||||
} else {
|
||||
evalLightingSpot(diffuse, specular, light,
|
||||
fragLightDirLen.xyzw, cosSpotAngle, fragEyeDir, frag.normal, frag.roughness,
|
||||
|
|
|
@ -11,10 +11,11 @@ import QtQuick 2.5
|
|||
import QtQuick.Controls 1.4
|
||||
import "configSlider"
|
||||
|
||||
Column {
|
||||
Row {
|
||||
spacing: 8
|
||||
|
||||
|
||||
Column {
|
||||
id: deferredLighting
|
||||
spacing: 10
|
||||
Repeater {
|
||||
model: [
|
||||
|
@ -22,9 +23,36 @@ Column {
|
|||
"Shaded:LightingModel:enableShaded",
|
||||
"Emissive:LightingModel:enableEmissive",
|
||||
"Lightmap:LightingModel:enableLightmap",
|
||||
]
|
||||
CheckBox {
|
||||
text: modelData.split(":")[0]
|
||||
checked: Render.getConfig(modelData.split(":")[1])
|
||||
onCheckedChanged: { Render.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] = checked }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Column {
|
||||
spacing: 10
|
||||
Repeater {
|
||||
model: [
|
||||
"Scattering:LightingModel:enableScattering",
|
||||
"Diffuse:LightingModel:enableDiffuse",
|
||||
"Specular:LightingModel:enableSpecular",
|
||||
]
|
||||
CheckBox {
|
||||
text: modelData.split(":")[0]
|
||||
checked: Render.getConfig(modelData.split(":")[1])
|
||||
onCheckedChanged: { Render.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] = checked }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
spacing: 10
|
||||
Repeater {
|
||||
model: [
|
||||
"Ambient:LightingModel:enableAmbientLight",
|
||||
"Directional:LightingModel:enableDirectionalLight",
|
||||
"Point:LightingModel:enablePointLight",
|
||||
|
@ -37,4 +65,5 @@ Column {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue