Shader parameter [skip ci]
This commit is contained in:
parent
cdf8c68d9e
commit
1d0938a001
3 changed files with 4 additions and 4 deletions
|
|
@ -86,7 +86,7 @@ float PBR_Shade(vec3 N, vec3 V, vec3 L, float roughness, float F0)
|
||||||
// Visibility term
|
// Visibility term
|
||||||
float Vs = GEOM_SchlickSmith(dotNL, dotNV, alpha);
|
float Vs = GEOM_SchlickSmith(dotNL, dotNV, alpha);
|
||||||
|
|
||||||
return dotNL * Di * Fs * Vs;
|
return Di * Fs * Vs;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
@ -118,7 +118,7 @@ void main()
|
||||||
vec3 IBLreflection = texture(envmapiblrefl, inNormal).rgb;
|
vec3 IBLreflection = texture(envmapiblrefl, inNormal).rgb;
|
||||||
|
|
||||||
// Fresnel part
|
// Fresnel part
|
||||||
float fresnel = pow(max(1.0 - dot(N, V), 0.0), 1.5);
|
float fresnel = pow(max(1.0 - abs(dot(N, V)), 0.0), 1.5f + roughness);
|
||||||
|
|
||||||
// Reflection part
|
// Reflection part
|
||||||
|
|
||||||
|
|
@ -134,7 +134,7 @@ void main()
|
||||||
// F0 based on metallic factor of material
|
// F0 based on metallic factor of material
|
||||||
vec3 F0 = vec3(0.04);
|
vec3 F0 = vec3(0.04);
|
||||||
F0 = mix(F0, lightColor, material.metallic);
|
F0 = mix(F0, lightColor, material.metallic);
|
||||||
vec3 spec = lightColor * PBR_Shade(N, V, L, roughness, 0.2);
|
vec3 spec = lightColor * PBR_Shade(N, V, L, roughness, F0.r);
|
||||||
reflection -= spec;
|
reflection -= spec;
|
||||||
|
|
||||||
// Diffuse part
|
// Diffuse part
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -196,7 +196,7 @@ public:
|
||||||
glm::vec3 pos = glm::vec3(float(x - (GRID_DIM / 2.0f)) * 2.5f, 0.0f, float(y - (GRID_DIM / 2.0f)) * 2.5f);
|
glm::vec3 pos = glm::vec3(float(x - (GRID_DIM / 2.0f)) * 2.5f, 0.0f, float(y - (GRID_DIM / 2.0f)) * 2.5f);
|
||||||
vkCmdPushConstants(drawCmdBuffers[i], pipelineLayout, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(glm::vec3), &pos);
|
vkCmdPushConstants(drawCmdBuffers[i], pipelineLayout, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(glm::vec3), &pos);
|
||||||
mat.metallic = (float)x / (float)GRID_DIM;
|
mat.metallic = (float)x / (float)GRID_DIM;
|
||||||
mat.roughness = glm::clamp((float)y / (float)(GRID_DIM - 1), 0.05f, 1.0f);
|
mat.roughness = (float)y / (float)GRID_DIM;
|
||||||
vkCmdPushConstants(drawCmdBuffers[i], pipelineLayout, VK_SHADER_STAGE_FRAGMENT_BIT, sizeof(glm::vec3), sizeof(Material), &mat);
|
vkCmdPushConstants(drawCmdBuffers[i], pipelineLayout, VK_SHADER_STAGE_FRAGMENT_BIT, sizeof(glm::vec3), sizeof(Material), &mat);
|
||||||
vkCmdDrawIndexed(drawCmdBuffers[i], models.objects[models.objectIndex].indexCount, 1, 0, 0, 0);
|
vkCmdDrawIndexed(drawCmdBuffers[i], models.objects[models.objectIndex].indexCount, 1, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue