summaryrefslogtreecommitdiff
path: root/intermediate
diff options
context:
space:
mode:
Diffstat (limited to 'intermediate')
-rw-r--r--intermediate/mip_spec.glsl44
-rw-r--r--intermediate/plastic.mat2
-rw-r--r--intermediate/surface.glsl4
3 files changed, 47 insertions, 3 deletions
diff --git a/intermediate/mip_spec.glsl b/intermediate/mip_spec.glsl
new file mode 100644
index 0000000..bddcbb0
--- /dev/null
+++ b/intermediate/mip_spec.glsl
@@ -0,0 +1,44 @@
+#ifdef DESC
+[program]
+type: graphics
+vertex: main
+fragment: main
+
+[binding]
+name: verts
+rate: vertex
+[attribute]
+name: position
+type: vec2
+[attribute]
+name: uv
+type: vec2
+
+[interpolator]
+name: uv
+type: vec2
+
+[texture]
+name: src
+stage: fragment
+dimension: 2
+
+[target]
+name: colour
+type: vec4
+#endif
+
+#ifdef VERTEX_SHADER
+void main() {
+ interpolator.uv = uv;
+ gl_Position = vec4(position, 1.0, 1.0);
+}
+#endif
+
+#ifdef FRAGMENT_SHADER
+void main() {
+ vec2 uv = interpolator.uv;
+ colour = texture(src, uv);
+}
+#endif
+
diff --git a/intermediate/plastic.mat b/intermediate/plastic.mat
index 3d59385..bb52092 100644
--- a/intermediate/plastic.mat
+++ b/intermediate/plastic.mat
@@ -1,6 +1,6 @@
[params]
metalness: 0.0
-roughness: 0.1
+roughness: 0.3
ao: 1.0
albedo: ff0000
diff --git a/intermediate/surface.glsl b/intermediate/surface.glsl
index 8ec24f0..fab8694 100644
--- a/intermediate/surface.glsl
+++ b/intermediate/surface.glsl
@@ -165,8 +165,8 @@ void main() {
float met = texture(metal, uv).r * material.metalness;
vec3 ref = reflect(-view_dir, nrm);
- vec3 spec_col = texture(env_cube, ref).rgb;
- vec3 amb_col = texture(env_cube, nrm).rgb;
+ vec3 spec_col = texture(env_cube, ref, material.roughness * 8.0).rgb;
+ vec3 amb_col = textureLod(env_cube, nrm, 8.0).rgb;
vec3 diffuse =
diffuse_brdf(uv) *