You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
Merge pull request #49549 from clayjohn/VULKAN-roughness-limiter
Fix roughness limiter derivative
This commit is contained in:
@@ -850,7 +850,7 @@ void main() {
|
|||||||
if (scene_data.roughness_limiter_enabled) {
|
if (scene_data.roughness_limiter_enabled) {
|
||||||
//http://www.jp.square-enix.com/tech/library/pdf/ImprovedGeometricSpecularAA.pdf
|
//http://www.jp.square-enix.com/tech/library/pdf/ImprovedGeometricSpecularAA.pdf
|
||||||
float roughness2 = roughness * roughness;
|
float roughness2 = roughness * roughness;
|
||||||
vec3 dndu = dFdx(normal), dndv = dFdx(normal);
|
vec2 dndu = dFdx(normal), dndv = dFdy(normal);
|
||||||
float variance = scene_data.roughness_limiter_amount * (dot(dndu, dndu) + dot(dndv, dndv));
|
float variance = scene_data.roughness_limiter_amount * (dot(dndu, dndu) + dot(dndv, dndv));
|
||||||
float kernelRoughness2 = min(2.0 * variance, scene_data.roughness_limiter_limit); //limit effect
|
float kernelRoughness2 = min(2.0 * variance, scene_data.roughness_limiter_limit); //limit effect
|
||||||
float filteredRoughness2 = min(1.0, roughness2 + kernelRoughness2);
|
float filteredRoughness2 = min(1.0, roughness2 + kernelRoughness2);
|
||||||
|
|||||||
@@ -761,7 +761,7 @@ void main() {
|
|||||||
if (scene_data.roughness_limiter_enabled) {
|
if (scene_data.roughness_limiter_enabled) {
|
||||||
//http://www.jp.square-enix.com/tech/library/pdf/ImprovedGeometricSpecularAA.pdf
|
//http://www.jp.square-enix.com/tech/library/pdf/ImprovedGeometricSpecularAA.pdf
|
||||||
float roughness2 = roughness * roughness;
|
float roughness2 = roughness * roughness;
|
||||||
vec3 dndu = dFdx(normal), dndv = dFdx(normal);
|
vec3 dndu = dFdx(normal), dndv = dFdy(normal);
|
||||||
float variance = scene_data.roughness_limiter_amount * (dot(dndu, dndu) + dot(dndv, dndv));
|
float variance = scene_data.roughness_limiter_amount * (dot(dndu, dndu) + dot(dndv, dndv));
|
||||||
float kernelRoughness2 = min(2.0 * variance, scene_data.roughness_limiter_limit); //limit effect
|
float kernelRoughness2 = min(2.0 * variance, scene_data.roughness_limiter_limit); //limit effect
|
||||||
float filteredRoughness2 = min(1.0, roughness2 + kernelRoughness2);
|
float filteredRoughness2 = min(1.0, roughness2 + kernelRoughness2);
|
||||||
|
|||||||
Reference in New Issue
Block a user