mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 18:48:36 +02:00
* | cleaning
This commit is contained in:
@ -130,9 +130,6 @@ void main()
|
||||
|
||||
vec2 uv = (vec2(pixel_coords) / u_resolution) * 2.0 - 1.0;;
|
||||
uv.x *= u_resolution.x / u_resolution.y;
|
||||
|
||||
uint rng_state = uint(u_resolution.x) * uint(pixel_coords.y) + pixel_coords.x;
|
||||
rng_state = rng_state + u_frameCount * 719393;
|
||||
|
||||
float fov = 90.0;
|
||||
float focal_length = 1.0 / tan(radians(fov) / 2.0);
|
||||
@ -141,6 +138,9 @@ void main()
|
||||
vec3 ray_direction = normalize((inverse(u_viewMatrix) * vec4(view_space_ray, 0.0)).xyz);
|
||||
Ray ray = Ray(u_cameraPosition, ray_direction);
|
||||
|
||||
uint rng_state = uint(u_resolution.x) * uint(pixel_coords.y) + pixel_coords.x;
|
||||
rng_state = rng_state + u_frameCount * 719393;
|
||||
|
||||
vec3 color = pathtrace(ray, rng_state);
|
||||
|
||||
float blend = 1.0 / float(u_frameCount + 1);
|
||||
|
@ -33,9 +33,12 @@ bool intersectQuad(Ray ray, GPUObject obj, out hitInfo hit)
|
||||
{
|
||||
vec3 normal = normalize(cross(obj.vertex1, obj.vertex2));
|
||||
float d = dot(normal, ray.direction);
|
||||
|
||||
if (d == 0.0) return (false);
|
||||
|
||||
float t = dot(obj.position - ray.origin, normal) / d;
|
||||
|
||||
if (t <= 0.0 || d == 0.0) return (false);
|
||||
if (t <= 0.0) return (false);
|
||||
|
||||
vec3 p = ray.origin + ray.direction * t - obj.position;
|
||||
|
||||
|
Reference in New Issue
Block a user