mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 10:48:34 +02:00
~ | Refraction change
This commit is contained in:
@ -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
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user