-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathlighting_pbrGlass.frag
49 lines (36 loc) · 1.18 KB
/
lighting_pbrGlass.frag
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright Patricio Gonzalez Vivo, 2022 - http://patriciogonzalezvivo.com/
#ifdef GL_ES
precision mediump float;
#endif
uniform samplerCube u_cubeMap;
uniform vec3 u_SH[9];
uniform vec3 u_camera;
uniform vec3 u_light;
uniform vec3 u_lightColor;
uniform vec2 u_resolution;
uniform float u_time;
varying vec4 v_position;
varying vec4 v_color;
varying vec3 v_normal;
varying vec2 v_texcoord;
#define RESOLUTION u_resolution
#define SURFACE_POSITION v_position
#define CAMERA_POSITION u_camera
#define LIGHT_DIRECTION u_light
#define LIGHT_COLOR u_lightColor
// #define TRANSPARENT_DISPERSION 0.1
// #define TRANSPARENT_DISPERSION_PASSES 4
// #define TRANSPARENT_DISPERSION_FAST
#include "lygia/color/space/linear2gamma.glsl"
#include "lygia/lighting/pbrGlass.glsl"
#include "lygia/lighting/material/new.glsl"
void main(void) {
vec4 color = vec4(0.0, 0.0, 0.0, 1.0);
vec2 pixel = 1.0/u_resolution;
vec2 st = gl_FragCoord.xy * pixel;
Material mat = materialNew();
// mat.roughness = 0.05;
color = pbrGlass(mat);
color = linear2gamma(color);
gl_FragColor = color;
}