Skip to content

Commit

Permalink
Merge pull request SaiyansKing#138 from SaulMyers/master
Browse files Browse the repository at this point in the history
- Exclude forest portals when doing second depthbuffer draw of world …
  • Loading branch information
lucifer602288 authored Aug 6, 2023
2 parents b34c5ed + bc8f32a commit 6629ce0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion D3D11Engine/D3D11GraphicsEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2679,7 +2679,7 @@ XRESULT D3D11GraphicsEngine::DrawMeshInfoListAlphablended(
// Draw again, but only to depthbuffer this time to make them work with
// fogging
for ( auto const& [meshKey, meshInfo] : list ) {
if ( meshKey.Material->GetAniTexture() != nullptr ) {
if ( meshKey.Material->GetAniTexture() != nullptr && meshKey.Info->MaterialType != MaterialInfo::MT_Portal ) {
// Draw the section-part
DrawVertexBufferIndexedUINT( nullptr, nullptr, meshInfo->Indices.size(),
meshInfo->BaseIndexLocation );
Expand Down
6 changes: 3 additions & 3 deletions D3D11Engine/Shaders/PS_PortalDiffuse.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ DEFERRED_PS_OUTPUT PSMain(PS_INPUT Input) : SV_TARGET
float distFromCamera = distance(Input.vViewPosition, Input.vPosition);

//start / end distances for fading
float startFade = 8000.0f;
float completeFade = 6000.0f;
float startFade = 6000.0f;
float completeFade = 5000.0f;

//how much to fade the object by
float percentageFade = (distFromCamera - completeFade) / (startFade - completeFade);

//keep the fade in bounds
if (percentageFade < 0) { percentageFade = 0.0f; clip(-1); }
if (percentageFade < 0) {percentageFade = 0.0f;}
if (percentageFade > 1) {percentageFade = 1.0f;}

//darken the portals depending on where the sun is in the sky
Expand Down

0 comments on commit 6629ce0

Please sign in to comment.