Super-fast volume (aka Downscaled Volume Rendering).

This commit is contained in:
Jonathas Costa
2019-11-10 14:17:23 -05:00
parent b591af3c2a
commit 0fce6a8d26
10 changed files with 310 additions and 7 deletions
@@ -70,6 +70,7 @@ public:
void updateDeferredcastData();
void updateHDRAndFiltering();
void updateFXAA();
void updateDownscaledVolume();
void setResolution(glm::ivec2 res) override;
void setHDRExposure(float hdrExposure) override;
@@ -110,6 +111,8 @@ private:
void resolveMSAA(float blackoutFactor);
void applyTMO(float blackoutFactor);
void applyFXAA();
void updateDownscaleColorTexture();
void writeDownscaledVolume();
std::map<VolumeRaycaster*, RaycastData> _raycastData;
RaycasterProgObjMap _exitPrograms;
@@ -122,10 +125,12 @@ private:
std::unique_ptr<ghoul::opengl::ProgramObject> _hdrFilteringProgram;
std::unique_ptr<ghoul::opengl::ProgramObject> _tmoProgram;
std::unique_ptr<ghoul::opengl::ProgramObject> _fxaaProgram;
std::unique_ptr<ghoul::opengl::ProgramObject> _downscaledVolumeProgram;
UniformCache(hdrFeedingTexture, blackoutFactor, hdrExposure, gamma,
Hue, Saturation, Value) _hdrUniformCache;
UniformCache(renderedTexture, inverseScreenSize) _fxaaUniformCache;
UniformCache(downscaledRenderedVolume) _writeDownscaledVolumeUniformCache;
GLint _defaultFBO;
GLuint _screenQuad;
@@ -157,6 +162,12 @@ private:
GLuint fxaaTexture;
} _fxaaBuffers;
struct {
GLuint framebuffer;
GLuint colorTexture;
float currentDownscaleFactor = 1.f;
} _downscaleVolumeRendering;
unsigned int _pingPongIndex = 0u;
bool _dirtyDeferredcastData;
@@ -128,6 +128,25 @@ public:
* helper file) which should be a prefix to all symbols defined by the helper
*/
virtual std::string helperPath() const = 0;
virtual void setMaxSteps(int nsteps) { _rayCastMaxSteps = nsteps; };
virtual const int maxSteps() const { return _rayCastMaxSteps; };
virtual void setDownscaleRender(float value) { _downscaleRenderConst = value; };
virtual const float downscaleRender() const { return _downscaleRenderConst; };
private:
/**
* Maximum number of integration steps to be executed by the volume integrator.
*/
int _rayCastMaxSteps = 1000;
/**
* Enable and set the downscale rendering of the volume. Used to improve performance.
*/
float _downscaleRenderConst = 1.0f;
};
} // namespace openspace