Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
831c014
Refine DenyShaderResource flag logic for textures
qian-o Jul 30, 2026
5a2fcbf
Update Avalonia, Slangc.NET, and Uno.WinUI package versions
qian-o Jul 31, 2026
bec2dd2
Add CanTransition property to DXTexture and related logic
qian-o Jul 31, 2026
1220d6d
Update Texture constructor to include extra boolean flag
qian-o Jul 31, 2026
b3a6c28
Add D3D11 query for resource copy synchronization
qian-o Jul 31, 2026
5112ed8
Use D3D11 query for GPU sync in Surface rendering
qian-o Jul 31, 2026
7868b22
Refactor UI calls to use async Dispatcher methods
qian-o Jul 31, 2026
c0d5223
Remove explicit Render priority from UI dispatcher calls
qian-o Jul 31, 2026
a361a73
Update SkiaSharp to version 4.151.0
qian-o Aug 1, 2026
042e823
Add SkiaSharp integration and SKTexture classes
qian-o Aug 1, 2026
aa6d751
Add GetNativeObject support for DX12, Metal, Vulkan wrappers
qian-o Aug 1, 2026
fea7968
Always return 0 in MTLTextureView.GetNativeObject
qian-o Aug 1, 2026
5eb0aca
Refactor Skia integration: thread-safe, extensible renderers
qian-o Aug 2, 2026
416dc37
Add SkiaBoard experiment: cross-platform drawing app
qian-o Aug 2, 2026
4f92cea
Add BOM to Zenith.NET.slnx solution file
qian-o Aug 2, 2026
686b12d
Replace SkiaBoard with responsive GPU gallery
qian-o Aug 3, 2026
f9c5983
Refactor: improve structure, accessibility, and formatting
qian-o Aug 3, 2026
aacdc17
Update GalleryPalette colors & SKTexture usage handling
qian-o Aug 3, 2026
0559149
Replace SkiaGallery with InkCanvas experiment
qian-o Aug 3, 2026
837717c
Add missing usings and refactor Board.cs logic
qian-o Aug 3, 2026
3ea8181
Refine InkCanvas drawing and erasing
qian-o Aug 3, 2026
e67c31b
Refactor event handling and rendering logic
qian-o Aug 3, 2026
f7d9c26
Expand texture usage flags to include Sampled and TransferDst
qian-o Aug 3, 2026
91e8aa3
Refactor InkCanvas drawing architecture
qian-o Aug 3, 2026
70a10ca
Add UTF-8 BOM and expose Context property
qian-o Aug 3, 2026
f0e1026
Align experiment initializer ordering
qian-o Aug 3, 2026
694b4ed
Add Particles to FluidViewMode and refactor rendering
qian-o Aug 3, 2026
f831af3
Update graphics context flush and submit usage
qian-o Aug 4, 2026
4298d3c
Refactor multisampling config in texture creation
qian-o Aug 4, 2026
9f3639e
Fix Skia texture layout tracking
qian-o Aug 4, 2026
73e3b03
Refactor layout init and use Vector4.Zero for clear color
qian-o Aug 4, 2026
9a28eb1
Simplify Skia backend texture configuration
qian-o Aug 4, 2026
8235713
Refactor SKFormats.DirectX12 location, remove SampleCount map
qian-o Aug 4, 2026
a1e6991
Refactor texture layout to use RequiredLayout property
qian-o Aug 4, 2026
8b4e1f3
Ignore known Skia D3D12 ClearRenderTargetView warnings
qian-o Aug 4, 2026
e01c0cc
Ignore known Skia D3D12 validation messages
qian-o Aug 4, 2026
f50281b
Add MSAA toggle to InkCanvas
qian-o Aug 4, 2026
07a7ac1
Reorder properties and remove IsMultisamplingEnabled
qian-o Aug 4, 2026
6351256
Rename IsMultisamplingEnabled to MSAA across codebase
qian-o Aug 4, 2026
9cb81b9
Refactor: rename multisampling to msaa for consistency
qian-o Aug 4, 2026
24d10c5
Refactor SKPaint and GRContext initialization
qian-o Aug 4, 2026
76f19d8
Remove AllowPathMaskCaching from SKRenderer init
qian-o Aug 4, 2026
599af42
Remove redundant Skia cache settings
qian-o Aug 4, 2026
6119ef2
Align declaration ordering
qian-o Aug 5, 2026
02413df
Preserve scene occlusion in fluid compositing
qian-o Aug 5, 2026
4b85f4f
Preserve fluid tank frame at distance
qian-o Aug 5, 2026
4581607
Align fluid occlusion code style
qian-o Aug 5, 2026
b64179b
Refactor: compact multi-line inits and calls to single-line
qian-o Aug 5, 2026
f07e444
Bump package version to 1.0.0 stable
qian-o Aug 5, 2026
5ca0e54
Remove D3D query Begin/End calls from Surface & ZenithView
qian-o Aug 5, 2026
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
1 change: 1 addition & 0 deletions Zenith.NET.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<File Path="sources/Experiments/Directory.Packages.props" />
<Project Path="sources/Experiments/CornellBox/CornellBox.csproj" />
<Project Path="sources/Experiments/FluidTank/FluidTank.csproj" />
<Project Path="sources/Experiments/InkCanvas/InkCanvas.csproj" />
<Project Path="sources/Experiments/PlatformDetection/PlatformDetection.csproj" />
</Folder>
<Folder Name="/Extensions/">
Expand Down
8 changes: 4 additions & 4 deletions sources/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageVersion Include="Avalonia" Version="12.1.0" />
<PackageVersion Include="Avalonia" Version="12.1.1" />
<PackageVersion Include="Hexa.NET.ImGui" Version="2.2.9" />
<PackageVersion Include="Metal.NET" Version="2.4.0" />
<PackageVersion Include="Microsoft.Maui.Controls" Version="10.0.90" />
Expand All @@ -19,9 +19,9 @@
<PackageVersion Include="Silk.NET.Vulkan.Extensions.EXT" Version="2.23.0" />
<PackageVersion Include="Silk.NET.Vulkan.Extensions.KHR" Version="2.23.0" />
<PackageVersion Include="SixLabors.ImageSharp" Version="4.0.0" />
<PackageVersion Include="SkiaSharp" Version="4.150.1" />
<PackageVersion Include="Slangc.NET" Version="2026.13.1" />
<PackageVersion Include="Uno.WinUI" Version="6.6.176" />
<PackageVersion Include="SkiaSharp" Version="4.151.0" />
<PackageVersion Include="Slangc.NET" Version="2026.14.1" />
<PackageVersion Include="Uno.WinUI" Version="6.6.184" />
</ItemGroup>

</Project>
8 changes: 4 additions & 4 deletions sources/Experiments/CornellBox/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ static App()

window = Window.Create(WindowOptions.Default with
{
Size = new(1280, 720),
API = GraphicsAPI.None,
Title = "Cornell Box - Zenith.NET",
Size = new(1280, 720)
Title = "Cornell Box - Zenith.NET"
});
window.Initialize();
window.Center();
Expand Down Expand Up @@ -86,8 +86,8 @@ static App()

camera = new(input, Matrix4x4.CreateTranslation(278.0f, 273.0f, -800.0f))
{
Speed = 240.0f,
FarPlane = 2000.0f
FarPlane = 2000.0f,
Speed = 240.0f
};

rasterizer = new();
Expand Down
8 changes: 4 additions & 4 deletions sources/Experiments/FluidTank/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ static App()

window = Window.Create(WindowOptions.Default with
{
Size = new(1280, 720),
API = GraphicsAPI.None,
Title = "Fluid Tank - Zenith.NET",
Size = new(1280, 720)
Title = "Fluid Tank - Zenith.NET"
});
window.Initialize();
window.Center();
Expand Down Expand Up @@ -86,10 +86,10 @@ static App()

camera = new(input, new(9.2f, 5.3f, -10.8f), new(0.0f, 1.45f, 0.0f))
{
Speed = 4.0f,
NearPlane = 0.05f,
FarPlane = 80.0f,
Fov = 48.0f
Fov = 48.0f,
Speed = 4.0f
};

renderer = new();
Expand Down
53 changes: 46 additions & 7 deletions sources/Experiments/FluidTank/Assets/Shaders/FluidComposite.slang
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,8 @@ float3 ReconstructNormal(float2 uv, float centerDepth)
return normal;
}

float3 SceneAt(float2 uv)
float3 SceneAt(float2 uv, float depth)
{
float depth = composite.SceneDepth.SampleLevel(composite.Sampler, uv, 0.0).r;
if (depth <= 0.0)
{
float3 rayView = ViewRay(uv);
Expand All @@ -198,22 +197,62 @@ float3 SceneAt(float2 uv)
return composite.SceneColor.SampleLevel(composite.Sampler, uv, 0.0).rgb;
}

float3 SceneAt(float2 uv)
{
float depth = composite.SceneDepth.SampleLevel(composite.Sampler, uv, 0.0).r;

return SceneAt(uv, depth);
}

bool FrameOccludesFluid(FullscreenOutput input, float sceneDepth)
{
if (composite.SceneColor.Load(int3(int2(input.Position.xy), 0)).a < 0.5)
{
return false;
}

int2 fluidDimensions = int2(composite.Width, composite.Height);
int2 baseFluidPixel = int2(floor(input.UV * float2(fluidDimensions) - 0.5));
float closestFluidDepth = 0.0;

for (int y = 0; y < 2; y++)
{
for (int x = 0; x < 2; x++)
{
int2 samplePixel = clamp(baseFluidPixel + int2(x, y), int2(0, 0), fluidDimensions - 1);
float sampleDepth = composite.Attributes.Load(int3(samplePixel, 0)).w;

if (sampleDepth > 0.0 && (closestFluidDepth <= 0.0 || sampleDepth < closestFluidDepth))
{
closestFluidDepth = sampleDepth;
}
}
}

return closestFluidDepth <= 0.0 || closestFluidDepth >= sceneDepth;
}

float4 ShadeWater(FullscreenOutput input)
{
float2 uv = input.UV;
float sceneDepth = composite.SceneDepth.Load(int3(int2(input.Position.xy), 0)).r;
float3 scene = SceneAt(uv, sceneDepth);

if (composite.RenderMode == 1)
{
return float4(ToSRGB(ACESFilm(SceneAt(uv))), 1.0);
return float4(ToSRGB(ACESFilm(scene)), 1.0);
}

float fluidDepth = composite.FluidDepth.SampleLevel(composite.Sampler, uv, 0.0).r;

if (fluidDepth <= 0.0)
{
float3 background = SceneAt(uv);
return float4(ToSRGB(ACESFilm(scene)), 1.0);
}

return float4(ToSRGB(ACESFilm(background)), 1.0);
if (sceneDepth > 0.0 && (fluidDepth >= sceneDepth || FrameOccludesFluid(input, sceneDepth)))
{
return float4(ToSRGB(ACESFilm(scene)), 1.0);
}

float thickness = composite.Thickness.SampleLevel(composite.Sampler, uv, 0.0).r;
Expand All @@ -222,7 +261,7 @@ float4 ShadeWater(FullscreenOutput input)

if (surfaceConfidence <= 0.01)
{
return float4(ToSRGB(ACESFilm(SceneAt(uv))), 1.0);
return float4(ToSRGB(ACESFilm(scene)), 1.0);
}

float3 normalView = ReconstructNormal(uv, fluidDepth);
Expand Down Expand Up @@ -258,7 +297,7 @@ float4 ShadeWater(FullscreenOutput input)
color += sunSpecular * float3(1.0, 0.94, 0.78);
color = lerp(color, float3(0.76, 0.92, 0.96), foam * 0.72);

color = lerp(SceneAt(uv), color, surfaceConfidence);
color = lerp(scene, color, surfaceConfidence);

return float4(ToSRGB(ACESFilm(color)), 1.0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,16 @@ DepthOutput DepthFS(SurfaceVSOutput input)
float sphereZ = sqrt(max(1.0 - radiusSquared, 0.0));
float3 viewPosition = input.CenterView + float3(input.Corner * surface.ParticleRadius, surface.ParticleRadius * 0.62);
float4 clipPosition = mul(float4(viewPosition, 1.0), surface.Projection);
float linearDepth = -viewPosition.z;

if (OccludedByScene(input, -viewPosition.z))
if (OccludedByScene(input, linearDepth))
{
discard;
}

DepthOutput output;
output.LinearDepth = -viewPosition.z;
output.Attributes = float4(input.Speed, input.Density, sphereZ, 1.0);
output.LinearDepth = linearDepth;
output.Attributes = float4(input.Speed, input.Density, sphereZ, linearDepth);
output.DeviceDepth = clipPosition.z / clipPosition.w;

return output;
Expand Down
4 changes: 3 additions & 1 deletion sources/Experiments/FluidTank/Assets/Shaders/Scene.slang
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "SceneCommon.slang"

static const uint FrameMaterialId = 4;

struct SceneConstants
{
float4x4 View;
Expand Down Expand Up @@ -115,7 +117,7 @@ FSOutput FSMain(VSOutput input)
float3 color = diffuse + specular + environment + material.Albedo * material.Emission;

FSOutput output;
output.Color = float4(color, 1.0);
output.Color = float4(color, input.MaterialId == FrameMaterialId ? 1.0 : 0.0);
output.LinearDepth = input.ViewDepth;

return output;
Expand Down
4 changes: 1 addition & 3 deletions sources/Experiments/FluidTank/FluidSimulation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ public FluidSimulation()
ParticleCount = DamDimensions.X * DamDimensions.Y * DamDimensions.Z;

Vector3 tankExtent = TankMax - TankMin;
GridDimensions = new((uint)MathF.Ceiling(tankExtent.X / GridSpacing),
(uint)MathF.Ceiling(tankExtent.Y / GridSpacing),
(uint)MathF.Ceiling(tankExtent.Z / GridSpacing));
GridDimensions = new((uint)MathF.Ceiling(tankExtent.X / GridSpacing), (uint)MathF.Ceiling(tankExtent.Y / GridSpacing), (uint)MathF.Ceiling(tankExtent.Z / GridSpacing));
CellCount = GridDimensions.X * GridDimensions.Y * GridDimensions.Z;
GridPointCount = (GridDimensions.X + 1) * (GridDimensions.Y + 1) * (GridDimensions.Z + 1);
pressureParityDispatchCount = (GridDimensions.X + 1) / 2 * GridDimensions.Y * GridDimensions.Z;
Expand Down
21 changes: 6 additions & 15 deletions sources/Experiments/FluidTank/FluidTankRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace FluidTank;
internal enum FluidViewMode
{
Water,

Particles
}

Expand Down Expand Up @@ -109,7 +110,7 @@ public FluidTankRenderer()

fluidDepthPipeline = GraphicsHelper.CreateGraphicsPipeline(surfaceVertexShader, "FluidSurface.slang", "DepthFS", [], new()
{
ColorFormats = [PixelFormat.R32Float, PixelFormat.R16G16B16A16Float],
ColorFormats = [PixelFormat.R32Float, PixelFormat.R32G32B32A32Float],
DepthStencilFormat = PixelFormat.D32FloatS8UInt,
SampleCount = SampleCount.Count1
}, RasterizerState.CullNone(), DepthStencilState.DepthReadWrite(), BlendState.Opaque(), PrimitiveTopology.TriangleStrip);
Expand Down Expand Up @@ -302,11 +303,7 @@ public void RenderScene(CommandBuffer commandBuffer)
commandBuffer.Transition(sceneLinearDepth, default, TextureLayout.Undefined, TextureLayout.ColorAttachment);
commandBuffer.Transition(DepthStencil, default, TextureLayout.Undefined, TextureLayout.DepthStencilAttachment);

commandBuffer.BeginRenderPass(
[
ColorAttachment.Clear(sceneColor, new(0.0f, 0.0f, 0.0f, 1.0f)),
ColorAttachment.Clear(sceneLinearDepth, Vector4.Zero)
], DepthStencilAttachment.Clear(DepthStencil, 1.0f, 0));
commandBuffer.BeginRenderPass([ColorAttachment.Clear(sceneColor, Vector4.Zero), ColorAttachment.Clear(sceneLinearDepth, Vector4.Zero)], DepthStencilAttachment.Clear(DepthStencil, 1.0f, 0));
commandBuffer.SetPipeline(scenePipeline);
commandBuffer.SetVertexBuffer(sceneVertexBuffer, 0, 0);
commandBuffer.SetIndexBuffer(sceneIndexBuffer, 0, IndexFormat.UInt32);
Expand Down Expand Up @@ -339,11 +336,7 @@ public void RenderFluid(CommandBuffer commandBuffer)
commandBuffer.Transition(smoothDepthA, default, TextureLayout.Undefined, TextureLayout.ColorAttachment);
commandBuffer.Transition(fluidAttributes, default, TextureLayout.Undefined, TextureLayout.ColorAttachment);

commandBuffer.BeginRenderPass(
[
ColorAttachment.Clear(smoothDepthA, Vector4.Zero),
ColorAttachment.Clear(fluidAttributes, Vector4.Zero)
], DepthStencilAttachment.Clear(reconstructionDepth, 1.0f, 0));
commandBuffer.BeginRenderPass([ColorAttachment.Clear(smoothDepthA, Vector4.Zero), ColorAttachment.Clear(fluidAttributes, Vector4.Zero)], DepthStencilAttachment.Clear(reconstructionDepth, 1.0f, 0));
commandBuffer.SetPipeline(fluidDepthPipeline);
commandBuffer.SetConstantBuffer(surfaceConstantBuffer, 0);
commandBuffer.Draw(4, simulation.ParticleCount, 0, 0);
Expand Down Expand Up @@ -423,14 +416,12 @@ public void Resize(uint width, uint height)
uint reconstructionWidth = Math.Max((width + 2) / 3, 1u);
uint reconstructionHeight = Math.Max((height + 2) / 3, 1u);
reconstructionDepth = GraphicsHelper.CreateTexture(PixelFormat.D32FloatS8UInt, reconstructionWidth, reconstructionHeight, TextureUsages.DepthStencilAttachment);
fluidAttributes = GraphicsHelper.CreateTexture(PixelFormat.R16G16B16A16Float, reconstructionWidth, reconstructionHeight, TextureUsages.Sampled | TextureUsages.ColorAttachment);
smoothDepthA = GraphicsHelper.CreateTexture(PixelFormat.R32Float, reconstructionWidth, reconstructionHeight, TextureUsages.Sampled | TextureUsages.Storage | TextureUsages.ColorAttachment);
fluidAttributes = GraphicsHelper.CreateTexture(PixelFormat.R32G32B32A32Float, reconstructionWidth, reconstructionHeight, TextureUsages.Sampled | TextureUsages.ColorAttachment);
smoothDepthB = GraphicsHelper.CreateTexture(PixelFormat.R32Float, reconstructionWidth, reconstructionHeight, TextureUsages.Sampled | TextureUsages.Storage);
smoothThicknessA = GraphicsHelper.CreateTexture(PixelFormat.R16Float, reconstructionWidth, reconstructionHeight, TextureUsages.Sampled | TextureUsages.Storage | TextureUsages.ColorAttachment);
smoothThicknessB = GraphicsHelper.CreateTexture(PixelFormat.R16Float, reconstructionWidth, reconstructionHeight, TextureUsages.Sampled | TextureUsages.Storage);
reflection = App.Context.Capabilities.RayTracingSupported
? GraphicsHelper.CreateTexture(PixelFormat.R16G16B16A16Float, reconstructionWidth, reconstructionHeight, TextureUsages.Sampled | TextureUsages.Storage)
: null;
reflection = App.Context.Capabilities.RayTracingSupported ? GraphicsHelper.CreateTexture(PixelFormat.R16G16B16A16Float, reconstructionWidth, reconstructionHeight, TextureUsages.Sampled | TextureUsages.Storage) : null;
}

public void Dispose()
Expand Down
Loading