You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Refactored shadowmapping.
- Made shadow bias size independent, so it will remain when changing light or camera size. - Implemented normal offset bias, which greatly enhances quality. - Added transmission to subsurface scattering - Reimplemented shadow filter modes Closes #17260
This commit is contained in:
@@ -170,17 +170,15 @@ public:
|
||||
_add_item(aabb, ITEM_TYPE_OMNI_LIGHT, light_count);
|
||||
} break;
|
||||
case LIGHT_TYPE_SPOT: {
|
||||
Vector3 v(0, 0, -1);
|
||||
v.rotated(Vector3(0, 1, 0), Math::deg2rad(ld.spot_aperture)); //rotate in x-z
|
||||
v.normalize();
|
||||
v *= ld.radius;
|
||||
v.y = v.x;
|
||||
|
||||
float r = ld.radius;
|
||||
real_t len = Math::tan(Math::deg2rad(ld.spot_aperture)) * r;
|
||||
|
||||
aabb.position = xform.origin;
|
||||
aabb.expand_to(xform.xform(v));
|
||||
aabb.expand_to(xform.xform(Vector3(-v.x, v.y, v.z)));
|
||||
aabb.expand_to(xform.xform(Vector3(-v.x, -v.y, v.z)));
|
||||
aabb.expand_to(xform.xform(Vector3(v.x, -v.y, v.z)));
|
||||
aabb.expand_to(xform.xform(Vector3(len, len, -r)));
|
||||
aabb.expand_to(xform.xform(Vector3(-len, len, -r)));
|
||||
aabb.expand_to(xform.xform(Vector3(-len, -len, -r)));
|
||||
aabb.expand_to(xform.xform(Vector3(len, -len, -r)));
|
||||
_add_item(aabb, ITEM_TYPE_SPOT_LIGHT, light_count);
|
||||
} break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user