Skip to content

Universal/deferred #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 247 commits into from
May 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
247 commits
Select commit Hold shift + click to select a range
d50f248
Initial commit for skeleton code for tiled-based deferred shading wit…
kaychang-unity Aug 16, 2019
530c98b
Moved management of ComputeBuffers in DeferredPass.cs into a separate…
kaychang-unity Aug 20, 2019
301e350
Re-added DeferredRendererData asset file, in the hope it solves some …
kaychang-unity Aug 20, 2019
c69ecd2
Moved from using structured buffer to separate uniform buffers.
kaychang-unity Aug 21, 2019
0a1aafa
Moved to temporary allocations.
kaychang-unity Aug 21, 2019
9246076
Optimized management for ComputeBuffers used as uniform buffers.
kaychang-unity Aug 21, 2019
692adc1
Added calculation for depth ranges of light list per tile.
kaychang-unity Aug 27, 2019
965f685
Fixed matrix multiplication error.
kaychang-unity Aug 28, 2019
c9fa160
Temporary code to calculate world space position.
kaychang-unity Aug 28, 2019
77e51dd
Added pass to generate per-tile depth information.
kaychang-unity Aug 30, 2019
c87d666
Visible lights now have selectable render paths to be processed as ti…
kaychang-unity Sep 4, 2019
03169a0
Deleted Tiling.shader after renaming.
kaychang-unity Sep 4, 2019
75afc60
Simplified upload code for point light data.
kaychang-unity Sep 4, 2019
c085c53
Updated asset file.
kaychang-unity Sep 4, 2019
42629c9
Moved DeferredPass.cs into Passes folder.
kaychang-unity Sep 4, 2019
f6b9827
Small rewrite for light loop in tileDeferred shader (slightly faster …
kaychang-unity Sep 5, 2019
31cdaaf
Better sphere geometry for rendering stencil lights.
kaychang-unity Sep 12, 2019
d74cc78
Update Unity .meta files
Wilfrid-Unity Sep 13, 2019
d40984d
Add missing Unity .meta files
Wilfrid-Unity Sep 13, 2019
d098551
Add comments to UniversalRenderPipeline.cs about command buffer and t…
Wilfrid-Unity Sep 13, 2019
b7e5fd0
Add comments to ScriptableRenderer.Execute
Wilfrid-Unity Sep 13, 2019
59c334a
Add comments about RenderTargetHandle
Wilfrid-Unity Sep 13, 2019
db4a82b
Add comments about ScriptableRenderer members
Wilfrid-Unity Sep 13, 2019
0fdf2db
Add basic Multi-RenderTarget support to ScriptableRenderer.cs
Wilfrid-Unity Sep 13, 2019
fb1e8bb
Add basic GBuffer pass
Wilfrid-Unity Sep 13, 2019
328dc90
Added CopyDepthPass to get around current issue where depth buffer ca…
kaychang-unity Sep 13, 2019
3f6354e
Stencil light fix.
kaychang-unity Sep 13, 2019
b52e0c7
Fixed artefact when downsampling depth buffers into tiles.
kaychang-unity Sep 16, 2019
bd5d0db
Update GBuffer formats
Wilfrid-Unity Sep 17, 2019
388d532
Compile-time settings to allow shader parameters to be passed as cbuf…
kaychang-unity Sep 17, 2019
c7af9d1
Fixed small error from preious commit (windows build).
kaychang-unity Sep 17, 2019
d4bc2d8
Moved tiler code into separate file.
kaychang-unity Sep 18, 2019
392d292
Fixed incorrect size for LightData cbuffer.
kaychang-unity Sep 18, 2019
817977e
Hierarchical tiling.
kaychang-unity Sep 19, 2019
650187d
TileDepthRange shader now accepts variable size tiles.
kaychang-unity Sep 19, 2019
8e5963c
Changed line endings to windows convention.
kaychang-unity Sep 19, 2019
62af34a
Another attempt to commit a working DeferredRendererData.asset.
kaychang-unity Sep 19, 2019
37d1e7d
Merge branch 'master' into universal/deferred
kaychang-unity Sep 19, 2019
49e4334
Merge branch 'master' into universal/deferred
kaychang-unity Sep 19, 2019
dc405f6
Do not set MRT attachments if they are already set
Wilfrid-Unity Sep 20, 2019
1d03701
Add small comment to DeferredLights.cs
Wilfrid-Unity Sep 20, 2019
05c4af2
Do not execute the DepthRanges pass when using StencilDeferred
Wilfrid-Unity Sep 20, 2019
fbf7d9d
Add W.I.P code for Deferred Point Lights support
Wilfrid-Unity Sep 20, 2019
d3753e5
Added new boolean m_HasTileLights to detect when TileDepthRange pass …
kaychang-unity Sep 20, 2019
deee6af
Renamed DeferredLights.useTiles into tiledDeferredShading and expose …
kaychang-unity Sep 20, 2019
2f01cb4
Updated DeferredRenderer.asset in UniversalGraphicsTest project.
kaychang-unity Sep 20, 2019
3708a41
Temporary fix: clear lighting buffer at the beginning of the deferred…
kaychang-unity Sep 20, 2019
1e73d00
Add comments to DeferredLights.cs
Wilfrid-Unity Sep 24, 2019
3a25a98
TileDepthPass generates a bitmask instead of calculating geometry min…
kaychang-unity Sep 24, 2019
9ed12c1
Allows structured buffer to be used to store listDepthRange instead o…
kaychang-unity Sep 24, 2019
6f06ac9
Simplified ComputeBuffer management in DeferredShaderData class.
kaychang-unity Sep 25, 2019
a3f11cf
Update this with explanation from https://github.com/Unity-Technologi…
Wilfrid-Unity Sep 25, 2019
1b47245
Add null check in DeferredShaderData.GetOrUpdateBuffer to avoid issue…
Wilfrid-Unity Sep 25, 2019
51248b4
Add reference paper title in comments for normal packing functions
Wilfrid-Unity Sep 25, 2019
7d4dfd6
Use DeferredRenderer.m_CameraColorAttachment as the 3rd GBuffer slice…
Wilfrid-Unity Sep 25, 2019
0f5ea81
Fixed bug where bitshift operator is fed negative operand (undefined …
kaychang-unity Sep 25, 2019
e1dc6a8
Fixed bug where m_BufferCount is not reset to 0 when Dispose() is cal…
kaychang-unity Sep 25, 2019
7f3a89f
More simplification in DeferredShaderData.cs (ReserveBuffer() replace…
kaychang-unity Sep 25, 2019
b074ae8
Allows TileDepthRangePass to be executed as either 1 or 2 passes (2 p…
kaychang-unity Sep 26, 2019
e626d99
Optimized TileDepthInfo shaders with GatherRed() and manual unrolling…
kaychang-unity Sep 27, 2019
56e59c6
Initialize RenderTargetHandles in DeferredRenderer.cs for consistency…
Wilfrid-Unity Sep 30, 2019
8f841fa
Use 24 bits for packed normal in GBuffer
Wilfrid-Unity Sep 30, 2019
d9404a8
MRT support: handle case when m_CameraColorTarget is contained in ren…
Wilfrid-Unity Sep 30, 2019
91cf385
Compute lighting contribution from Main Light conduring GBuffer pass …
Wilfrid-Unity Sep 30, 2019
fc0f254
Add the Skybox pass
Wilfrid-Unity Sep 30, 2019
f2c059d
Use XR-friendly macro for vertex transformation.
kaychang-unity Sep 30, 2019
cfe0785
Disable oct. normals packing until it is fixed (causes visual artifacts)
Wilfrid-Unity Oct 1, 2019
3216281
Fix viewDirection used in Deferred lighting
Wilfrid-Unity Oct 1, 2019
b84a2c3
Pass correct light attenuation and color to Deferred Lighting pipelin…
Wilfrid-Unity Oct 1, 2019
c36d8d3
Add comments, including some based on explanations from @kaychang-uni…
Wilfrid-Unity Oct 2, 2019
b8bdc60
Use Unity.Mathematics (without Burst) for tile light culling, as well…
kaychang-unity Oct 2, 2019
3ffa680
Lighing buffer is HDR format.
kaychang-unity Oct 2, 2019
9748a73
Reflect feedback from comments in https://github.com/Unity-Technologi…
Wilfrid-Unity Oct 3, 2019
6a22e32
Add spot lighting
Wilfrid-Unity Oct 4, 2019
a8c4eaf
Removed 31 light per tile limitation.
kaychang-unity Oct 4, 2019
70d7f37
Per-tile light list stores the light depth range in the higher 16bits…
kaychang-unity Oct 8, 2019
e7a355b
Sort lights front to back using camera distance. This enables the opt…
kaychang-unity Oct 8, 2019
4600d8a
Fix Main Directional Light that was not visible in Standalone Players
Wilfrid-Unity Oct 9, 2019
23a65e4
Collapsed unecessary calculations in fragment shaders for deferred sh…
kaychang-unity Oct 9, 2019
4250b8b
Committed a new test-scene.
kaychang-unity Oct 10, 2019
085d9a4
Merge DeferredLights.LightConstantBuffer definitions into DeferredLig…
Wilfrid-Unity Oct 10, 2019
21ee9d0
Remove shader macro TEST_WIP_DEFERRED_POINT_LIGHTING (point lights ar…
Wilfrid-Unity Oct 10, 2019
ad024fe
Fix error (happening with ForwardRenderer in scenes without MainDirLi…
Wilfrid-Unity Oct 10, 2019
74adb69
Renamed wsPos to posWS and vsPos to posVS.
kaychang-unity Oct 10, 2019
1a4a9de
Initial job system support.
kaychang-unity Oct 10, 2019
af147a6
Nintendo Switch does not use SHADER_HINT_NICE_QUALITY, fixes incorrec…
kaychang-unity Oct 21, 2019
e8888f0
Support for stencil spot lights.
kaychang-unity Oct 22, 2019
798da73
Fix for iOS platform.
kaychang-unity Oct 22, 2019
36ac7f5
Small code reformat.
kaychang-unity Oct 23, 2019
e74737f
Main directional light casts shadows.
kaychang-unity Oct 23, 2019
54372f2
Added shadow support for stencil lights.
kaychang-unity Oct 24, 2019
6607913
Fixed crash when no additional lights cast shadows.
kaychang-unity Oct 24, 2019
ed08873
Fixed assert on point lights casting shadows (not supported yet).
kaychang-unity Oct 25, 2019
be11b0c
Fixed incorrect hannel for metallic/alpha.
kaychang-unity Oct 29, 2019
4424058
Additional directional lights.
kaychang-unity Oct 29, 2019
fbc84da
Minor variant name change.
kaychang-unity Oct 29, 2019
b9ec17a
Legacy fog support.
kaychang-unity Oct 29, 2019
3953b97
Transparent pass reuses forward renderer code.
kaychang-unity Oct 29, 2019
aa7e212
Re-added post-processing passes.
kaychang-unity Oct 29, 2019
0e7fe53
Added initial support for unlit, bakedLit and simpleLit shaders for d…
kaychang-unity Oct 31, 2019
5f751b7
Use stencil bit 5 to allow Unlit and BakedLit materials to be skipped…
kaychang-unity Oct 31, 2019
d08d7c5
Incorrect depth buffer was bound during transparent pass.
kaychang-unity Oct 31, 2019
13f9929
Do not store alpha in gbuffer anymore, metallic reclaims +4 bits, fix…
kaychang-unity Oct 31, 2019
791a7c8
Fixed typo, metallic not correctly read back from gbuffer.
kaychang-unity Nov 4, 2019
52385b6
Moved unlit material into its own stencil bit (bit 6) and modified de…
kaychang-unity Nov 5, 2019
133ae47
Lit shader outputs different gbuffer layout than SimpleLit shader.
kaychang-unity Nov 5, 2019
7dbf59b
Missing file from previous commit.
kaychang-unity Nov 6, 2019
070daf7
Fixed logic for depth-prepass.
kaychang-unity Nov 6, 2019
202b423
Fixed simpleLit emissive output being added twice.
kaychang-unity Nov 7, 2019
a10ed75
Fixed normal octaedron encoding in gbuffer.
kaychang-unity Nov 7, 2019
db7fc93
Removed incorrect code to cecide which graphics format to use for lig…
kaychang-unity Nov 7, 2019
1ef5ffe
Incorrect formula for packing smoothness for SimpleLit shader.
kaychang-unity Nov 7, 2019
1d5078a
Minor comment.
kaychang-unity Nov 7, 2019
a4f2111
Silence specular for Lit material if UI requests it.
kaychang-unity Nov 7, 2019
9ade1c7
Particle systems can spawn lights. Fixed code to reference VisibleLig…
kaychang-unity Nov 8, 2019
724f309
Added support for flag _RECEIVE_SHADOWS_OFF in deferred render path (…
kaychang-unity Nov 8, 2019
59fc08f
Remove redundant cmd.SetGlobalTexture call as pointed out in https://…
Wilfrid-Unity Nov 12, 2019
2c2c4cd
Specular highlight refactoring:allows optional dynamic branch to skip…
kaychang-unity Nov 12, 2019
2b4f12b
Updated incorrect comment.
kaychang-unity Nov 12, 2019
7f9e37d
Particle shader can output to gbuffer pass.
kaychang-unity Nov 13, 2019
e4ef38d
Added gbuffer pass to custom shader.
kaychang-unity Nov 13, 2019
5de1fa9
Fixed shader ompiler warnings.
kaychang-unity Nov 13, 2019
f7fc101
Reverted incorrect commit.
kaychang-unity Nov 13, 2019
df7e247
Fixed compilation error in shader (unrelated to this deferred branch).
kaychang-unity Nov 14, 2019
41ff649
Terrain output to gbuffer.
kaychang-unity Nov 14, 2019
81f4c6c
Added gbuffer pass for Speedtree shaders (Nature shaders).
kaychang-unity Nov 14, 2019
f219ef3
Missing stencil setup for particles and terrain shaders for gbuffer p…
kaychang-unity Nov 14, 2019
0a5b9e3
ShaderGraph shader have gbuffer pass (PBR and unlit subshaders).
kaychang-unity Nov 15, 2019
3317c57
Correct strings to set stencil for shaderGraph shaders.
kaychang-unity Nov 15, 2019
7af432b
Custom shader has gbuffer pass.
kaychang-unity Nov 15, 2019
d37c485
Speedtree 7 billboard shader has gbuffer pass.
kaychang-unity Nov 18, 2019
417e552
Merge remote-tracking branch 'origin/master' into universal/deferred
kaychang-unity Nov 19, 2019
9ba7c62
Fixed compilation errors from previous merge.
kaychang-unity Nov 19, 2019
b50675d
More fixes for terrain shaders.
kaychang-unity Nov 20, 2019
a0ac5b1
Original DirectBDRF() signature for backward compatibility.
kaychang-unity Nov 21, 2019
6522bee
Fixed compilation warnings.
kaychang-unity Nov 21, 2019
c516fc8
Fixed errors with duplicate symbols _BumpMap and _EmissionMap.
kaychang-unity Nov 21, 2019
9afe92c
Updatd incorrect comment.
kaychang-unity Nov 21, 2019
6834b42
Fixed transparent pass not getting fog.
kaychang-unity Nov 21, 2019
b66b8bf
Removed unecessary forward opaque pass.
kaychang-unity Nov 21, 2019
22d0649
Fixed matrices for XR rendering mode.
kaychang-unity Nov 27, 2019
0cc027c
Added support for XR Single Pass mode.
kaychang-unity Nov 27, 2019
44ec789
Fixed macro not being declared yet.
kaychang-unity Nov 27, 2019
7b0e5ce
Use UNITY_MATRIX_XXX instead of unity_MatrixXXX by convention.
kaychang-unity Nov 27, 2019
255992b
Better fix for macro issue.
kaychang-unity Nov 28, 2019
a98c7cb
Better fix for macro issue.
kaychang-unity Nov 28, 2019
ee5608f
Fix XR Support Single Pass Instanced.
kaychang-unity Nov 28, 2019
cf55a8a
minor improvements in code.
kaychang-unity Nov 28, 2019
dc8daa2
Unlit and BakedLit material types are now rendered into their own for…
kaychang-unity Dec 3, 2019
aa2b428
Renamed UniversalForward into UniversalForwardOnly for UniversalRP vf…
kaychang-unity Dec 3, 2019
76e2879
Merge branch 'master' into universal/deferred
kaychang-unity Dec 4, 2019
5b76b4d
More changes after feedback.
kaychang-unity Dec 5, 2019
65856fe
Fixed incorrect shadow-related shader keywords set for the forward tr…
kaychang-unity Dec 5, 2019
0d87161
Merge branch 'master' into universal/deferred
kaychang-unity Dec 6, 2019
f1e50d4
XR Multipass support.
kaychang-unity Dec 10, 2019
6c96416
Disable tile-deferred-shading by default.
kaychang-unity Dec 11, 2019
1eedb96
Use GL.GetGPUProjectionMatrix() to calculate ScreenToWorld matrix (in…
kaychang-unity Dec 17, 2019
9001503
Attempt to support stencilOverride (not possible).
kaychang-unity Dec 17, 2019
691d367
Commented out Stencil override option from UI (until we find a way to…
kaychang-unity Dec 17, 2019
d05926f
Additional lights can be disabled.
kaychang-unity Dec 17, 2019
b70f67e
Merge remote-tracking branch 'origin/master' into universal/deferred
kaychang-unity Dec 23, 2019
55d4112
Fixed minor compilation eror after merge with master.
kaychang-unity Dec 23, 2019
ae1eba2
Updated changelog.
kaychang-unity Dec 23, 2019
0387f88
Merge branch 'master' into universal/deferred
kaychang-unity Jan 6, 2020
4a7b0f7
Fixed errors from merge with master branch.
kaychang-unity Jan 7, 2020
48ef9fc
Minor update to CHANGELOG.md
sharlenet Jan 8, 2020
9965b61
iOS Metal fix.
kaychang-unity Jan 10, 2020
122c79c
Fixed Vulkan compilation error.
kaychang-unity Jan 15, 2020
d91406c
Fix for GL based platforms.
kaychang-unity Jan 15, 2020
34fb07f
Compilation error on Switch.
kaychang-unity Jan 17, 2020
6d84d77
Merge remote-tracking branch 'origin/master' into universal/deferred
kaychang-unity Jan 20, 2020
1626466
Camera stacking fix.
kaychang-unity Jan 20, 2020
fdfd81e
Fixed shader compilation error.
kaychang-unity Jan 21, 2020
51c3ba5
Fix for orthographic matrices: avoid using GL.GetGPUProjectionMatrix()!
kaychang-unity Jan 21, 2020
ab5f06d
Refactoring to more closely match ForwardRenderer code.
kaychang-unity Jan 25, 2020
97d76e0
Added initial support for Burst in tiled-based deferred renderer.
kaychang-unity Jan 27, 2020
81d6536
Removed sync points for Burst jobs.
kaychang-unity Jan 27, 2020
8572593
Simplified code that setup jobs.
kaychang-unity Jan 27, 2020
f3bbf82
Added Burst as dependency for UniversalRP package.
kaychang-unity Jan 27, 2020
6670409
Merge master.
kaychang-unity Jan 28, 2020
22d7202
Renamed Cleanup() to Dispose().
kaychang-unity Jan 28, 2020
3bad656
Fixed fp16 precision error on Nintendo Switch.
kaychang-unity Jan 30, 2020
616c562
More refactoring. Added code to support "offscreen depth texture" mode.
kaychang-unity Jan 31, 2020
b2407d3
Removed extra depth copy (may put it back in when new RenderPass api …
kaychang-unity Feb 11, 2020
e15b1be
Minor fix for incorrect depth texture binding in post-processing passes.
kaychang-unity Feb 11, 2020
c9ef9ae
Added an option to select between accurage g-buffer normals and fast …
kaychang-unity Feb 12, 2020
518a0a1
Addressed some of the PR feedback.
kaychang-unity Feb 15, 2020
fdce239
Simplified code for allocating color and depth textures (but is it en…
kaychang-unity Feb 18, 2020
06b22e1
Removed unnecessary method.
kaychang-unity Feb 18, 2020
41462d2
Merge remote-tracking branch 'origin/master' into universal/deferred
kaychang-unity Feb 19, 2020
4ede811
Fix after merge.
kaychang-unity Feb 19, 2020
0cc8721
Merge remote-tracking branch 'origin/master' into universal/deferred
kaychang-unity Feb 19, 2020
334db5a
Fixed incorrect binding of _CameraDepthTexture.
kaychang-unity Feb 25, 2020
f797bae
Reverted original fog functions.
kaychang-unity Feb 25, 2020
0034896
Replaced Vector4UInt by Unity.Mathematics.uint4.
kaychang-unity Feb 25, 2020
017b6f8
Disable MSAA as a RenderingFeature.
kaychang-unity Feb 26, 2020
13e9e82
Variable was already available.
kaychang-unity Feb 26, 2020
f9b0701
Minor fix to match forward renderer RenderPassEvent parameters for re…
kaychang-unity Feb 26, 2020
5d1f7b5
Moved a few helper functions from ForwardLights to UniversalRenderPip…
kaychang-unity Feb 27, 2020
685e742
Moved some shader keywords to ShaderKeywordStrings.
kaychang-unity Feb 27, 2020
c2fd4b6
Merge remote-tracking branch 'origin/master' into universal/deferred
kaychang-unity Feb 27, 2020
a1020ae
Synced deferred renderer code with forward renderer again.
kaychang-unity Feb 27, 2020
b7ab83c
iOS uses intermediate RT to generate tileDepthInfo.
kaychang-unity Mar 4, 2020
c1a5976
Small refactoring.
kaychang-unity Mar 5, 2020
1520a1c
Fixed typo.
kaychang-unity Mar 6, 2020
57236af
Fixed typo.
kaychang-unity Mar 6, 2020
702698f
Minor cleanup/optimisation.
kaychang-unity Mar 8, 2020
7a1a582
Fixed memory leak and NaN (incorrect shadow light index passed to def…
kaychang-unity Mar 9, 2020
d52aaf0
Fixed line ending to Unix.
kaychang-unity Mar 9, 2020
fee23d9
Merge remote-tracking branch 'origin/master' into universal/deferred
kaychang-unity Mar 13, 2020
01250bf
Moved to new shaderGraph after merge.
kaychang-unity Mar 14, 2020
3ccaf1d
CopyDepthPass.AllocateRT is now internal.
kaychang-unity Mar 17, 2020
577e9ae
Renamed GetShadowLightIndexForLightIndex() into GetShadowLightIndexFr…
kaychang-unity Mar 17, 2020
67b1812
Restored original file from master branch, re-added Unity.Burst.Edito…
kaychang-unity Mar 17, 2020
7ab6964
Fixed line endings to original file.
kaychang-unity Mar 17, 2020
20c0056
Better code for shadergraph stencil state.
kaychang-unity Mar 18, 2020
23f98e7
Merge remote-tracking branch 'origin/master' into universal/deferred
kaychang-unity Mar 18, 2020
03ff4ab
Fixed compilation error.
kaychang-unity Mar 18, 2020
f1c28e2
Fix line endings warnings.
kaychang-unity Mar 18, 2020
2c59f81
Fixed compilation warning.
kaychang-unity Mar 18, 2020
555031e
Tentative fix for double rendering for shaderGraph unlit materials (m…
kaychang-unity Mar 19, 2020
aaa485e
Simplified shader pass names system by allowing unnamed pass to be pr…
kaychang-unity Mar 19, 2020
c320038
XR not supported in deferred renderer for now.
kaychang-unity Mar 19, 2020
d161adc
Disable tiledDeferredShading option from UI and serialized data.
kaychang-unity Mar 20, 2020
27f4d36
Small iOS optimisation.
kaychang-unity Mar 24, 2020
629d7db
Code to disable specular is the same on mobile and Nintendo Switch (m…
kaychang-unity Mar 25, 2020
7621be5
Shader optimisations.
kaychang-unity Mar 25, 2020
6aa3107
Fixed floating point accuracy error on iOS.
kaychang-unity Mar 25, 2020
4d5eac7
Moved to more recent burst package (fix build errors).
kaychang-unity Mar 25, 2020
01ae25f
Fixed early stencil rejection not working during deferred shading pas…
kaychang-unity Mar 27, 2020
13324eb
Tiled deferred shading was missing variant without accurate gbuffer n…
kaychang-unity Mar 27, 2020
d9b4148
minor Switch-specfic bug (workaround for SHADER_API_CORE incorrectly …
kaychang-unity Mar 27, 2020
0adcadb
Changed default: don't use depth-prepass (not so useful anymore) and …
kaychang-unity Mar 27, 2020
2295139
Simplified gbuffer management code.
kaychang-unity Mar 31, 2020
90b9c1c
Merge remote-tracking branch 'origin/master' into universal/deferred
kaychang-unity Apr 1, 2020
4465eba
Fixed memory leak (Don't use Allocator.TempJob but Allocator.Temp).
kaychang-unity Apr 2, 2020
302f67a
Moved version of Burst to match core package.
kaychang-unity Apr 3, 2020
6467daa
Merge branch 'master' into universal/deferred
kaychang-unity Apr 8, 2020
07a089b
Fixed after shadergraph refactoring from master.
kaychang-unity Apr 8, 2020
757811b
Disable camera stacking again, as it is not working for all situations.
kaychang-unity Apr 8, 2020
f48e4e8
Refactored gbuffer binding code to prepare for future changes (depth …
kaychang-unity Apr 30, 2020
244ab0a
Removed DeferredRenderer assets for testing.
kaychang-unity Apr 30, 2020
a23334f
Merge branch 'master' into universal/deferred.
kaychang-unity May 5, 2020
2fb3cb6
Fix after merge.
kaychang-unity May 6, 2020
f833ec3
Fixed line ending for deferred renderer.
kaychang-unity May 6, 2020
f37d9d7
Unix line endings.
kaychang-unity May 6, 2020
de0a904
Removed unused 'Universal2DUnlit' tag.
kaychang-unity May 7, 2020
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
7,064 changes: 7,064 additions & 0 deletions TestProjects/UniversalGraphicsTest/Assets/Scenes/008_MoreAdditionalLights.unity

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Shader "Custom/UniversalPipeline/CustomParticleData"
Shader "Custom/UniversalPipeline/CustomParticleData"
{
Properties
{
Expand All @@ -9,10 +9,10 @@
Tags { "RenderType" = "Opaque" "IgnoreProjectors" = "True" }
LOD 100

Blend SrcAlpha OneMinusSrcAlpha

Pass
{
Blend SrcAlpha OneMinusSrcAlpha

CGPROGRAM
#pragma vertex vert
#pragma fragment frag
Expand Down Expand Up @@ -61,5 +61,85 @@
}
ENDCG
}

Pass
{
// Lightmode matches the ShaderPassName set in UniversalRenderPipeline.cs. SRPDefaultUnlit and passes with
// no LightMode tag are also rendered by Universal Render Pipeline
Name "GBuffer"
Tags{"LightMode" = "UniversalGBuffer"}

Blend Off

// [Stencil] Bit 5-6 material type. 00 = unlit/bakedList, 01 = Lit, 10 = SimpleLit
// This is a Lit material.
Stencil {
Ref 32 // 0b00100000
WriteMask 96 // 0b01100000
Comp Always
Pass Replace
Fail Keep
ZFail Keep
}

HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
//#pragma enable_d3d11_debug_symbols

#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl"

struct Attributes
{
float4 positionOS : POSITION;
float4 uv : TEXCOORD0;
float3 uv2 : TEXCOORD1;
UNITY_VERTEX_INPUT_INSTANCE_ID
};

struct Varyings
{
float4 uv : TEXCOORD0;
float3 uv2 : TEXCOORD1;
float4 vertex : SV_POSITION;

UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};

Varyings vert(Attributes input)
{
Varyings output = (Varyings)0;

UNITY_SETUP_INSTANCE_ID(input);
UNITY_TRANSFER_INSTANCE_ID(input, output);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);

VertexPositionInputs vertexInput = GetVertexPositionInputs(input.positionOS.xyz);
output.vertex = vertexInput.positionCS;
output.uv = input.uv;
output.uv2 = input.uv2;

return output;
}

FragmentOutput frag(Varyings input)
{
UNITY_SETUP_INSTANCE_ID(input);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);

SurfaceData surfaceData = (SurfaceData)0;
surfaceData.alpha = 1.0;

InputData inputData = (InputData)0;
inputData.normalWS = half3(0, 1, 0); // need some default to avoid division by 0.

// sample the texture
half4 color = half4(input.uv.zw, input.uv2.x, 1);
return SurfaceDataToGbuffer(surfaceData, inputData, color.rgb, kLightingInvalid);
}

ENDHLSL
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ Shader "Test/CopyToViewport"
Cull Off ZWrite Off ZTest Always

Pass
{
HLSLPROGRAM
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceInput.hlsl"

{
HLSLPROGRAM
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceInput.hlsl"
TEXTURE2D(_SrcTex);
SAMPLER(sampler_SrcTex);

Expand All @@ -27,10 +27,10 @@ Shader "Test/CopyToViewport"
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};

Varyings vert(Attributes input)
{
Varyings output = (Varyings)0;
Varyings output = (Varyings)0;
VertexPositionInputs vertexInput = GetVertexPositionInputs(input.positionOS.xyz);
output.vertex = vertexInput.positionCS;
output.uv = input.uv;
Expand All @@ -39,14 +39,14 @@ Shader "Test/CopyToViewport"

half4 frag(Varyings input) : SV_Target
{
half4 col = SAMPLE_TEXTURE2D(_SrcTex, sampler_SrcTex, input.uv);
half4 col = SAMPLE_TEXTURE2D(_SrcTex, sampler_SrcTex, input.uv);
return col;
}

#pragma vertex vert
#pragma fragment frag

ENDHLSL
ENDHLSL
}
}
}
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
Shader "Test/OutputColorsToMRTs"
{
Properties
{
}
SubShader
{
// No culling or depth
Cull Off ZWrite Off ZTest Always
Pass
Shader "Test/OutputColorsToMRTs"
{
Properties
{
}
SubShader
{
// No culling or depth
Cull Off ZWrite Off ZTest Always

Pass
{
HLSLPROGRAM
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceInput.hlsl"

struct Attributes
{
float4 positionOS : POSITION;
};
struct Varyings
{
float4 vertex : SV_POSITION;
};

struct FragmentOutput
{
half4 dest0 : SV_Target0;
half4 dest1 : SV_Target1;
struct Attributes
{
float4 positionOS : POSITION;
};

struct Varyings
{
float4 vertex : SV_POSITION;
};

struct FragmentOutput
{
half4 dest0 : SV_Target0;
half4 dest1 : SV_Target1;
};
Varyings vert(Attributes input)
{

Varyings vert(Attributes input)
{
Varyings output = (Varyings)0;
VertexPositionInputs vertexInput = GetVertexPositionInputs(input.positionOS.xyz);
output.vertex = vertexInput.positionCS;
return output;
}
FragmentOutput frag(Varyings input) : SV_Target
{
FragmentOutput o;
VertexPositionInputs vertexInput = GetVertexPositionInputs(input.positionOS.xyz);
output.vertex = vertexInput.positionCS;
return output;
}

FragmentOutput frag(Varyings input)
{
FragmentOutput o;
o.dest0 = half4(0, 0, 1, 1);
o.dest1 = half4(1, 0, 0, 1);
return o;
}
#pragma vertex vert
#pragma fragment frag
return o;
}

#pragma vertex vert
#pragma fragment frag

ENDHLSL
}
}
}
}
}
}
6 changes: 6 additions & 0 deletions com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,12 @@ float3 ComputeWorldSpacePosition(float2 positionNDC, float deviceDepth, float4x4
return hpositionWS.xyz / hpositionWS.w;
}

float3 ComputeWorldSpacePosition(float4 positionCS, float4x4 invViewProjMatrix)
{
float4 hpositionWS = mul(invViewProjMatrix, positionCS);
return hpositionWS.xyz / hpositionWS.w;
}

// ----------------------------------------------------------------------------
// PositionInputs
// ----------------------------------------------------------------------------
Expand Down
29 changes: 26 additions & 3 deletions com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ real3 UnpackNormalMaxComponent(real3 n)
return normalize(n * 2.0 - 1.0);
}

// Ref: http://www.vis.uni-stuttgart.de/~engelhts/paper/vmvOctaMaps.pdf
// Ref: http://www.vis.uni-stuttgart.de/~engelhts/paper/vmvOctaMaps.pdf "Octahedron Environment Maps"
// Encode with Oct, this function work with any size of output
// return real between [-1, 1]
real2 PackNormalOctRectEncode(real3 n)
Expand Down Expand Up @@ -47,7 +47,7 @@ real3 UnpackNormalOctRectEncode(real2 f)
return normalize(p);
}

// Ref: http://jcgt.org/published/0003/02/01/paper.pdf
// Ref: http://jcgt.org/published/0003/02/01/paper.pdf "A Survey of Efficient Representations for Independent Unit Vectors"
// Encode with Oct, this function work with any size of output
// return float between [-1, 1]
float2 PackNormalOctQuadEncode(float3 n)
Expand Down Expand Up @@ -535,7 +535,7 @@ float3 PackFloat2To888(float2 f)
// Unpack 2 float of 12bit packed into a 888
float2 Unpack888ToFloat2(float3 x)
{
uint3 i = (uint3)(x * 255.0);
uint3 i = (uint3)(x * 255.5); // +0.5 to fix precision error on iOS
// 8 bit in lo, 4 bit in hi
uint hi = i.z >> 4;
uint lo = i.z & 15;
Expand All @@ -545,4 +545,27 @@ float2 Unpack888ToFloat2(float3 x)
}
#endif // SHADER_API_GLES

// Pack 2 float values from the [0, 1] range, to an 8 bits float from the [0, 1] range
float PackFloat2To8(float2 f)
{
float x_expanded = f.x * 15.0; // f.x encoded over 4 bits, can have 2^4 = 16 distinct values mapped to [0, 1, ..., 15]
float y_expanded = f.y * 15.0; // f.y encoded over 4 bits, can have 2^4 = 16 distinct values mapped to [0, 1, ..., 15]
float x_y_expanded = x_expanded * 16.0 + y_expanded; // f.x encoded over higher bits, f.y encoded over the lower bits - x_y values in range [0, 1, ..., 255]
return x_y_expanded / 255.0;

// above 4 lines equivalent to:
//return (16.0 * f.x + f.y) / 17.0;
}

// Unpack 2 float values from the [0, 1] range, packed in an 8 bits float from the [0, 1] range
float2 Unpack8ToFloat2(float f)
{
float x_y_expanded = 255.0 * f;
float x_expanded = floor(x_y_expanded / 16.0);
float y_expanded = x_y_expanded - 16.0 * x_expanded;
float x = x_expanded / 15.0;
float y = y_expanded / 15.0;
return float2(x, y);
}

#endif // UNITY_PACKING_INCLUDED
Loading