Commit Graph

23 Commits

Author SHA1 Message Date
Mike Fricker
114458bf0f Clang warning fixes: Fixed missing 'override' specifiers
- Also removed some unreferenced functions that adding 'override' revealed

PR #1002 -- Thank you, Omar007!

[CL 2498415 by Mike Fricker in Main branch]
2015-04-01 07:20:55 -04:00
Daniel Wright
e391de44c2 Fix for NumPlanes threshold
[CL 2488373 by Daniel Wright in Main branch]
2015-03-23 17:03:36 -04:00
Daniel Wright
0df1ae6976 Integrate - Ray traced distance field shadows now implement the cascade fade
[CL 2466653 by Daniel Wright in Main branch]
2015-03-02 14:11:33 -05:00
Daniel Wright
d05993f885 Heightfield dynamic Global Illumination
* Enable with 'r.DistanceFieldGI 1' on console
* Surfel GI is currently disabled as it doesn't interop yet
* A GBuffer atlas is created for Landscape from components that can affect indirect lighting based on the current view
* Shadowing from a directional light is computed by reusing shadowmaps and ray tracing distance fields
* Lighting is computed for the atlas using GBuffer properties
* First bounce GI light transfer is computed for a receiver by iterating over all the nearby lit texels of the heightfield and treating them as Virtual Point Lights.  Two gather regions are used, the larger one skips through the heightfield to achieve a larger bounce distance.  Distance field AO is used to provide local shadowing.
* Material diffuse color not yet supported, and regions outside of the view don't have valid shadowing.

[CL 2436606 by Daniel Wright in Main branch]
2015-02-06 23:31:19 -05:00
Daniel Wright
666d09cecd Meshes whose distance fields are generated as two sided are expanded during ray traced shadow casting, helps trees match up with CSM much better
Ray traced distance field shadows can be done at full or half res with bilateral upsample.  Half res has some unresolved flickering artifacts from TemporalAA.

[CL 2424672 by Daniel Wright in Main branch]
2015-01-29 18:21:57 -05:00
Daniel Wright
ba3963fcaf Surfel Global Illumination with Distance Field shadowing
* Disabled by default, need a movable skylight with r.DistanceFieldGI enabled at load time (ConsoleVariables.ini)
* Surfels (oriented disks) are placed on mesh surfaces and capture diffuse color by evaluating the material with actual UVs and world position
* Surfels are lit and shadowed by ray tracing through mesh distance fields (directional light only so far)
* Irradiance cache records are lit with nearby Virtual Point Lights created from lit surfels.  Only using camera based LOD of the surfel representation and object based surfel culling, no hierarchy yet.
* Shadowing of the VPLs is provided by distance field cone tracing.  A depth visibility function is constructed along each of the 9 cone trace directions, and used to shadow the incoming VPL lighting.
* Component reregistration and transform updating causes surfels to be generated again which can be slow.  In the future only the material needs to be re-evaluated.
* Geometry shaders with stream out are now supported, by implementing FShader::GetStreamOutElements
* Compute shaders can now evaluate materal attributes like BaseColor
* SkyLight MaxOcclusionDistance increased to 10m, which is the minimum useful amount for GI

[CL 2424208 by Daniel Wright in Main branch]
2015-01-29 14:46:20 -05:00
Martin Mittring
8fcc979523 shadow projection code cleanup, single constructor, accessor functions for some members
[CL 2418138 by Martin Mittring in Main branch]
2015-01-25 13:58:27 -05:00
Daniel Wright
69b4a44ced RTDF shadows don't force backfaces to be shadowed, improves materials with subsurfaces scattering
Added a distance based ray start offset which reduces incorrect self shadowing artifacts

[CL 2417614 by Daniel Wright in Main branch]
2015-01-23 21:17:37 -05:00
Martin Mittring
597a3599eb refactor shadow projection code
[CL 2417411 by Martin Mittring in Main branch]
2015-01-23 17:48:57 -05:00
Martin Mittring
f6f6215e4b added far shadow cascade feature
per scene primitive checkbox, default is on for landscape
 directional light property FarShadowCascadeCount and FarShadowDistance
 todo: ray traced distance field shadows don't fade with it yet, non landscape objects makes with far should be excluded from ry traced distance field

[CL 2416911 by Martin Mittring in Main branch]
2015-01-23 11:17:06 -05:00
Daniel Wright
57721a6245 Distance Field Global Illumination first working version
* Requires a Movable Skylight + 'r.DistanceFieldGI 1' + 'r.GenerateMeshDistanceFields' project setting enabled
* Provides a single bounce of Diffuse GI with bounce distance limited by OcclusionMaxDistance (default 6m)
* Virtual Point Lights are placed from the directional light by ray tracing the scene's distance fields, normal comes from SDF gradient
* Currently only placing 128*128 VPLs up to 40m from camera
* VPLs light irradiance cache samples using hemispherical disk light model, indirect shadowing is provided by the same cone traces used for Distance Field AO
* Irradiance is computed only at irradiance cache points (max every 8 pixels) and interpolated to the rest of the pixels
* Hardcoded half grey material color for now, and poor performance due to brute force VPL lighting

[CL 2390645 by Daniel Wright in Main branch]
2014-12-16 20:00:22 -05:00
John Abercrombie
4e9ac6444a Merging using UE4-Fortnite-To-UE4 @ CL 2382284
[CL 2388856 by John Abercrombie in Main branch]
2014-12-15 15:29:48 -05:00
Ben Marsh
149375b14b Update copyright notices to 2015.
[CL 2379638 by Ben Marsh in Main branch]
2014-12-07 19:09:38 -05:00
Daniel Wright
8ad4d7e4c7 GPU object management of distance field meshes, can handle 100x more meshes with only a small GPU cost for culling. CPU uploads scene change deltas only, nothing per frame.
New primitive component setting bAffectDistanceFieldLighting, useful for grass whose instance count overwhelms DFAO
Distance field volume texture allocations are sorted by size for better packing, and atlas is repacked on texture reallocation

[CL 2368153 by Daniel Wright in Main branch]
2014-11-21 22:32:16 -05:00
Daniel Wright
49e390f99a Avoid assert with zero scale objects
[CL 2345548 by Daniel Wright in Main branch]
2014-10-30 18:29:04 -04:00
Rolando Caloca
d8a576970e UE4 - Remove Color parameter on draw events (DEC_*)
[CL 2334566 by Rolando Caloca in Main branch]
2014-10-20 10:43:43 -04:00
Graeme Thornton
74f9da32d7 Mobile Preview - Removing GRHIShaderPlatform
#codereview Nick.Penwarden

[CL 2321148 by Graeme Thornton in Main branch]
2014-10-07 08:46:39 -04:00
Daniel Wright
09b9524d83 Distance Field AO optimizations profiling on Nvidia
Objects with no distance field representation (character) no longer receive DFAO, that was causing a huge amount of interpolation cost
Interpolation splat uses depth testing, splat bounding geometry is moved to front, with clamping to avoid near plane clipping
Background is stenciled out from interpolation splat pass
Experimental tiled compute interpolation implementation, disabled as it's slower
Covered over NaNs in interpolation pass which were getting expanded during filtering
Surface cache resources are allocated based on worst case of the current resolution, saves memory and prevents overflow

[CL 2311600 by Daniel Wright in Main branch]
2014-09-26 17:07:59 -04:00
Daniel Wright
aacc45c673 Fix for linux compile error
[CL 2303108 by Daniel Wright in Main branch]
2014-09-18 17:00:22 -04:00
Daniel Wright
be518e2d8d Ray traced distance field soft shadows
* Support for point, spot and directional lights
* LightSourceRadius / LightSourceAngle controls how large the penumbras are, with proper sharp contacts
* Directional lights use fast scatter culling path, the others use tiled gather culling
* Local lights only operate on the screen bounding rect

[CL 2302917 by Daniel Wright in Main branch]
2014-09-18 15:13:07 -04:00
Daniel Wright
890f120520 Distance Field AO now works on flat ground planes whose X and Y scale was larger than Z
[CL 2295402 by Daniel Wright in Main branch]
2014-09-12 15:56:36 -04:00
Gil Gribb
598cbb659c UE4 - allow draw events to work in parallel rendering, some flush tweaks
[CL 2293700 by Gil Gribb in Main branch]
2014-09-11 09:38:38 -04:00
Daniel Wright
4477b992e4 Distance field area shadows
* This new shadow method is computed by cone tracing through the mesh distance fields when the 'bGenerateMeshDistanceFields' project setting is enabled
* It has high pixel cost but low object and triangle cost and is useful for covering a large depth range for a dynamic sun.  It inherits all the limitations of mesh distance fields (no vertex animation, only static meshes supported for now, only uniform scaling).  Components can use an inset shadow to use shadowmapping even while the ray traced shadows are used for the rest of the world.
* Currently only implemented for directional lights, as a final cascade after the shadowmapped cascades
* Current implementation groups pixels in a tile into a far depth range and near, tile culls the objects in the scene with those two groups. ~6ms in AITestBed_2 at 1080p on 7870 with a view range of 200k.
* bAllowMeshDistanceFieldRepresentations project setting renamed to bGenerateMeshDistanceFields

[CL 2283597 by Daniel Wright in Main branch]
2014-09-03 18:17:19 -04:00