clean up renderer a bit + README

pull/2/head
cosmonaut 2020-09-19 01:06:08 -07:00
parent 314b308840
commit 8cb7601717
2 changed files with 24 additions and 25 deletions

24
README.md Normal file
View File

@ -0,0 +1,24 @@
# Kav
A 3D renderer built on top of FNA.
## Roadmap
Essential
- [x] PBR shading
- [x] Deferred rendering
- [x] Point lighting
- [x] Directional lighting
- [x] Directional shadow maps
- [x] Cascading shadow maps
- [ ] Frustum culling
- [ ] Shadow-casting point lights
- [ ] Parabolic lights
- [ ] Skyboxes
- [ ] Screen-space reflection
Nice-To-Haves
- [ ] Volumetric lighting
- [ ] Volumetric smoke

View File

@ -210,32 +210,7 @@ namespace Kav
IEnumerable<(Model, Matrix)> modelTransforms,
DirectionalLight directionalLight
) {
// set up global light matrix
var right = Vector3.Cross(Vector3.Up, directionalLight.Direction);
var up = Vector3.Cross(directionalLight.Direction, right);
var cameraBoundingFrustum = new BoundingFrustum(camera.View * camera.Projection);
Vector3[] frustumCorners = cameraBoundingFrustum.GetCorners();
Vector3 frustumCenter = Vector3.Zero;
for (var i = 0; i < frustumCorners.Length; i++)
{
frustumCenter += frustumCorners[i];
}
frustumCenter /= 8f;
var lightView = Matrix.CreateLookAt(frustumCenter, frustumCenter - directionalLight.Direction, camera.View.Right);
for (var i = 0; i < frustumCorners.Length; i++)
{
frustumCorners[i] = Vector3.Transform(frustumCorners[i], lightView);
}
BoundingBox lightBox = BoundingBox.CreateFromPoints(frustumCorners);
Vector3 lightPosition = frustumCenter + directionalLight.Direction * -lightBox.Min.Z;
// render the individual shadow maps
var previousFarPlane = camera.NearPlane;
for (var i = 0; i < NumShadowCascades; i++)
{