[GL] Shader compiler returned errors: "Fragment:
0(96) : error C1008: undefined variable "WorldPosition"
0(97) : error C1008: undefined variable "Normals"
1: #version 430
2: #define __SHADER_STAGE__
3:
4:
5:
6:
7: layout(std140, binding = 0)
8: uniform PerMaterial
9: {
10: float AlphaTestValue;
11: vec4 DiffuseColor;
12: bool HasColorTexture;
13: bool HasOpacityTexture;
14: float PerfectReflectionFresnel;
15: mat3x3 TexCoordTransform;
16: vec3 TransmissionColor;
17: bool UseDielectric;
18: };
19:
20:
21: layout(std140, binding = 1)
22: uniform Global
23: {
24: vec3 BiasParameters;
25: };
26:
27:
28: layout(std140, binding = 2)
29: uniform PerView
30: {
31: vec3 CameraLocation;
32: mat4x4 ProjTrafo;
33: mat4x4 ViewTrafo;
34: };
35:
36:
37: layout(std140, binding = 3)
38: uniform GlobalHF
39: {
40: vec4 ClipPlaneCoefficients;
41: };
42:
43:
44: layout(std140, binding = 4)
45: uniform PerModel
46: {
47: mat4x4 ModelTrafo;
48: mat3x3 NormalMatrix;
49: };
50:
51:
52: layout(binding = 0)
53: uniform sampler2D alphaSampler;
54: layout(binding = 1)
55: uniform sampler2D secondaryDepthSampler;
56: layout(binding = 2)
57: uniform sampler2D texSampler;
58:
59: float HiliteShaders_ReflectionSampling_fresnel_a7mAmvWk3Rb00qZneUwhmGA(float r0, float dotVN)
60: {
61: return clamp((r0 + ((1.0 - r0) * pow((1.0 - dotVN), 5.0))), 0.0, 1.0);
62: }
63:
64:
65:
66: #ifdef Vertex
67:
68: layout(location = 0) in vec2 DiffuseColorCoordinates;
69: layout(location = 1) in vec3 Normals;
70: layout(location = 2) in vec4 Positions;
71: layout(location = 0) out vec2 fs_DiffuseColorCoordinates;
72: layout(location = 1) out vec3 fs_Normals;
73: layout(location = 2) out vec4 fs_WorldPosition;
74: void main()
75: {
76: vec4 wp = (Positions * ModelTrafo);
77: vec4 vp = (wp * ViewTrafo);
78: vec4 pp = (vp * ProjTrafo);
79: float clipDistance = dot(wp, ClipPlaneCoefficients);
80: vec3 texCoord = (vec3(DiffuseColorCoordinates.x, DiffuseColorCoordinates.y, 1.0) * TexCoordTransform);
81: gl_ClipDistance[0] = clipDistance;
82: fs_DiffuseColorCoordinates = vec2(texCoord.x, (1.0 - texCoord.y));
83: fs_Normals = (Normals * NormalMatrix);
84: gl_Position = pp;
85: fs_WorldPosition = wp;
86: }
87:
88: #endif
89:
90:
91:
92: #ifdef Fragment
93:
94: vec3 helper(vec4 WorldPosition1, vec3 Normals1)
95: {
96: vec3 eye = normalize((CameraLocation - WorldPosition.xyz));
97: float dotVN = clamp(dot(eye, normalize(Normals)), 0.0, 1.0);
98: float f_refr = (UseDielectric ? (1.0 - HiliteShaders_ReflectionSampling_fresnel_a7mAmvWk3Rb00qZneUwhmGA(PerfectReflectionFresnel, dotVN)) : 1.0);
99: return (TransmissionColor * f_refr);
100: }
101:
102: layout(location = 0) in vec2 fs_DiffuseColorCoordinates;
103: layout(location = 1) in vec3 fs_Normals;
104: layout(location = 2) in vec4 fs_WorldPosition;
105: layout(location = 0) out vec4 ColorsOut;
106: void main()
107: {
108: float depthNear = texelFetch(secondaryDepthSampler, ivec2(gl_FragCoord.xy), 0).x;
109: bool valid = (gl_FragCoord.z > depthNear);
110: if((!valid))
111: {
112: discard;
113: }
114: vec4 color = (vec4(1.0, 1.0, 1.0, 1.0) * DiffuseColor);
115: vec4 color1 = (HasColorTexture ? (color * texture(texSampler, fs_DiffuseColorCoordinates)) : color);
116: vec4 color2 = (HasOpacityTexture ? vec4(color1.xyz, (color1.w * texture(alphaSampler, fs_DiffuseColorCoordinates).x)) : color1);
117: if((color2.w <= AlphaTestValue))
118: {
119: discard;
120: }
121: vec4 viewPos = (fs_WorldPosition * ViewTrafo);
122: bool isOrtho = (ProjTrafo[3][3] == 1.0);
123: vec3 l = (isOrtho ? ViewTrafo[2].xyz : normalize((CameraLocation - fs_WorldPosition.xyz)));
124: float slope = dot(normalize(fs_Normals), l);
125: float a = sqrt((1.0 - (slope * slope)));
126: float b = max(BiasParameters.z, abs(slope));
127: float bias = (BiasParameters.x + ((BiasParameters.y * a) / b));
128: float bias1 = (bias * 2.0);
129: float depthBias = (isOrtho ? (bias1 / (-((abs(ProjTrafo[0][0]) + abs(ProjTrafo[1][1])) * 0.5))) : ((bias1 * viewPos.z) * 2.0));
130: vec4 viewPos1 = vec4(viewPos.x, viewPos.y, (viewPos.z + depthBias), viewPos.w);
131: vec4 projPos = (viewPos1 * ProjTrafo);
132: float ndc_depth = (projPos.z / projPos.w);
133: float depth = ((((1.0 * ndc_depth) + 0.0) + 1.0) / 2.0);
134: vec3 trans = ((dot(TransmissionColor, vec3(1.0, 1.0, 1.0)) > 0.0) ? helper(fs_WorldPosition, fs_Normals) : vec3(0.0, 0.0, 0.0));
135: vec3 trans1 = mix(trans,vec3(1.0, 1.0, 1.0),(1.0 - color2.w));
136: vec4 Colors2C = vec4(trans1, 1.0);
137: ColorsOut = Colors2C;
138: gl_FragDepth = depth;
139: }
140:
141: #endif