-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
608ffd5
commit c0b3ed9
Showing
15 changed files
with
553 additions
and
2 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
140 changes: 140 additions & 0 deletions
140
Vulkan/Vulkan_Sample/Vulkan/assets/models/displacement_plane.gltf
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,140 @@ | ||
{ | ||
"asset" : { | ||
"generator" : "Khronos glTF Blender I/O v1.2.75", | ||
"version" : "2.0" | ||
}, | ||
"scene" : 0, | ||
"scenes" : [ | ||
{ | ||
"name" : "Scene", | ||
"nodes" : [ | ||
0 | ||
] | ||
} | ||
], | ||
"nodes" : [ | ||
{ | ||
"mesh" : 0, | ||
"name" : "plane", | ||
"rotation" : [ | ||
0.7071068286895752, | ||
0, | ||
0, | ||
0.7071067094802856 | ||
] | ||
} | ||
], | ||
"materials" : [ | ||
{ | ||
"doubleSided" : true, | ||
"emissiveFactor" : [ | ||
0, | ||
0, | ||
0 | ||
], | ||
"name" : "Default OBJ", | ||
"pbrMetallicRoughness" : { | ||
"baseColorFactor" : [ | ||
0.800000011920929, | ||
0.800000011920929, | ||
0.800000011920929, | ||
1 | ||
], | ||
"metallicFactor" : 0, | ||
"roughnessFactor" : 0.5 | ||
} | ||
} | ||
], | ||
"meshes" : [ | ||
{ | ||
"name" : "plane", | ||
"primitives" : [ | ||
{ | ||
"attributes" : { | ||
"POSITION" : 0, | ||
"NORMAL" : 1, | ||
"TANGENT" : 2, | ||
"TEXCOORD_0" : 3 | ||
}, | ||
"indices" : 4, | ||
"material" : 0 | ||
} | ||
] | ||
} | ||
], | ||
"accessors" : [ | ||
{ | ||
"bufferView" : 0, | ||
"componentType" : 5126, | ||
"count" : 25, | ||
"max" : [ | ||
2.5, | ||
2.5, | ||
-2.046362990897662e-14 | ||
], | ||
"min" : [ | ||
-2.5, | ||
-2.5, | ||
-2.046362990897662e-14 | ||
], | ||
"type" : "VEC3" | ||
}, | ||
{ | ||
"bufferView" : 1, | ||
"componentType" : 5126, | ||
"count" : 25, | ||
"type" : "VEC3" | ||
}, | ||
{ | ||
"bufferView" : 2, | ||
"componentType" : 5126, | ||
"count" : 25, | ||
"type" : "VEC4" | ||
}, | ||
{ | ||
"bufferView" : 3, | ||
"componentType" : 5126, | ||
"count" : 25, | ||
"type" : "VEC2" | ||
}, | ||
{ | ||
"bufferView" : 4, | ||
"componentType" : 5123, | ||
"count" : 96, | ||
"type" : "SCALAR" | ||
} | ||
], | ||
"bufferViews" : [ | ||
{ | ||
"buffer" : 0, | ||
"byteLength" : 300, | ||
"byteOffset" : 0 | ||
}, | ||
{ | ||
"buffer" : 0, | ||
"byteLength" : 300, | ||
"byteOffset" : 300 | ||
}, | ||
{ | ||
"buffer" : 0, | ||
"byteLength" : 400, | ||
"byteOffset" : 600 | ||
}, | ||
{ | ||
"buffer" : 0, | ||
"byteLength" : 200, | ||
"byteOffset" : 1000 | ||
}, | ||
{ | ||
"buffer" : 0, | ||
"byteLength" : 192, | ||
"byteOffset" : 1200 | ||
} | ||
], | ||
"buffers" : [ | ||
{ | ||
"byteLength" : 1392, | ||
"uri" : "data:application/octet-stream;base64,AAAgwAAAoD/rUbioAAAgwAAAIEDrUbioAACgvwAAoD/rUbioAACgvwAAIEDrUbioAAAAAAAAoD/rUbioAAAAAAAAIEDrUbioAACgPwAAoD/rUbioAACgPwAAIEDrUbioAAAgQAAAoD/rUbioAAAgQAAAIEDrUbioAAAgwPLne53rUbioAACgv/Lne53rUbioAAAAAPLne53rUbioAACgP/Lne53rUbioAAAgQPLne53rUbioAAAgwAAAoL/rUbioAACgvwAAoL/rUbioAAAAAAAA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sf78S+58/uNh/vhD7nz9Y7H+/9v//PpDYf77w//8+WOx/v7TYf76Q2H++wNh/vljsf79S7H+/uNh/vlTsf79Y7H+/Jfb/P/r//z4S+58/AwAAP/b//z4DAAA/sNh/vgMAAD9S7H+/+v//Pin2/z8S+58/EvufPxb7nz/5//8+FvufP6jYf74W+58/Tux/vxf7nz8p9v8/Kvb/PxP7nz8r9v8/////Piv2/z+o2H++K/b/P07sf78s9v8/AAABAAIAAwACAAEAAgADAAQABQAEAAMABAAFAAYABwAGAAUABgAHAAgACQAIAAcACgAAAAsAAgALAAAACwACAAwABAAMAAIADAAEAA0ABgANAAQADQAGAA4ACAAOAAYADwAKABAACwAQAAoAEAALABEADAARAAsAEQAMABIADQASAAwAEgANABMADgATAA0AFAAPABUAEAAVAA8AFQAQABYAEQAWABAAFgARABcAEgAXABEAFwASABgAEwAYABIA" | ||
} | ||
] | ||
} |
26 changes: 26 additions & 0 deletions
26
Vulkan/Vulkan_Sample/Vulkan/assets/shaders/displacement/base.frag
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,26 @@ | ||
#version 450 | ||
|
||
layout (binding = 2) uniform sampler2D colorMap; | ||
|
||
layout (location = 0) in vec3 inNormal; | ||
layout (location = 1) in vec2 inUV; | ||
layout (location = 2) in vec3 inEyePos; | ||
layout (location = 3) in vec3 inLightVec; | ||
|
||
layout (location = 0) out vec4 outFragColor; | ||
|
||
void main() | ||
{ | ||
vec3 N = normalize(inNormal); | ||
vec3 L = normalize(vec3(1.0)); | ||
|
||
outFragColor.rgb = texture(colorMap, inUV).rgb; | ||
|
||
vec3 Eye = normalize(-inEyePos); | ||
vec3 Reflected = normalize(reflect(-inLightVec, inNormal)); | ||
|
||
vec4 IAmbient = vec4(0.0, 0.0, 0.0, 1.0); | ||
vec4 IDiffuse = vec4(1.0) * max(dot(inNormal, inLightVec), 0.0); | ||
|
||
outFragColor = vec4((IAmbient + IDiffuse) * vec4(texture(colorMap, inUV).rgb, 1.0)); | ||
} |
Binary file added
BIN
+1.89 KB
Vulkan/Vulkan_Sample/Vulkan/assets/shaders/displacement/base.frag.spv
Binary file not shown.
15 changes: 15 additions & 0 deletions
15
Vulkan/Vulkan_Sample/Vulkan/assets/shaders/displacement/base.vert
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,15 @@ | ||
#version 450 | ||
|
||
layout (location = 0) in vec3 inPos; | ||
layout (location = 1) in vec3 inNormal; | ||
layout (location = 2) in vec2 inUV; | ||
|
||
layout (location = 0) out vec3 outNormal; | ||
layout (location = 1) out vec2 outUV; | ||
|
||
void main(void) | ||
{ | ||
gl_Position = vec4(inPos.xyz, 1.0); | ||
outUV = inUV; | ||
outNormal = inNormal; | ||
} |
Binary file added
BIN
+1.13 KB
Vulkan/Vulkan_Sample/Vulkan/assets/shaders/displacement/base.vert.spv
Binary file not shown.
29 changes: 29 additions & 0 deletions
29
Vulkan/Vulkan_Sample/Vulkan/assets/shaders/displacement/displacement.tesc
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 @@ | ||
#version 450 | ||
|
||
layout (binding = 0) uniform UBO | ||
{ | ||
float tessLevel; | ||
} ubo; | ||
|
||
layout (vertices = 3) out; | ||
|
||
layout (location = 0) in vec3 inNormal[]; | ||
layout (location = 1) in vec2 inUV[]; | ||
|
||
layout (location = 0) out vec3 outNormal[3]; | ||
layout (location = 1) out vec2 outUV[3]; | ||
|
||
void main() | ||
{ | ||
if (gl_InvocationID == 0) | ||
{ | ||
gl_TessLevelInner[0] = ubo.tessLevel; | ||
gl_TessLevelOuter[0] = ubo.tessLevel; | ||
gl_TessLevelOuter[1] = ubo.tessLevel; | ||
gl_TessLevelOuter[2] = ubo.tessLevel; | ||
} | ||
|
||
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; | ||
outNormal[gl_InvocationID] = inNormal[gl_InvocationID]; | ||
outUV[gl_InvocationID] = inUV[gl_InvocationID]; | ||
} |
Binary file added
BIN
+2.59 KB
Vulkan/Vulkan_Sample/Vulkan/assets/shaders/displacement/displacement.tesc.spv
Binary file not shown.
36 changes: 36 additions & 0 deletions
36
Vulkan/Vulkan_Sample/Vulkan/assets/shaders/displacement/displacement.tese
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,36 @@ | ||
#version 450 | ||
|
||
layout (binding = 1) uniform UBO | ||
{ | ||
mat4 projection; | ||
mat4 modelview; | ||
vec4 lightPos; | ||
float tessAlpha; | ||
float tessStrength; | ||
} ubo; | ||
|
||
layout (binding = 2) uniform sampler2D displacementMap; | ||
|
||
layout(triangles, equal_spacing, cw) in; | ||
|
||
layout (location = 0) in vec3 inNormal[]; | ||
layout (location = 1) in vec2 inUV[]; | ||
|
||
layout (location = 0) out vec3 outNormal; | ||
layout (location = 1) out vec2 outUV; | ||
layout (location = 2) out vec3 outEyesPos; | ||
layout (location = 3) out vec3 outLightVec; | ||
|
||
void main() | ||
{ | ||
gl_Position = (gl_TessCoord.x * gl_in[0].gl_Position) + (gl_TessCoord.y * gl_in[1].gl_Position) + (gl_TessCoord.z * gl_in[2].gl_Position); | ||
outUV = gl_TessCoord.x * inUV[0] + gl_TessCoord.y * inUV[1] + gl_TessCoord.z * inUV[2]; | ||
outNormal = gl_TessCoord.x * inNormal[0] + gl_TessCoord.y * inNormal[1] + gl_TessCoord.z * inNormal[2]; | ||
|
||
gl_Position.xyz += normalize(outNormal) * (max(textureLod(displacementMap, outUV.st, 0.0).a, 0.0) * ubo.tessStrength); | ||
|
||
outEyesPos = (gl_Position).xyz; | ||
outLightVec = normalize(ubo.lightPos.xyz - outEyesPos); | ||
|
||
gl_Position = ubo.projection * ubo.modelview * gl_Position; | ||
} |
Binary file added
BIN
+3.99 KB
Vulkan/Vulkan_Sample/Vulkan/assets/shaders/displacement/displacement.tese.spv
Binary file not shown.
Binary file added
BIN
+5.33 MB
Vulkan/Vulkan_Sample/Vulkan/assets/textures/stonefloor03_color_height_rgba.ktx
Binary file not shown.
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
Oops, something went wrong.