ProwlEngine / Prowl

An Open Source C# 3D Game Engine under MIT license, inspired by Unity and featuring a complete editor and built on Silk.NET
MIT License
360 stars 30 forks source link

[Rendering] Removed Position Buffer & Pack Normal with Roughness and Metalness #85

Open michaelsakharov opened 9 months ago

michaelsakharov commented 9 months ago

Position buffer stores the View Position of each pixel But we can calculate that anywhere with:

#include "Utilities"

vec3 viewPos = getViewPos(TexCoords, gDepthSampler);

So a Dedicated buffer is no longer needed While we're at it we need a place to put Roughness, since we currently store that inside the Position buffers alpha channel.

We can compress Normal down to 2 floats, so Rename the Normal buffer to Surface, and pack like so: Normal into X and Y Roughness into Z Metalness into W