The final step (barring any overlooked missing bits, requested refactors, and of course, rolling in dependencies already submitted as PRs) consists of:

renderPrePassMgr.cpp related:
A) shifting .addFeature( MFT_XYZ); calls from ProcessedShaderMaterial::_determineFeatures to ProcessedPrePassMaterial::_determineFeatures
B) mimicking the "// set the XXX if different" entries from RenderMeshMgr::render in RenderPrePassMgr::render
C) fleshing out ProcessedPrePassMaterial::getNumStages() so that it shares a 1:1 correlation with ProcessedShaderMaterial::getNumStages()
D) causing inline void Swizzle<T, mapLength>::ToBuffer( void *destination, const void *source, const dsize_t size )  to silently fail rather than fatally assert if a source or destination buffer is not yet ready to be filled. (support for #customTarget scripted render targets)

Reflections:
A) removing reflectRenderState.disableAdvancedLightingBins(true); entries. this would otherwise early out from prepass and provide no color data whatsoever.
B) removing the fd.features.addFeature( MFT_ForwardShading ); entry forcing all materials to be forward lit when reflected.
C) 2 things best described bluntly as working hacks:
C1) when reflected, a scattersky is rotated PI along it's z then x axis in order to draw properly.
C2) along similar lines, in terraincellmaterial, we shut off culling if it's a prepass material.

Skies: scattersky is given a pair of rotations for reflection purposes, all sky objects are given a z value for depth testing.
This commit is contained in:
Azaezel 2016-02-16 02:50:49 -06:00
parent 5ed06fff9d
commit 8c5810adad
58 changed files with 353 additions and 117 deletions

View file

@ -58,7 +58,7 @@ MODULE_END;
GFX_ImplementTextureProfile( ReflectRenderTargetProfile,
GFXTextureProfile::DiffuseMap,
GFXTextureProfile::PreserveSize | GFXTextureProfile::NoMipmap | GFXTextureProfile::RenderTarget | GFXTextureProfile::Pooled,
GFXTextureProfile::PreserveSize | GFXTextureProfile::RenderTarget | GFXTextureProfile::Pooled,
GFXTextureProfile::NONE );
GFX_ImplementTextureProfile( RefractTextureProfile,

View file

@ -89,8 +89,6 @@ void ReflectionMaterialHook::_overrideFeatures( ProcessedMaterial *mat,
return;
}
// Forward shading on materials in reflections
fd.features.addFeature( MFT_ForwardShading );
fd.features.addFeature( MFT_Fog );
}

View file

@ -419,7 +419,6 @@ void CubeReflector::updateFace( const ReflectParams &params, U32 faceidx )
reflectRenderState.getMaterialDelegate().bind( REFLECTMGR, &ReflectionManager::getReflectionMaterial );
reflectRenderState.setDiffuseCameraTransform( params.query->cameraMatrix );
reflectRenderState.disableAdvancedLightingBins(true);
// render scene
LIGHTMGR->registerGlobalLights( &reflectRenderState.getCullingFrustum(), false );
@ -633,7 +632,6 @@ void PlaneReflector::updateReflection( const ReflectParams &params )
renderStateLeft.setSceneRenderField(0);
renderStateLeft.getMaterialDelegate().bind( REFLECTMGR, &ReflectionManager::getReflectionMaterial );
renderStateLeft.setDiffuseCameraTransform( params.query->eyeTransforms[0] );
renderStateLeft.disableAdvancedLightingBins(true);
gClientSceneGraph->renderSceneNoLights( &renderStateLeft, objTypeFlag );
@ -672,7 +670,6 @@ void PlaneReflector::updateReflection( const ReflectParams &params )
reflectRenderState.getMaterialDelegate().bind( REFLECTMGR, &ReflectionManager::getReflectionMaterial );
reflectRenderState.setDiffuseCameraTransform( params.query->cameraMatrix );
reflectRenderState.disableAdvancedLightingBins(true);
gClientSceneGraph->renderSceneNoLights( &reflectRenderState, objTypeFlag );
}