-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added the getting started notebook
- Loading branch information
1 parent
7e92df3
commit d0c9f2c
Showing
14 changed files
with
946 additions
and
777 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
shader PerlinNoise { | ||
vertex { | ||
input vec3 position; | ||
output vec2 vUV; | ||
|
||
void main() { | ||
vUV = position.xy * 10.0; | ||
gl_Position = vec4(position, 1.0); | ||
} | ||
} | ||
|
||
// Perlin Noise Function | ||
float perlinNoise(vec2 p) { | ||
return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453); | ||
} | ||
|
||
// Fragment Shader | ||
fragment { | ||
input vec2 vUV; | ||
output vec4 fragColor; | ||
|
||
void main() { | ||
float noise = perlinNoise(vUV); | ||
float height = noise * 10.0; | ||
vec3 color = vec3(height / 10.0, 1.0 - height / 10.0, 0.0); | ||
fragColor = vec4(color, 1.0); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#version 450 core | ||
|
||
//vertex shader | ||
layout(location = 0) in vec3 position; | ||
layout(location = 1) in vec2 texCoord; | ||
|
||
out vec2 vTexCoord; | ||
|
||
void main() | ||
{ | ||
vTexCoord = texCoord; | ||
gl_Position = vec4(position, 1.0); | ||
} | ||
|
||
in vec2 vTexCoord; | ||
out vec4 fragColor; | ||
|
||
// fragment shader | ||
|
||
float marblePattern(vec2 uv) { | ||
return 0.5 + 0.5 * sin(10.0 * uv.x + iTime); | ||
} | ||
|
||
void main() | ||
{ | ||
vec3 color = vec3(marblePattern(vTexCoord), 0.0, 0.0); | ||
fragColor = vec4(color, 1.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
float perlinNoise(float2 p) { | ||
return fract((sin(dot(p, float2(12.9898, 78.233))) * 43758.5453)); | ||
} | ||
|
||
struct Vertex_INPUT { | ||
float3 position : POSITION; | ||
}; | ||
|
||
struct Vertex_OUTPUT { | ||
float4 position : SV_POSITION; | ||
float2 vUV : TEXCOORD0; | ||
}; | ||
|
||
Vertex_OUTPUT VSMain(Vertex_INPUT input) { | ||
Vertex_OUTPUT output; | ||
output.vUV = (input.position.xy * 10.0); | ||
output.position = float4(input.position, 1.0); | ||
return output; | ||
} | ||
|
||
struct Fragment_INPUT { | ||
float2 vUV : TEXCOORD0; | ||
}; | ||
|
||
struct Fragment_OUTPUT { | ||
float4 fragColor : SV_TARGET0; | ||
}; | ||
|
||
Fragment_OUTPUT PSMain(Fragment_INPUT input) { | ||
Fragment_OUTPUT output; | ||
float noise = perlinNoise(input.vUV); | ||
float height = (noise * 10.0); | ||
float3 color = float3((height / 10.0), (1.0 - (height / 10.0)), 0.0); | ||
output.fragColor = float4(color, 1.0); | ||
return output; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include <metal_stdlib> | ||
using namespace metal; | ||
|
||
float perlinNoise(float2 p) { | ||
return fract((sin(dot(p, float2(12.9898, 78.233))) * 43758.5453)); | ||
} | ||
|
||
struct Vertex_INPUT { | ||
float3 position [[attribute(0)]]; | ||
}; | ||
|
||
struct Vertex_OUTPUT { | ||
float4 position [[position]]; | ||
float2 vUV; | ||
}; | ||
|
||
vertex Vertex_OUTPUT vertex_main(Vertex_INPUT input [[stage_in]]) { | ||
Vertex_OUTPUT output; | ||
output.vUV = (input.position.xy * 10.0); | ||
output.position = float4(input.position, 1.0); | ||
return output; | ||
} | ||
|
||
struct Fragment_INPUT { | ||
float2 vUV [[stage_in]]; | ||
}; | ||
|
||
struct Fragment_OUTPUT { | ||
float4 fragColor [[color(0)]]; | ||
}; | ||
|
||
fragment Fragment_OUTPUT fragment_main(Fragment_INPUT input [[stage_in]]) { | ||
Fragment_OUTPUT output; | ||
float noise = perlinNoise(input.vUV); | ||
float height = (noise * 10.0); | ||
float3 color = float3((height / 10.0), (1.0 - (height / 10.0)), 0.0); | ||
output.fragColor = float4(color, 1.0); | ||
return output; | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.