mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 18:48:36 +02:00
* | TOM EST EVRENU
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/12/23 19:12:51 by ycontre #+# #+# */
|
/* Created: 2024/12/23 19:12:51 by ycontre #+# #+# */
|
||||||
/* Updated: 2024/12/23 19:47:09 by ycontre ### ########.fr */
|
/* Updated: 2025/01/08 20:20:34 by ycontre ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ CAM -7 10 6
|
|||||||
|
|
||||||
MAT 255 255 255 2.0 0.0 0.0 //white light
|
MAT 255 255 255 2.0 0.0 0.0 //white light
|
||||||
|
|
||||||
sp -10 100 10 50 0
|
# sp -10 100 10 50 0
|
||||||
qu -2.5 15 -9 7 0 0 0 0 7 0
|
qu -2.5 15 -9 7 0 0 0 0 7 0
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ hitInfo traceRay(Ray ray)
|
|||||||
{
|
{
|
||||||
hitInfo hit;
|
hitInfo hit;
|
||||||
|
|
||||||
for (int p = 0; p < 5; p++) //portals
|
for (int p = 0; p < 20; p++) //portals
|
||||||
{
|
{
|
||||||
hit.t = 1e30;
|
hit.t = 1e30;
|
||||||
hit.obj_index = -1;
|
hit.obj_index = -1;
|
||||||
@ -145,7 +145,7 @@ vec3 pathtrace(Ray ray, inout uint rng_state)
|
|||||||
|
|
||||||
// RR
|
// RR
|
||||||
float p = max(color.r, max(color.g, color.b));
|
float p = max(color.r, max(color.g, color.b));
|
||||||
if (randomValue(rng_state) > p && i > 1)
|
if (i > 1 && randomValue(rng_state) > p)
|
||||||
break;
|
break;
|
||||||
color /= p;
|
color /= p;
|
||||||
//
|
//
|
||||||
@ -171,7 +171,7 @@ Ray initRay(vec2 uv, inout uint rng_state)
|
|||||||
vec3 ray_direction = normalize((inverse(u_viewMatrix) * vec4(view_space_ray, 0.0)).xyz);
|
vec3 ray_direction = normalize((inverse(u_viewMatrix) * vec4(view_space_ray, 0.0)).xyz);
|
||||||
|
|
||||||
float focus_distance = 4.5;
|
float focus_distance = 4.5;
|
||||||
float aperture = 0.25;
|
float aperture = 0;
|
||||||
|
|
||||||
vec3 right = vec3(u_viewMatrix[0][0], u_viewMatrix[1][0], u_viewMatrix[2][0]);
|
vec3 right = vec3(u_viewMatrix[0][0], u_viewMatrix[1][0], u_viewMatrix[2][0]);
|
||||||
vec3 up = vec3(u_viewMatrix[0][1], u_viewMatrix[1][1], u_viewMatrix[2][1]);
|
vec3 up = vec3(u_viewMatrix[0][1], u_viewMatrix[1][1], u_viewMatrix[2][1]);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Ray lambertRay(hitInfo hit, Ray ray, GPUMaterial mat, uint rng_state)
|
Ray lambertRay(hitInfo hit, Ray ray, GPUMaterial mat, inout uint rng_state)
|
||||||
{
|
{
|
||||||
vec3 diffuse_dir = normalize(hit.normal + randomDirection(rng_state));
|
vec3 diffuse_dir = normalize(hit.normal + randomDirection(rng_state));
|
||||||
vec3 specular_dir = reflect(ray.direction, hit.normal);
|
vec3 specular_dir = reflect(ray.direction, hit.normal);
|
||||||
@ -33,7 +33,7 @@ Ray dieletricRay(hitInfo hit, Ray ray, GPUMaterial mat)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Ray newRay(hitInfo hit, Ray ray, uint rng_state)
|
Ray newRay(hitInfo hit, Ray ray, inout uint rng_state)
|
||||||
{
|
{
|
||||||
GPUObject obj;
|
GPUObject obj;
|
||||||
GPUMaterial mat;
|
GPUMaterial mat;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/09/27 14:51:49 by TheRed #+# #+# */
|
/* Created: 2024/09/27 14:51:49 by TheRed #+# #+# */
|
||||||
/* Updated: 2024/12/23 18:38:38 by ycontre ### ########.fr */
|
/* Updated: 2025/01/08 20:09:47 by ycontre ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/12/23 18:29:41 by ycontre #+# #+# */
|
/* Created: 2024/12/23 18:29:41 by ycontre #+# #+# */
|
||||||
/* Updated: 2024/12/23 18:40:17 by ycontre ### ########.fr */
|
/* Updated: 2025/01/08 20:08:03 by ycontre ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -106,7 +106,6 @@ void Scene::updateGPUData()
|
|||||||
auto cube = static_cast<Cube *>(obj);
|
auto cube = static_cast<Cube *>(obj);
|
||||||
gpu_obj.position = cube->getPosition();
|
gpu_obj.position = cube->getPosition();
|
||||||
gpu_obj.vertex1 = cube->getSize();
|
gpu_obj.vertex1 = cube->getSize();
|
||||||
gpu_obj.type = static_cast<int>(cube->getType());
|
|
||||||
}
|
}
|
||||||
else if (obj->getType() == Object::Type::PORTAL)
|
else if (obj->getType() == Object::Type::PORTAL)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user