ebruneton / precomputed_atmospheric_scattering

This project provides a new implementation of our EGSR 2008 paper "Precomputed Atmospheric Scattering".
BSD 3-Clause "New" or "Revised" License
908 stars 120 forks source link

Suggested refactor for model.h/cc #40

Closed matthew-reid closed 3 years ago

matthew-reid commented 3 years ago

I'm working on integrating this into my engine, which uses OpenSceneGraph rather than raw openGL functions. Because of this, I can't use the parts of model.h/cc that deal with opengl resources, but I would like to use the glsl header factory part. I'd like to suggest splitting model.h/cc into two classes, one class to generate the glsl header from the atmosphere params, and a different class (in different files) to setup the GL resources (textures etc). That way people can more easily use one without the other.

matthew-reid commented 3 years ago

After spending more time looking at the code, I decided to use uniforms at render-time instead of generating constants with the header factory. The main reason being uniforms give more flexibility and it looks like I can fold most of the constants into uniforms anyway. I guess the main purpose of the header factory is to speed up the precomputation step with constant folding, with less benifit at render-time. So I'm not actually sure how useful my suggestion is after all.