1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-16 14:00:40 +00:00

Refactored 2D shader and lighting system

-Removed normal/specular properties from nodes
-Create CanvasTexture, which can contain normal/specular channels
-Refactored, optimized and simplified 2D shaders
-Use atlas for light textures.
-Use a shadow atlas for shadow textures.
-Use both items aboves to make light rendering stateless (faster).
-Reorganized uniform sets for more efficiency.
This commit is contained in:
reduz
2020-10-24 12:15:43 -03:00
parent b67ccf1a6f
commit 84d734da0e
48 changed files with 1330 additions and 1471 deletions

View File

@@ -8,7 +8,8 @@ layout(push_constant, binding = 0, std430) uniform Constants {
mat4 projection;
mat2x4 modelview;
vec2 direction;
vec2 pad;
float z_far;
float pad;
}
constants;
@@ -25,9 +26,18 @@ void main() {
#version 450
layout(push_constant, binding = 0, std430) uniform Constants {
mat4 projection;
mat2x4 modelview;
vec2 direction;
float z_far;
float pad;
}
constants;
layout(location = 0) in highp float depth;
layout(location = 0) out highp float distance_buf;
void main() {
distance_buf = depth;
distance_buf = depth / constants.z_far;
}