+ | Patching opti's problem

This commit is contained in:
TheRedShip
2025-01-19 15:48:25 +01:00
parent d0d67b8bd7
commit 71df788350
6 changed files with 2636 additions and 2870 deletions

5486
fps.txt

File diff suppressed because it is too large Load Diff

View File

@ -3,22 +3,22 @@ Pos=60,60
Size=400,400 Size=400,400
[Window][Camera] [Window][Camera]
Pos=1652,11 Pos=1646,5
Size=259,200 Size=259,200
[Window][Material] [Window][Material]
Pos=1648,207 Pos=1648,207
Size=266,285 Size=266,299
[Window][Fog settings] [Window][Fog settings]
Pos=1643,500 Pos=1649,509
Size=247,157 Size=247,130
[Window][Debug] [Window][Debug]
Pos=1642,668 Pos=1642,668
Size=260,143 Size=260,143
[Window][Debug BVH] [Window][Debug BVH]
Pos=1639,664 Pos=1646,642
Size=274,205 Size=274,205

View File

@ -186,6 +186,7 @@ vec3 pathtrace(Ray ray, inout uint rng_state)
break; break;
ray = newRay(hit, ray, rng_state); ray = newRay(hit, ray, rng_state);
ray.inv_direction = 1.0 / ray.direction;
} }
return (color * light); return (color * light);

View File

@ -95,6 +95,7 @@ struct Ray
{ {
vec3 origin; vec3 origin;
vec3 direction; vec3 direction;
vec3 inv_direction;
}; };
struct hitInfo struct hitInfo

View File

@ -20,8 +20,8 @@ int main(int argc, char **argv)
return (1); return (1);
Window window(&scene, WIDTH, HEIGHT, "RT_GPU", 0); Window window(&scene, WIDTH, HEIGHT, "RT_GPU", 0);
Shader shader("shaders/vertex.vert", "shaders/frag.frag", "shaders/compute.glsl"); // Shader shader("shaders/vertex.vert", "shaders/frag.frag", "shaders/compute.glsl");
// Shader shader("shaders/vertex.vert", "shaders/frag.frag", "shaders/debug.glsl"); Shader shader("shaders/vertex.vert", "shaders/frag.frag", "shaders/debug.glsl");
GLint max_gpu_size; GLint max_gpu_size;
glGetIntegerv(GL_MAX_SHADER_STORAGE_BLOCK_SIZE, &max_gpu_size); glGetIntegerv(GL_MAX_SHADER_STORAGE_BLOCK_SIZE, &max_gpu_size);
@ -122,7 +122,7 @@ int main(int argc, char **argv)
Camera *camera = scene.getCamera(); Camera *camera = scene.getCamera();
// performance profiling // performance profiling
if (false) if (true)
{ {
float time = (float)(glfwGetTime()) ; float time = (float)(glfwGetTime()) ;

View File

@ -46,7 +46,7 @@ void BVH::updateBounds(std::vector<GPUTriangle> &primitives)
void BVH::subdivide(std::vector<GPUTriangle> &primitives) void BVH::subdivide(std::vector<GPUTriangle> &primitives)
{ {
if (_primitive_count <= 4) if (_primitive_count <= 100)
return ; return ;
glm::vec3 extent = _aabb.max - _aabb.min; glm::vec3 extent = _aabb.max - _aabb.min;