+ | Russian roulette was the problem

This commit is contained in:
TheRedShip
2025-01-07 10:16:40 +01:00
parent 56d3a1394b
commit 34be8433f7
4 changed files with 15 additions and 15 deletions

View File

@ -13,8 +13,8 @@
#ifndef RT__HPP
# define RT__HPP
# define WIDTH 1000
# define HEIGHT 1000
# define WIDTH 1920
# define HEIGHT 1080
# include "glm/glm.hpp"
# include "glm/gtc/matrix_transform.hpp"

View File

@ -40,5 +40,5 @@ sp 2.4 1.5 -1 1.5 14
// light quad
qu -1 2.9 -1 2 0 0 0 2 0 0
qu -1 2.9 -1 2 0 0 0 0 2 0

View File

@ -3,17 +3,17 @@ CAM 0 2 5
MAT 30 30 30 0.0 0.0 0.0 //white
MAT 255 255 255 0.0 1.0 1.0 //mirror
MAT 255 255 255 1.0 0.0 0.0 //sun
MAT 255 255 255 2.0 0.0 0.0 //sun
MAT 255 100 100 0.0 0.0 0.0 //red
pl 0 -1 0 0 1 0 0
pl 0 -1 -13 0 0 1 0
# pl 0 0 -1 0 0 1 0
pl 0 0 0 0 1 0 0
# cu 0 0.5 1 1 1 1 3
tr 0 0 0 1 0 0 0 0 1 1
cu 0 1 0 1 1 1 3
# tr -5 0 2 -5 2 2 0 2 2 2
# tr -5 0 2 0 0 2 0 2 2 2
qu -10 15 -9 0 7 0 0 0 7 2
qu -5 0 0 2 0 0 0 2 0 2 //light problem
# qu -4 0 0 0 0 2 0 2 0 0 //blocking
# sp 15 30 -30 30 2
# sp 0 30 0 30 2

View File

@ -105,10 +105,10 @@ vec3 pathtrace(Ray ray, inout uint rng_state)
GPUMaterial mat = materials[obj.mat_index];
// RR
float p = max(color.r, max(color.g, color.b));
if (randomValue(rng_state) > p)
break;
color /= p;
// float p = max(color.r, max(color.g, color.b));
// if (randomValue(rng_state) > p && i > 1)
// break;
// color /= p;
//
color *= mat.color;