Skip to content

Commit

Permalink
fix black border around parallax
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Pollind <[email protected]>
  • Loading branch information
pollend committed Nov 6, 2023
1 parent 0ca90a4 commit 82a1cd0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion HPL2/resource/deferred_resources.h.fsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/// Copyright 2023 Michael Pollind
/// SPDX-License-Identifier: GPL-3.0

#define PARALAX_MULTIPLIER 0.7
#define PARALLAX_MULTIPLIER 0.7

#define BLEND_MODE_ADD 0
#define BLEND_MODE_MUL 1
Expand Down
2 changes: 1 addition & 1 deletion HPL2/resource/solid_diffuse.frag.fsl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ PsOut PS_MAIN(PsIn In)
texCoord.xy += ParallaxAdvance(texCoord,
0.0,
32.0,
Get(uniformMaterialBuffer)[materialID].heightMapScale * PARALAX_MULTIPLIER,
Get(uniformMaterialBuffer)[materialID].heightMapScale * PARALLAX_MULTIPLIER,
In.pos,
In.normal,
In.tangent,
Expand Down
4 changes: 2 additions & 2 deletions HPL2/resource/solid_z.frag.fsl
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ float4 PS_MAIN(PsIn In)
if(HasHeight(Get(uniformMaterialBuffer)[materialID].materialConfig)) {
texCoord.xy += ParallaxAdvance(texCoord,
0.0,
16.0,
Get(uniformMaterialBuffer)[materialID].heightMapScale ,
8.0,
Get(uniformMaterialBuffer)[materialID].heightMapScale * PARALLAX_MULTIPLIER,
In.pos,
In.normal,
In.tangent,
Expand Down
3 changes: 1 addition & 2 deletions HPL2/sources/graphics/RendererDeferred.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3160,6 +3160,7 @@ namespace hpl {
cmdBindDescriptorSet(cmd, frameDescriptorIndex, m_materialSet.m_frameSet[frame.m_frameIndex].m_handle);

for (auto& diffuseItem : renderList.GetRenderableItems(eRenderListType_Diffuse)) {

cMaterial* pMaterial = diffuseItem->GetMaterial();
std::array targets = { eVertexBufferElement_Position,
eVertexBufferElement_Texture0,
Expand Down Expand Up @@ -3214,7 +3215,6 @@ namespace hpl {
MaterialRootConstant materialConst = {};
uint32_t instance = cmdBindMaterialAndObject(cmd, frame, pMaterial, decalItem);
materialConst.objectId = instance;
// LegacyVertexBuffer::GeometryBinding binding;
DrawPacket::cmdBindBuffers(cmd, frame.m_resourcePool, &packet);
cmdBindPushConstants(cmd, m_materialRootSignature.m_handle, materialObjectIndex, &materialConst);
cmdDrawIndexed(cmd, packet.numberOfIndecies(), 0, 0);
Expand Down Expand Up @@ -3363,7 +3363,6 @@ namespace hpl {
}
}

//////////////////////////
// View space depth, no need to test further since Z should almost never be the same for two objects.
// use ">" since we want to render things closest to the screen first.
return apObjectA.m_renderable->GetViewSpaceZ() > apObjectB.m_renderable->GetViewSpaceZ();
Expand Down

0 comments on commit 82a1cd0

Please sign in to comment.