Simple Shading
This commit is contained in:
1 parent
46b7b28b2b
commit
c613d00511
3 files changed
+95
-40
No files matched your search
Executable
+16
@@ -0,0 +1,16 @@
|
||||
precision mediump float;
|
||||
|
||||
uniform sampler2D Texture;
|
||||
uniform float Transparency;
|
||||
uniform vec4 LightDirection;
|
||||
|
||||
varying vec2 texCoord;
|
||||
varying vec3 fragNormal;
|
||||
|
||||
void main() {
|
||||
vec4 color = texture2D(Texture, texCoord).rgba;
|
||||
float intensity = dot(normalize(LightDirection.xyz), -normalize(fragNormal));
|
||||
|
||||
gl_FragColor = vec4(color.rgb * intensity*0.5 + vec3(0.5, 0.5, 0.5), color.a * Transparency);
|
||||
//gl_FragColor = vec4((fragNormal.rgb + vec3(1.0, 1.0, 1.0))*0.5, 1.0);
|
||||
}
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
attribute vec3 vPosition;
|
||||
attribute vec3 Normal;
|
||||
attribute vec2 vTexCoord;
|
||||
|
||||
uniform mat4 ProjectionMatrix;
|
||||
|
||||
varying vec2 texCoord;
|
||||
varying vec3 fragNormal;
|
||||
|
||||
void main() {
|
||||
gl_Position = ProjectionMatrix * vec4(vPosition.xyz, 1.0);
|
||||
texCoord = vTexCoord;
|
||||
fragNormal = Normal;
|
||||
}
|
||||
Reference in new issue
Block a user