(fix)fix cos_weight pdf

Signed-off-by:mousechannel MoCheng <mochenghh@gmail.com>

Signed-off-by: MoCheng <mochenghh@gmail.com>
This commit is contained in:
MoCheng 2023-05-23 11:16:28 +08:00
parent 8d4ba64b18
commit ebf0838233

View file

@ -110,11 +110,12 @@ void main()
vec3 rayOrigin = world_position; vec3 rayOrigin = world_position;
vec3 rayDirection = samplingHemisphere(prd.seed, tangent, bitangent, world_normal); vec3 rayDirection = samplingHemisphere(prd.seed, tangent, bitangent, world_normal);
// Probability of the newRay (cosine distributed)
const float p = 1 / M_PI;
// Compute the BRDF for this ray (assuming Lambertian reflection) // Compute the BRDF for this ray (assuming Lambertian reflection)
float cos_theta = dot(rayDirection, world_normal); float cos_theta = dot(rayDirection, world_normal);
// Probability of the newRay (cosine distributed)
const float p = cos_theta / M_PI;
vec3 albedo = mat.pbrBaseColorFactor.xyz; vec3 albedo = mat.pbrBaseColorFactor.xyz;
if(mat.pbrBaseColorTexture > -1) if(mat.pbrBaseColorTexture > -1)
{ {