diff --git a/assets/shaders/default.frag b/assets/shaders/default.frag index c7a6d6f..3a82fbb 100755 --- a/assets/shaders/default.frag +++ b/assets/shaders/default.frag @@ -5,6 +5,8 @@ struct Material { vec4 baseColor; uint albedoTexture; + uint normalTexture; + float metallicFactor; float roughnessFactor; uint metallicRoughnessTexture; diff --git a/assets/shaders/default.vert b/assets/shaders/default.vert index 41ae5c5..5b29b95 100755 --- a/assets/shaders/default.vert +++ b/assets/shaders/default.vert @@ -5,6 +5,8 @@ struct Material { vec4 baseColor; uint albedoTexture; + uint normalTexture; + float metallicFactor; float roughnessFactor; uint metallicRoughnessTexture; @@ -72,8 +74,14 @@ void main() uint index = IndexBuffers[ PushConstants.indexBufferIndex ].indices[gl_VertexIndex]; Vertex vertex = VertexBuffers[ PushConstants.vertexBufferIndex ].vertices[ index ]; - color = texture(texSampler[material.albedoTexture],vertex.uv[0]).xyz; + color = texture(texSampler[material.albedoTexture], vertex.uv[0]).xyz; + + if(material.normalTexture != 0) { + normal = texture(texSampler[material.normalTexture], vertex.uv[0]).xyz; + } + else { + normal = vertex.normal.xyz; + } - normal = vertex.normal.xyz; gl_Position = Camera.projection * Camera.view * PushConstants.render_matrix * vec4(vertex.position.xyz, 1.0); }