Untitled
Loading...
Searching...
No Matches
point_light_shadows.frag
Go to the documentation of this file.
1#version 430 core
2
3#extension GL_ARB_bindless_texture : require
4struct Material
5{
6
7 vec4 ambient;
8 vec4 diffuse;
9 vec4 specular;
10 vec4 emissive;
12 uint pad0;
13 uint pad1;
15 uint pad2;
16 uint pad3;
17
18 sampler2D albedo_tex;
19 sampler2D normal_tex;
20 sampler2D arm_tex;
21 sampler2D emissive_tex;
22
23 float metallic;
24 float roughness;
25 float ao_strength;
26 float normal_scale;
27 uint alpha_mode;
28 float alpha_cutoff;
29 uint double_sided;
31
32};
33
34
35layout(std430, binding = 2) buffer MaterialData {
36
37 Material materials[];
38
39};
40
42
44uniform float uFar;
45
46flat in uint vMat;
48void main()
49{
50
51
52 float lightDistance = length(FragWorldPos - uLightPos);
53
54
55 Material mat = materials[vMat];
56 vec4 albedo = texture(mat.albedo_tex, vUV) * mat.diffuse;
57 if (albedo.a < 0.8f) discard;
58
59 gl_FragDepth = lightDistance / uFar;
60}
layout(local_size_x=16, local_size_y=16) in
void main()
uniform float uFar
uniform vec3 uLightPos
The GPU side SSBO structure.
sampler2D albedo_tex
float normal_scale
Unused - Used to determine how much of the texture normal to use.
sampler2D emissive_tex
float emissive_strength
sampler2D arm_tex
sampler2D normal_tex
float alpha_cutoff
Used to discard transparent Materials.
float absorption_coefficients[6]
How much audio is absorbed when hitting this Material.
float scattering_coefficients[6]
How much audio specularly reflects when hitting this Material.
The Materials parsed in from scene files that determine rendering pipeline setup, uploads,...
in vec2 vUV
Definition lightmap.frag:13
flat in uint vMat
in vec3 FragWorldPos
Definition types.h:11
Definition types.h:12
Definition types.h:13