light_data_inc.glsl 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #define LIGHT_BAKE_DISABLED 0
  2. #define LIGHT_BAKE_STATIC 1
  3. #define LIGHT_BAKE_DYNAMIC 2
  4. struct LightData { //this structure needs to be as packed as possible
  5. highp vec3 position;
  6. highp float inv_radius;
  7. mediump vec3 direction;
  8. highp float size;
  9. mediump vec3 color;
  10. mediump float attenuation;
  11. mediump float cone_attenuation;
  12. mediump float cone_angle;
  13. mediump float specular_amount;
  14. mediump float shadow_opacity;
  15. highp vec4 atlas_rect; // rect in the shadow atlas
  16. highp mat4 shadow_matrix;
  17. highp float shadow_bias;
  18. highp float shadow_normal_bias;
  19. highp float transmittance_bias;
  20. highp float soft_shadow_size; // for spot, it's the size in uv coordinates of the light, for omni it's the span angle
  21. highp float soft_shadow_scale; // scales the shadow kernel for blurrier shadows
  22. uint mask;
  23. mediump float volumetric_fog_energy;
  24. uint bake_mode;
  25. highp vec4 projector_rect; //projector rect in srgb decal atlas
  26. };
  27. #define REFLECTION_AMBIENT_DISABLED 0
  28. #define REFLECTION_AMBIENT_ENVIRONMENT 1
  29. #define REFLECTION_AMBIENT_COLOR 2
  30. struct ReflectionData {
  31. highp vec3 box_extents;
  32. mediump float index;
  33. highp vec3 box_offset;
  34. uint mask;
  35. mediump vec3 ambient; // ambient color
  36. mediump float intensity;
  37. bool exterior;
  38. bool box_project;
  39. uint ambient_mode;
  40. float exposure_normalization;
  41. //0-8 is intensity,8-9 is ambient, mode
  42. highp mat4 local_matrix; // up to here for spot and omni, rest is for directional
  43. // notes: for ambientblend, use distance to edge to blend between already existing global environment
  44. };
  45. struct DirectionalLightData {
  46. mediump vec3 direction;
  47. highp float energy; // needs to be highp to avoid NaNs being created with high energy values (i.e. when using physical light units and over-exposing the image)
  48. mediump vec3 color;
  49. mediump float size;
  50. mediump float specular;
  51. uint mask;
  52. highp float softshadow_angle;
  53. highp float soft_shadow_scale;
  54. bool blend_splits;
  55. mediump float shadow_opacity;
  56. highp float fade_from;
  57. highp float fade_to;
  58. uvec2 pad;
  59. uint bake_mode;
  60. mediump float volumetric_fog_energy;
  61. highp vec4 shadow_bias;
  62. highp vec4 shadow_normal_bias;
  63. highp vec4 shadow_transmittance_bias;
  64. highp vec4 shadow_z_range;
  65. highp vec4 shadow_range_begin;
  66. highp vec4 shadow_split_offsets;
  67. highp mat4 shadow_matrix1;
  68. highp mat4 shadow_matrix2;
  69. highp mat4 shadow_matrix3;
  70. highp mat4 shadow_matrix4;
  71. highp vec2 uv_scale1;
  72. highp vec2 uv_scale2;
  73. highp vec2 uv_scale3;
  74. highp vec2 uv_scale4;
  75. };