From ef190f8ba8c20c080bcec05f32dc90fc8b5fdab1 Mon Sep 17 00:00:00 2001 From: Cassunshine Date: Mon, 22 Jan 2024 16:16:19 +0000 Subject: [PATCH] -Disable GBuffer for now --- Client/Content/shaders/terrain.v.glsl | 4 ++-- Client/Rendering/GameRenderer.cs | 2 +- Client/Rendering/MainFramebuffer.cs | 8 ++++---- Core/Game.cs | 4 +++- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Client/Content/shaders/terrain.v.glsl b/Client/Content/shaders/terrain.v.glsl index 791d541..4616ab3 100644 --- a/Client/Content/shaders/terrain.v.glsl +++ b/Client/Content/shaders/terrain.v.glsl @@ -43,7 +43,7 @@ void vert(vec3 position, int packedColor, int packedUV, float ao, vec2 uvMin, ve o_uvMax = uvMax; } -void frag(vec4 color, vec2 uv, float distance, vec2 uvMin, vec2 uvMax, out vec4 o_color, out vec4 o_gbuffer){ +void frag(vec4 color, vec2 uv, float distance, vec2 uvMin, vec2 uvMax, out vec4 o_color){ o_color = colorNormalAverage(interpolatePixels(uv, uvMin, uvMax, Texture, TextureSampler)) * color; - o_gbuffer = vec4(1, 1, 0, 1); + //o_gbuffer = vec4(1, 1, 0, 1); } diff --git a/Client/Rendering/GameRenderer.cs b/Client/Rendering/GameRenderer.cs index a1f24c4..9319968 100644 --- a/Client/Rendering/GameRenderer.cs +++ b/Client/Rendering/GameRenderer.cs @@ -68,7 +68,7 @@ public override void Render(double delta) { CommandList.SetFramebuffer(Framebuffer.Framebuffer); CommandList.ClearColorTarget(0, RgbaFloat.Grey); - CommandList.ClearColorTarget(1, RgbaFloat.Green); + //CommandList.ClearColorTarget(1, RgbaFloat.Green); CommandList.ClearDepthStencil(1); MainCamera.position = Client.PlayerEntity?.SmoothPosition(Client.smoothFactor) + Client.PlayerEntity?.eyeOffset ?? dvec3.Zero; diff --git a/Client/Rendering/MainFramebuffer.cs b/Client/Rendering/MainFramebuffer.cs index d2369ca..f8cbcc1 100644 --- a/Client/Rendering/MainFramebuffer.cs +++ b/Client/Rendering/MainFramebuffer.cs @@ -54,7 +54,7 @@ public MainFramebuffer(ResourceFactory factory, Framebuffer windowBuffer, uint w MainColor = AddDependency(factory.CreateTexture(baseDescription)); Normal = AddDependency(factory.CreateTexture(baseDescription)); - baseDescription.Format = PixelFormat.R32_Float; + baseDescription.Format = PixelFormat.D24_UNorm_S8_UInt; baseDescription.Usage = TextureUsage.DepthStencil | TextureUsage.Sampled; Depth = AddDependency(factory.CreateTexture(baseDescription)); @@ -72,7 +72,7 @@ public MainFramebuffer(ResourceFactory factory, Framebuffer windowBuffer, uint w ResolvedMainColor = AddDependency(factory.CreateTexture(baseDescription)); ResolvedNormal = AddDependency(factory.CreateTexture(baseDescription)); - baseDescription.Format = PixelFormat.R32_Float; + baseDescription.Format = PixelFormat.D24_UNorm_S8_UInt; baseDescription.Usage = TextureUsage.DepthStencil | TextureUsage.Sampled; ResolvedDepth = AddDependency(factory.CreateTexture(baseDescription)); @@ -81,7 +81,7 @@ public MainFramebuffer(ResourceFactory factory, Framebuffer windowBuffer, uint w Framebuffer = AddDependency(factory.CreateFramebuffer(new FramebufferDescription { ColorTargets = new[] { new FramebufferAttachmentDescription(MainColor, 0), - new FramebufferAttachmentDescription(Normal, 0) + //new FramebufferAttachmentDescription(Normal, 0) }, DepthTarget = new FramebufferAttachmentDescription(Depth, 0) })); @@ -93,7 +93,7 @@ public void Resolve(RenderSystem renderSystem) { if (Samples == TextureSampleCount.Count1) return; renderSystem.MainCommandList.ResolveTexture(MainColor, ResolvedMainColor); - renderSystem.MainCommandList.ResolveTexture(Normal, ResolvedNormal); + //renderSystem.MainCommandList.ResolveTexture(Normal, ResolvedNormal); //renderSystem.MainCommandList.ResolveTexture(Depth, ResolvedDepth); } diff --git a/Core/Game.cs b/Core/Game.cs index 014c8dd..f38eb86 100644 --- a/Core/Game.cs +++ b/Core/Game.cs @@ -41,7 +41,9 @@ public void Run(int tps = 20, string windowTitle = "Game") { }; var gdo = new GraphicsDeviceOptions { - PreferDepthRangeZeroToOne = true, PreferStandardClipSpaceYDirection = true, SyncToVerticalBlank = true, + PreferDepthRangeZeroToOne = true, + PreferStandardClipSpaceYDirection = true, + SyncToVerticalBlank = true, }; VeldridStartup.CreateWindowAndGraphicsDevice(wci, gdo, GraphicsBackend.Vulkan, out var nw, out var gd);