Debian Codegraph @

src/scene/glsl/source/lighting_model_physical/structures.glsl

raw
1 /*
2 Copyright 2020-2020 Michalis Kamburelis and glTF-Sample-Viewer authors.
3
4 This file is part of "Castle Game Engine".
5
6 "Castle Game Engine" is free software; see the file COPYING.txt,
7 included in this distribution, for details about the copyright.
8
9 "Castle Game Engine" is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13 ----------------------------------------------------------------------------
14
15 Structures for Physical (PBR) lighting model.
16 They are included in a special way, to make GLSL code compile both with and without
17 "separate compilation units".
18
19 Code below is adapted from glTF-Sample-Viewer ( Apache License 2.0 )
20 https://github.com/KhronosGroup/glTF-Sample-Viewer/
21 In particular src/shaders/metallic-roughness.frag .
22 */
23
24 struct AngularInfo
25 {
26 float NdotL; // cos angle between normal and light direction
27 float NdotV; // cos angle between normal and view direction
28 float NdotH; // cos angle between normal and half vector
29 float LdotH; // cos angle between light direction and half vector
30
31 float VdotH; // cos angle between view direction and half vector
32
33 vec3 padding;
34 };
35
36 struct MaterialInfo
37 {
38 float perceptualRoughness; // roughness value, as authored by the model creator (input to shader)
39 vec3 reflectance0; // full reflectance color (normal incidence angle)
40
41 float alphaRoughness; // roughness mapped to a more linear change in the roughness (proposed by [2])
42 vec3 diffuseColor; // color contribution from diffuse lighting
43
44 vec3 reflectance90; // reflectance color at grazing angle
45 vec3 specularColor; // color contribution from specular lighting
46 };