sunbokeh partly fix, still needs work

This commit is contained in:
Duion 2016-06-21 12:05:21 +02:00
parent 5b62df81c7
commit 5f2ab23fac
6 changed files with 83 additions and 21 deletions

View file

@ -42,7 +42,6 @@
#include "materials/sceneData.h"
#include "environment/timeOfDay.h"
ConsoleDocClass( ScatterSky,
"@brief Represents both the sun and sky for scenes with a dynamic time of day.\n\n"
@ -655,11 +654,6 @@ void ScatterSky::prepRenderImage( SceneRenderState *state )
state->getRenderPass()->addInst( ri );
}
*/
// Screen flare occlusion fix //sunBokeh feature
F32 screenRadius = GFX->getViewport().extent.y * mFlareScale * 0.01f;
Point3F lightWorldPos = state->getCameraPosition() - state->getFarPlane() * mLight->getDirection() * 0.9f;
F32 dist = ( lightWorldPos - state->getCameraPosition() ).len();
mFlareState.worldRadius = screenRadius * dist / state->getWorldToScreenScale().y;
// Light flare effect render instance.
if ( mFlareData && mNightInterpolant != 1.0f )

View file

@ -109,11 +109,7 @@ public:
F32 getAzimuth() const { return mSunAzimuth; }
///
F32 getElevation() const { return mSunElevation; }
/// sunBokeh feature
F32 getSunVisibility() const { if (mFlareData) return mFlareData->getVisibility(); else return 0; }
// Same method as above, but also checks if the data is valid, needs more CPU time, only use if above method fails
//F32 getSunVisibility() const { if dynamic_cast<LightFlareData*>(mFlareData) return mFlareData->getVisibility(); else return 0; }
protected:
void _render( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat );