~ | Refraction change

This commit is contained in:
TheRedShip
2025-01-12 19:05:03 +01:00
parent 5d5c9d432e
commit 1908057434
8 changed files with 15 additions and 10 deletions

View File

@ -26,8 +26,8 @@ struct GPUMaterial
float emission; // 4
float roughness; // 4
float metallic; // 4
float refraction; // 4
int type; // 4
int texture_index; // 4
};
struct GPUCamera

View File

@ -17,12 +17,12 @@ Ray dieletricRay(hitInfo hit, Ray ray, GPUMaterial mat)
float refraction_ratio;
vec3 unit_direction;
refraction_ratio = 1.0f / mat.roughness; //mat.roughness = refraction (saving memory)
refraction_ratio = 1.0f / mat.refraction;
if (dot(ray.direction, hit.normal) > 0.0f)
{
hit.normal = -hit.normal;
refraction_ratio = mat.roughness;
refraction_ratio = mat.refraction;
}
unit_direction = normalize(ray.direction);