Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix skylighting CB alignment #531

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions features/Skylighting/Shaders/Skylighting/Skylighting.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ struct SkylightingSettings
row_major float4x4 OcclusionViewProj;
float4 OcclusionDir;

float3 PosOffset; // xyz: cell origin in camera model space
uint pad0;
uint3 ArrayOrigin; // xyz: array origin, w: max accum frames
uint pad1;
float4 PosOffset; // xyz: cell origin in camera model space
alandtse marked this conversation as resolved.
Show resolved Hide resolved
uint4 ArrayOrigin; // xyz: array origin
alandtse marked this conversation as resolved.
Show resolved Hide resolved
int4 ValidMargin;

float MinDiffuseVisibility;
float MinSpecularVisibility;
uint pad2[2];
uint pad[2];
};

#endif
Expand Down Expand Up @@ -58,7 +56,7 @@ namespace Skylighting
const static sh2 unitSH = float4(sqrt(4 * shPI), 0, 0, 0);
sh2 scaledUnitSH = unitSH / 1e-10;

float3 positionMSAdjusted = positionMS - params.PosOffset;
float3 positionMSAdjusted = positionMS - params.PosOffset.xyz;
float3 uvw = positionMSAdjusted / ARRAY_SIZE + .5;

if (any(uvw < 0) || any(uvw > 1))
Expand Down
7 changes: 3 additions & 4 deletions package/Shaders/Common/SharedData.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,10 @@ struct SkylightingSettings
row_major float4x4 OcclusionViewProj;
float4 OcclusionDir;

float3 PosOffset; // xyz: cell origin in camera model space
uint pad0;
uint3 ArrayOrigin; // xyz: array origin, w: max accum frames
uint pad1;
float4 PosOffset; // xyz: cell origin in camera model space
uint4 ArrayOrigin; // xyz: array origin
int4 ValidMargin;

float MinDiffuseVisibility;
float MinSpecularVisibility;
uint pad2[2];
Expand Down
Loading