Merge pull request #1260 from Azaezel/alpha41/dynamicReflectionRevisions

fix dynamicCubemaps on objects
This commit is contained in:
Brian Roberts 2024-04-24 23:14:10 -05:00 committed by GitHub
commit 29ba0439b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 15 additions and 13 deletions

View file

@ -329,7 +329,8 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
if (String::compare(LIGHTMGR->getId(), "BLM") == 0)
{
fd.features.addFeature(MFT_ForwardShading);
fd.features.addFeature(MFT_ReflectionProbes);
if (!mMaterial->mDynamicCubemap)
fd.features.addFeature(MFT_ReflectionProbes);
}
// Disabling the InterlacedDeferred feature for now. It is not ready for prime-time
@ -357,7 +358,8 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
if (mMaterial->isTranslucent())
{
fd.features.addFeature(MFT_RTLighting);
fd.features.addFeature(MFT_ReflectionProbes);
if (!mMaterial->mDynamicCubemap)
fd.features.addFeature(MFT_ReflectionProbes);
}
if ( mMaterial->mAnimFlags[stageNum] )
@ -369,7 +371,7 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
// cubemaps only available on stage 0 for now - bramage
if ( stageNum < 1 && mMaterial->isTranslucent() &&
( ( mMaterial->mCubemapData && mMaterial->mCubemapData->mCubemap ) ||
mMaterial->mDynamicCubemap ) && !features.hasFeature(MFT_ReflectionProbes))
mMaterial->mDynamicCubemap ) /*&& !features.hasFeature(MFT_ReflectionProbes) */ )
{
fd.features.addFeature( MFT_CubeMap );
}

View file

@ -532,7 +532,7 @@ F32 PlaneReflector::calcScore( const ReflectParams &params )
return score;
}
void PlaneReflector::updateReflection( const ReflectParams &params )
void PlaneReflector::updateReflection( const ReflectParams &params, Point3F explicitPostion)
{
PROFILE_SCOPE(PlaneReflector_updateReflection);
GFXDEBUGEVENT_SCOPE( PlaneReflector_updateReflection, ColorI::WHITE );

View file

@ -97,7 +97,7 @@ public:
virtual void unregisterReflector();
virtual F32 calcScore( const ReflectParams &params );
virtual void updateReflection( const ReflectParams &params ) {}
virtual void updateReflection( const ReflectParams &params, Point3F explicitPostion = Point3F::Max) {}
GFXOcclusionQuery* getOcclusionQuery() const { return mOcclusionQuery; }
@ -151,7 +151,7 @@ public:
ReflectorDesc *inDesc );
void unregisterReflector() override;
virtual void updateReflection( const ReflectParams &params, Point3F explicitPostion = Point3F::Max);
void updateReflection( const ReflectParams &params, Point3F explicitPostion = Point3F::Max) override;
GFXCubemap* getCubemap() const { return mCubemap; }
@ -174,7 +174,7 @@ protected:
U32 faceIdx;
CubeReflector *cube;
void updateReflection( const ReflectParams &params ) override { cube->updateFace( params, faceIdx ); }
void updateReflection( const ReflectParams &params, Point3F explicitPostion = Point3F::Max) override { cube->updateFace( params, faceIdx ); }
F32 calcScore( const ReflectParams &params ) override;
};
@ -201,7 +201,7 @@ public:
ReflectorDesc *inDesc );
F32 calcScore( const ReflectParams &params ) override;
void updateReflection( const ReflectParams &params ) override;
void updateReflection( const ReflectParams &params, Point3F explicitPostion = Point3F::Max) override;
/// Set up the GFX matrices
void setGFXMatrices( const MatrixF &camTrans );
@ -233,4 +233,4 @@ public:
bool objectSpace;
};
#endif // _REFLECTOR_H_
#endif // _REFLECTOR_H_

View file

@ -1922,9 +1922,9 @@ void ReflectCubeFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
Var* matinfo = (Var*) LangElement::find( getOutputTargetVarName(ShaderFeature::RenderTarget2) );
Var *roughness = (Var*)LangElement::find("roughness");
if (roughness) //try to grab roughness directly
texCube = new GenOp("textureLod( @, @, min((1.0 - @)*@ + 1.0, @))", cubeMap, reflectVec, roughness, cubeMips, cubeMips);
texCube = new GenOp("textureLod( @, @, min(@*@ + 1.0, @))", cubeMap, reflectVec, roughness, cubeMips, cubeMips);
else if (glossColor) //failing that, try and find color data
texCube = new GenOp("textureLod( @, @, min((1.0 - @.b)*@ + 1.0, @))", cubeMap, reflectVec, glossColor, cubeMips, cubeMips);
texCube = new GenOp("textureLod( @, @, min(@.b*@ + 1.0, @))", cubeMap, reflectVec, glossColor, cubeMips, cubeMips);
else //failing *that*, just draw the cubemap
texCube = new GenOp("texture( @, @)", cubeMap, reflectVec);

View file

@ -1987,11 +1987,11 @@ void ReflectCubeFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
if (roughness) //try to grab roughness directly
{
texCube = new GenOp("@.SampleLevel( @, float3(@).rgb, min((1.0 - @)*@ + 1.0, @))", cubeMapTex, cubeMap, reflectVec, roughness, cubeMips, cubeMips);
texCube = new GenOp("@.SampleLevel( @, float3(@).rgb, min(@*@ + 1.0, @))", cubeMapTex, cubeMap, reflectVec, roughness, cubeMips, cubeMips);
}
else if (glossColor)//failing that, try and find color data
{
texCube = new GenOp("@.SampleLevel( @, float3(@).rgb, min((1.0 - @.b)*@ + 1.0, @))", cubeMapTex, cubeMap, reflectVec, glossColor, cubeMips, cubeMips);
texCube = new GenOp("@.SampleLevel( @, float3(@).rgb, min(@.b*@ + 1.0, @))", cubeMapTex, cubeMap, reflectVec, glossColor, cubeMips, cubeMips);
}
else //failing *that*, just draw the cubemap
{