mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 10:48:34 +02:00
* | Saving for changement
This commit is contained in:
@ -49,6 +49,7 @@ struct hitInfo
|
||||
|
||||
#include "shaders/random.glsl"
|
||||
#include "shaders/intersect.glsl"
|
||||
#include "shaders/scatter.glsl"
|
||||
|
||||
hitInfo traceRay(Ray ray)
|
||||
{
|
||||
@ -73,24 +74,6 @@ hitInfo traceRay(Ray ray)
|
||||
return (hit);
|
||||
}
|
||||
|
||||
Ray newRay(hitInfo hit, Ray ray, inout uint rng_state)
|
||||
{
|
||||
GPUObject obj;
|
||||
Ray new_ray;
|
||||
|
||||
obj = objects[hit.obj_index];
|
||||
|
||||
vec3 diffuse_dir = normalize(hit.normal + randomDirection(rng_state));
|
||||
vec3 specular_dir = reflect(ray.direction, hit.normal);
|
||||
|
||||
bool is_specular = (obj.metallic >= randomValue(rng_state));
|
||||
|
||||
new_ray.origin = hit.position + hit.normal * 0.001;
|
||||
new_ray.direction = mix(diffuse_dir, specular_dir, obj.roughness * float(is_specular));
|
||||
|
||||
return (new_ray);
|
||||
}
|
||||
|
||||
vec3 pathtrace(Ray ray, inout uint rng_state)
|
||||
{
|
||||
vec3 color = vec3(1.0);
|
||||
@ -98,7 +81,7 @@ vec3 pathtrace(Ray ray, inout uint rng_state)
|
||||
|
||||
float closest_t = 1e30;
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
hitInfo hit = traceRay(ray);
|
||||
if (hit.obj_index == -1)
|
||||
|
Reference in New Issue
Block a user