Skip to content
Merged
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
12 changes: 9 additions & 3 deletions script/LongShadow.anm2
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,16 @@ float4 psmain(float4 pos : SV_Position) : SV_Target {
--[[pixelshader@psmix:
Texture2D t0 : register(t0);
Texture2D t1 : register(t1);

cbuffer constant0: register(b0) {
float2 offset;
};

float4 psmix(float4 pos : SV_Position) : SV_Target {
float4 c0 = t0[uint2(pos.xy)];
float4 c1 = t1[uint2(pos.xy)];
return float4(c0*(1-c1.a)+c1);
float4 c1 = t1[uint2(pos.xy - offset)];
if (pos.x < offset.x || pos.y < offset.y) return c0;
else return float4(c0*(1-c1.a)+c1);
}
]]

Expand Down Expand Up @@ -78,7 +84,7 @@ if (flat==1) then --この部分の実装はAodarumaさんのFlatShadow(https://
end
end

if (shadowOnly==0) then obj.pixelshader("psmix","object",{"object","cache:_longshadow_org"}) end
if (shadowOnly==0) then obj.pixelshader("psmix","object",{"object","cache:_longshadow_org"}, {left, up}) end

obj.cx=obj.cx+(left-right)/2
obj.cy=obj.cy+(up-down)/2