update
This commit is contained in:
17
material_shaders/Shaders/MyCustomMaterial.frag.glsl
Normal file
17
material_shaders/Shaders/MyCustomMaterial.frag.glsl
Normal file
@ -0,0 +1,17 @@
|
||||
#version 450
|
||||
|
||||
in vec3 mpos;
|
||||
in vec3 normal;
|
||||
|
||||
// Color of each fragment on the screen
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
// Shadeless red color
|
||||
//fragColor = vec4(1.0,0.0,0.0,0.0);
|
||||
|
||||
// Assuming forward rendering path for simplicity
|
||||
vec3 col = (mpos + vec3(1.0)) / 8.0;
|
||||
col += normal * 0.1;
|
||||
fragColor = vec4(col, 1.0);
|
||||
}
|
||||
28
material_shaders/Shaders/MyCustomMaterial.vert.glsl
Normal file
28
material_shaders/Shaders/MyCustomMaterial.vert.glsl
Normal file
@ -0,0 +1,28 @@
|
||||
#version 450
|
||||
|
||||
// Armory uses packed vertex data to preserve memory
|
||||
in vec4 pos; // pos.xyz, nor.z
|
||||
in vec2 nor; // nor.xy
|
||||
|
||||
uniform mat4 WVP;
|
||||
uniform mat3 N;
|
||||
uniform float posUnpack;
|
||||
uniform float time;
|
||||
uniform float myParam;
|
||||
|
||||
out vec3 mpos;
|
||||
out vec3 normal;
|
||||
|
||||
void main() {
|
||||
vec4 p = vec4(pos.xyz, 1.0);
|
||||
|
||||
// Position data is packed into (-1, 1) range
|
||||
// Retrieve model position
|
||||
mpos = pos.xyz * posUnpack;
|
||||
|
||||
// Unpack normal.z component from pos.w
|
||||
normal = N * vec3(nor.xy, pos.w);
|
||||
|
||||
p.z += sin((time + mpos.x + mpos.y) * 2.0) * 0.2 * myParam;
|
||||
gl_Position = WVP * p;
|
||||
}
|
||||
Reference in New Issue
Block a user