Skip to content

Commit

Permalink
Traktor: More tolerance fixes in HiZ culling.
Browse files Browse the repository at this point in the history
  • Loading branch information
apistol78 committed Feb 22, 2024
1 parent fb4e8c5 commit 820a92d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions data/Source/System/Mesh/Shaders/Instance/Cull/Cull.xdi
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ $Buffer[index].visible = $Input;
<comment/>
<position>
<first>721</first>
<second>756</second>
<second>755</second>
</position>
<name>HiZ</name>
<technique/>
Expand Down Expand Up @@ -342,14 +342,14 @@ const float P11 = $Projection[1][1];
vec4 aabb;
if (ProjectSphere(viewCenter.xyz, radius, znear, P00, P11, aabb))
{
const vec2 hs = textureSize($HiZTexture, 0);
const ivec2 osz = ivec2($TargetSize.xy) / 2;
const vec2 osz = vec2($TargetSize.xy) / 2.0f;
const float width = (aabb.z - aabb.x) * osz.x;
const float height = (aabb.w - aabb.y) * osz.y;
const float level = floor(log2(max(width, height)));
const float level = ceil(log2(max(width, height)));
const vec2 s = vec2(osz) / hs;
const vec2 hs = textureSize($HiZTexture, 0);
const vec2 s = osz / hs;
const vec2 p = ((aabb.xy + aabb.zw) * 0.5f) * s;
const float depth = textureLod(sampler2D($HiZTexture, $HiZState), p, level).x;
Expand Down
8 changes: 4 additions & 4 deletions data/Source/System/World/Overlay/Shaders/OverlayTargets.xdi
Original file line number Diff line number Diff line change
Expand Up @@ -2285,7 +2285,7 @@ else
<first>-820</first>
<second>4072</second>
</position>
<value>2</value>
<value>6</value>
</item>
<item type="traktor.render.Script" version="6,traktor.render.Node:1">
<id>{431F1C47-067D-5042-B5DC-20EBDF01A8C7}</id>
Expand Down Expand Up @@ -2329,9 +2329,9 @@ else
</outputPins>
<script>
<![CDATA[
ivec2 osz = ivec2($TargetSize.xy) / 2;
ivec2 hsz = textureSize($Texture, 0);
vec2 s = vec2(osz) / hsz;
vec2 osz = vec2($TargetSize.xy) / 2.0f;
vec2 hsz = textureSize($Texture, 0);
vec2 s = osz / hsz;
vec2 p = $TexCoord.xy * s;
$Output = vec4(p, 0.0f, 0.0f);
Expand Down

0 comments on commit 820a92d

Please sign in to comment.