Skip to content
This repository was archived by the owner on Mar 19, 2026. It is now read-only.

シャドウ uniform バッファを毎フレーム更新して影ズレを修正#82

Merged
HMasataka merged 2 commits into
mainfrom
fix/shadow-buffer-stale-update
Mar 7, 2026
Merged

シャドウ uniform バッファを毎フレーム更新して影ズレを修正#82
HMasataka merged 2 commits into
mainfrom
fix/shadow-buffer-stale-update

Conversation

@HMasataka
Copy link
Copy Markdown
Owner

概要

ShadowData uniform バッファ (lightSpaceVP + inverseVP) が初期化時に一度だけ書き込まれ、以降更新されていなかったため、カメラや物体が動くとライティングシェーダのワールド座標復元がずれて影が元の位置に残るバグを修正。

変更内容

  • IBufferUpdate(ReadOnlySpan<byte>) メソッドを追加
  • VulkanBuffervkMapMemory/NativeMemory.Copy/vkUnmapMemory による実装
  • DeferredRenderSystem: 毎フレーム現在のカメラ VP の逆行列で shadow バッファを更新
  • StereoDeferredRenderSystem: 左右の目ごとに inverseVP を更新
  • Program.cs: DeferredRenderSystemshadowBuffer を渡すよう修正
  • テストスタブに Update メソッドを追加

動作確認

  • dotnet build 成功(0 エラー / 0 警告)
  • dotnet test 全 688 テスト合格

HMasataka and others added 2 commits March 7, 2026 15:10
HOST_VISIBLE バッファの内容を毎フレーム更新できるようにする。
VulkanBuffer では vkMapMemory/NativeMemory.Copy/vkUnmapMemory で実装。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ShadowData (lightSpaceVP + inverseVP) が初期化時に一度だけ書き込まれ
毎フレーム更新されていなかったため、カメラや物体が動くと
ライティングシェーダのワールド座標復元がずれて影が元の位置に残っていた。

DeferredRenderSystem: 現在のカメラ VP の逆行列でバッファを更新
StereoDeferredRenderSystem: 左右の目ごとに inverseVP を更新

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@HMasataka HMasataka merged commit a1b714f into main Mar 7, 2026
3 checks passed
@HMasataka HMasataka deleted the fix/shadow-buffer-stale-update branch March 7, 2026 06:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant