Closed stavenko closed 7 years ago
This is an optimization to save some GPU memory during precomputations. Indeed, delta_multiple_scattering_texture is only needed to compute scattering order 3 or more, while delta_rayleigh_scattering_texture and delta_mie_scattering_texture are only needed to compute double scattering. Therefore, to save memory, we can store delta_rayleigh_scattering_texture and delta_multiple_scattering_texture in the same GPU texture.
You can check that this does not change the result, by comparing with a version of the code where
GLuint delta_multiple_scattering_texture = delta_rayleigh_scattering_texture;
is replaced with
GLuint delta_multiple_scattering_texture = NewTexture3d( SCATTERING_TEXTURE_WIDTH, SCATTERING_TEXTURE_HEIGHT, SCATTERING_TEXTURE_DEPTH, GL_RGB, halfprecision);
Hello. I'm trying to reimplement your solution in javascript and found this:
There is two 3d textures binded to this shader "multiple_scattering_texture" and "single_rayleigh_scattering_texture". But, there is a line in
model.cc
fileThis is same texture from shader's perspective, but it used strangely differrently. At least here this two textures treated as different textures.
in
ComputeIndirectIrradiance
function.So, could you please explain why is it made so? Is it correct and I could use same textures in my code, Or this is an error and indirect irradiance shader should get some other texture (maybe
scattering_texture_
).