mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 10:48:34 +02:00
+ | Denoising on light texture
This commit is contained in:
14
srcs/RT.cpp
14
srcs/RT.cpp
@ -37,7 +37,15 @@ int main(int argc, char **argv)
|
||||
GLuint VAO;
|
||||
setupScreenTriangle(&VAO);
|
||||
|
||||
std::vector<GLuint> textures = generateTextures(5);
|
||||
std::vector<GLuint> textures = generateTextures(8);
|
||||
//0 output
|
||||
//1 output_accumulation
|
||||
//2 denoising
|
||||
//3 normal
|
||||
//4 position
|
||||
//5 light
|
||||
//6 light_accum
|
||||
//7 color
|
||||
|
||||
ShaderProgram raytracing_program;
|
||||
Shader compute = Shader(GL_COMPUTE_SHADER, "shaders/compute.glsl");
|
||||
@ -99,8 +107,8 @@ int main(int argc, char **argv)
|
||||
window.display();
|
||||
window.pollEvents();
|
||||
|
||||
glClearTexImage(textures[3], 0, GL_RGBA, GL_FLOAT, nullptr);
|
||||
glClearTexImage(textures[4], 0, GL_RGBA, GL_FLOAT, nullptr);
|
||||
// glClearTexImage(textures[3], 0, GL_RGBA, GL_FLOAT, nullptr);
|
||||
// glClearTexImage(textures[4], 0, GL_RGBA, GL_FLOAT, nullptr);
|
||||
}
|
||||
|
||||
ImGui_ImplOpenGL3_Shutdown();
|
||||
|
@ -122,16 +122,17 @@ void shaderDenoise(ShaderProgram &denoising_program, GPUDenoise &denoise, std::v
|
||||
denoising_program.use();
|
||||
|
||||
denoising_program.set_vec2("u_resolution", glm::vec2(WIDTH, HEIGHT));
|
||||
denoising_program.set_int("u_pass_count", denoise.pass);
|
||||
denoising_program.set_float("u_c_phi", denoise.c_phi);
|
||||
denoising_program.set_float("u_p_phi", denoise.p_phi);
|
||||
denoising_program.set_float("u_n_phi", denoise.n_phi);
|
||||
|
||||
int output_texture = 0;
|
||||
int output_texture = 5;
|
||||
int denoising_texture = 2;
|
||||
|
||||
for (int pass = 0; pass < denoise.pass ; ++pass)
|
||||
{
|
||||
glBindImageTexture(0, textures[output_texture], 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA32F);
|
||||
glBindImageTexture(5, textures[output_texture], 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA32F);
|
||||
glBindImageTexture(2, textures[denoising_texture], 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA32F);
|
||||
|
||||
denoising_program.set_int("u_pass", pass);
|
||||
@ -140,5 +141,5 @@ void shaderDenoise(ShaderProgram &denoising_program, GPUDenoise &denoise, std::v
|
||||
std::swap(output_texture, denoising_texture);
|
||||
}
|
||||
|
||||
glBindImageTexture(0, textures[output_texture], 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA32F);
|
||||
glBindImageTexture(5, textures[output_texture], 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA32F);
|
||||
}
|
Reference in New Issue
Block a user