Merge glTF scene rendering sample (#744)
* Started reworking the scene rendering to sample Use glTF instead of ASSIMP, per-material pipelines, material loading, etc. * Visibility toggle for scene nodes * Fixed lighting, updated GLSL and HLSL shaders * Renamed sample * Code-Cleanup, comments, validation fixes * Android build * Started on tutorial for glTF scene rendering sample * Minor code cleanup * Adding new chapters to the tutorial for glTF scene rendering sample * Added info on normal map shader bindings, spelling * Added drawing chapter * Getter for texture descriptors Makes code a easier to read * Renamed glTF scene sample * Add markdown files to projects * Updated readme, separate chapter for glTF samples * Comments * Removed unused screenshot
This commit is contained in:
parent
889125c377
commit
e370e6d169
44 changed files with 1389 additions and 1044 deletions
24
data/shaders/glsl/gltfloading/mesh.frag
Normal file
24
data/shaders/glsl/gltfloading/mesh.frag
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#version 450
|
||||
|
||||
layout (set = 1, binding = 0) uniform sampler2D samplerColorMap;
|
||||
|
||||
layout (location = 0) in vec3 inNormal;
|
||||
layout (location = 1) in vec3 inColor;
|
||||
layout (location = 2) in vec2 inUV;
|
||||
layout (location = 3) in vec3 inViewVec;
|
||||
layout (location = 4) in vec3 inLightVec;
|
||||
|
||||
layout (location = 0) out vec4 outFragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color = texture(samplerColorMap, inUV) * vec4(inColor, 1.0);
|
||||
|
||||
vec3 N = normalize(inNormal);
|
||||
vec3 L = normalize(inLightVec);
|
||||
vec3 V = normalize(inViewVec);
|
||||
vec3 R = reflect(-L, N);
|
||||
vec3 diffuse = max(dot(N, L), 0.15) * inColor;
|
||||
vec3 specular = pow(max(dot(R, V), 0.0), 16.0) * vec3(0.75);
|
||||
outFragColor = vec4(diffuse * color.rgb + specular, 1.0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue