sebastienlagarde
7 年前
当前提交
0ddaf44e
共有 62 个文件被更改,包括 904 次插入 和 558 次删除
-
32LICENSE.md
-
15ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/API/D3D11.hlsl
-
11ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/API/GLCore.hlsl
-
1ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/API/GLES2.hlsl
-
1ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/API/GLES3.hlsl
-
15ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/API/Metal.hlsl
-
15ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/API/PSSL.hlsl
-
15ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/API/Vulkan.hlsl
-
15ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/API/XBoxOne.hlsl
-
4ScriptableRenderPipeline/Core/CoreRP/Utilities/CoreUtils.cs
-
32ScriptableRenderPipeline/Core/LICENSE.md
-
4ScriptableRenderPipeline/HDRenderPipeline/CHANGELOG.md
-
2ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/RenderLoopSettings/GlobalLightLoopSettingsUI.cs
-
2ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/RenderLoopSettings/SerializedGlobalLightLoopSettings.cs
-
2ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipelineAsset.cs
-
1ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/GlobalLightLoopSettings.cs
-
2ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoop.cs
-
32ScriptableRenderPipeline/HDRenderPipeline/LICENSE.md
-
32ScriptableRenderPipeline/LightweightPipeline/LICENSE.md
-
64ScriptableRenderPipeline/LightweightPipeline/LWRP/Data/LightweightPipelineAsset.cs
-
2ScriptableRenderPipeline/LightweightPipeline/LWRP/Data/LightweightPipelineEditorResources.cs
-
2ScriptableRenderPipeline/LightweightPipeline/LWRP/Data/LightweightPipelineResources.asset
-
2ScriptableRenderPipeline/LightweightPipeline/LWRP/Data/LightweightPipelineResources.cs
-
102ScriptableRenderPipeline/LightweightPipeline/LWRP/Editor/LightweightAssetEditor.cs
-
6ScriptableRenderPipeline/LightweightPipeline/LWRP/Editor/ShaderGUI/LightweightStandardSimpleLightingGUI.cs
-
2ScriptableRenderPipeline/LightweightPipeline/LWRP/Editor/ShaderGraph/LightWeightPBRSubShader.cs
-
2ScriptableRenderPipeline/LightweightPipeline/LWRP/Editor/ShaderGraph/LightWeightUnlitSubShader.cs
-
3ScriptableRenderPipeline/LightweightPipeline/LWRP/Editor/ShaderGraph/lightweightPBRExtraPasses.template
-
3ScriptableRenderPipeline/LightweightPipeline/LWRP/Editor/ShaderGraph/lightweightPBRForwardPass.template
-
1ScriptableRenderPipeline/LightweightPipeline/LWRP/Editor/ShaderGraph/lightweightUnlitExtraPasses.template
-
1ScriptableRenderPipeline/LightweightPipeline/LWRP/Editor/ShaderGraph/lightweightUnlitPass.template
-
176ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs
-
74ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightShadowPass.cs
-
4ScriptableRenderPipeline/LightweightPipeline/LWRP/SceneViewDrawMode.cs
-
15ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/Shadows.hlsl
-
1ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/Terrain/LightweightPassLitTerrain.hlsl
-
1ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightBlit.shader
-
37ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightCopyDepth.shader
-
1ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightSampling.shader
-
1ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightScreenSpaceShadows.shader
-
9ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandard.shader
-
3ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandardParticles.shader
-
2ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandardParticlesSimpleLighting.shader
-
3ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandardParticlesUnlit.shader
-
9ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandardSimpleLighting.shader
-
1ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandardUnlit.shader
-
7ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/Terrain/LightweightStandardTerrain.shader
-
5ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/Terrain/LightweightStandardTerrainAddPass.shader
-
6ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/Terrain/LightweightStandardTerrainBase.shader
-
9ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/Terrain/LightweightWavingGrass.shader
-
9ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/Terrain/LightweightWavingGrassBillboard.shader
-
13Tests/GraphicsTests/RenderPipeline/LightweightPipeline/LightweightPipelineAsset.asset
-
9CONTRIBUTIONS.md
-
7CONTRIBUTIONS.md.meta
-
160ScriptableRenderPipeline/LightweightPipeline/LWRP/Editor/ShaderPreprocessor.cs
-
11ScriptableRenderPipeline/LightweightPipeline/LWRP/Editor/ShaderPreprocessor.cs.meta
-
205ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipelineCore.cs
-
11ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipelineCore.cs.meta
-
81ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/DepthCopy.hlsl
-
9ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/DepthCopy.hlsl.meta
-
13ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipelineUtils.cs.meta
-
147ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipelineUtils.cs
|
|||
**Unity Companion Package License v1.0 ("_License_")** |
|||
|
|||
Copyright © 2017 Unity Technologies ApS ("**_Unity_**") |
|||
|
|||
Unity hereby grants to you a worldwide, non-exclusive, no-charge, and royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute the software that is made available with this License ("**_Software_**"), subject to the following terms and conditions: |
|||
|
|||
1. *Unity Companion Use Only*. Exercise of the license granted herein is limited to exercise for the creation, use, and/or distribution of applications, software, or other content pursuant to a valid Unity development engine software license ("**_Engine License_**"). That means while use of the Software is not limited to use in the software licensed under the Engine License, the Software may not be used for any purpose other than the creation, use, and/or distribution of Engine License-dependent applications, software, or other content. No other exercise of the license granted herein is permitted. |
|||
|
|||
1. *No Modification of Engine License*. Neither this License nor any exercise of the license granted herein modifies the Engine License in any way. |
|||
|
|||
1. *Ownership & Grant Back to You*. |
|||
|
|||
3.1. You own your content. In this License, "derivative works" means derivatives of the Software itself--works derived only from the Software by you under this License (for example, modifying the code of the Software itself to improve its efficacy); “derivative works” of the Software do not include, for example, games, apps, or content that you create using the Software. You keep all right, title, and interest to your own content. |
|||
|
|||
3.2. Unity owns its content. While you keep all right, title, and interest to your own content per the above, as between Unity and you, Unity will own all right, title, and interest to all intellectual property rights (including patent, trademark, and copyright) in the Software and derivative works of the Software, and you hereby assign and agree to assign all such rights in those derivative works to Unity. |
|||
|
|||
3.3. You have a license to those derivative works. Subject to this License, Unity grants to you the same worldwide, non-exclusive, no-charge, and royalty-free copyright license to derivative works of the Software you create as is granted to you for the Software under this License. |
|||
|
|||
1. *Trademarks*. You are not granted any right or license under this License to use any trademarks, service marks, trade names, products names, or branding of Unity or its affiliates ("**_Trademarks_**"). Descriptive uses of Trademarks are permitted; see, for example, Unity’s Branding Usage Guidelines at [https://unity3d.com/public-relations/brand](https://unity3d.com/public-relations/brand). |
|||
|
|||
1. *Notices & Third-Party Rights*. This License, including the copyright notice above, must be provided in all substantial portions of the Software and derivative works thereof (or, if that is impracticable, in any other location where such notices are customarily placed). Further, if the Software is accompanied by a Unity "third-party notices" or similar file, you acknowledge and agree that software identified in that file is governed by those separate license terms. |
|||
|
|||
1. *DISCLAIMER, LIMITATION OF LIABILITY*. THE SOFTWARE AND ANY DERIVATIVE WORKS THEREOF IS PROVIDED ON AN "AS IS" BASIS, AND IS PROVIDED WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND/OR NONINFRINGEMENT. IN NO EVENT SHALL ANY COPYRIGHT HOLDER OR AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES (WHETHER DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL, INCLUDING PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF USE, DATA, OR PROFITS, AND BUSINESS INTERRUPTION), OR OTHER LIABILITY WHATSOEVER, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM OR OUT OF, OR IN CONNECTION WITH, THE SOFTWARE OR ANY DERIVATIVE WORKS THEREOF OR THE USE OF OR OTHER DEALINGS IN SAME, EVEN WHERE ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|||
|
|||
1. *USE IS ACCEPTANCE and License Versions*. Your receipt and use of the Software constitutes your acceptance of this License and its terms and conditions. Software released by Unity under this License may be modified or updated and the License with it; upon any such modification or update, you will comply with the terms of the updated License for any use of any of the Software under the updated License. |
|||
|
|||
1. *Use in Compliance with Law and Termination*. Your exercise of the license granted herein will at all times be in compliance with applicable law and will not infringe any proprietary rights (including intellectual property rights); this License will terminate immediately on any breach by you of this License. |
|||
Copyright © 2018 Unity Technologies ApS |
|||
1. *Severability*. If any provision of this License is held to be unenforceable or invalid, that provision will be enforced to the maximum extent possible and the other provisions will remain in full force and effect. |
|||
Licensed under the Unity Companion License for Unity-dependent projects--see [Unity Companion License](http://www.unity3d.com/legal/licenses/Unity_Companion_License). |
|||
1. *Governing Law and Venue*. This License is governed by and construed in accordance with the laws of Denmark, except for its conflict of laws rules; the United Nations Convention on Contracts for the International Sale of Goods will not apply. If you reside (or your principal place of business is) within the United States, you and Unity agree to submit to the personal and exclusive jurisdiction of and venue in the state and federal courts located in San Francisco County, California concerning any dispute arising out of this License ("**_Dispute_**"). If you reside (or your principal place of business is) outside the United States, you and Unity agree to submit to the personal and exclusive jurisdiction of and venue in the courts located in Copenhagen, Denmark concerning any Dispute. |
|||
Unless expressly provided otherwise, the Software under this license is made available strictly on an “AS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the license for details on these and other terms and conditions. |
|
|||
**Unity Companion Package License v1.0 ("_License_")** |
|||
|
|||
Copyright © 2017 Unity Technologies ApS ("**_Unity_**") |
|||
|
|||
Unity hereby grants to you a worldwide, non-exclusive, no-charge, and royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute the software that is made available with this License ("**_Software_**"), subject to the following terms and conditions: |
|||
|
|||
1. *Unity Companion Use Only*. Exercise of the license granted herein is limited to exercise for the creation, use, and/or distribution of applications, software, or other content pursuant to a valid Unity development engine software license ("**_Engine License_**"). That means while use of the Software is not limited to use in the software licensed under the Engine License, the Software may not be used for any purpose other than the creation, use, and/or distribution of Engine License-dependent applications, software, or other content. No other exercise of the license granted herein is permitted. |
|||
|
|||
1. *No Modification of Engine License*. Neither this License nor any exercise of the license granted herein modifies the Engine License in any way. |
|||
|
|||
1. *Ownership & Grant Back to You*. |
|||
|
|||
3.1. You own your content. In this License, "derivative works" means derivatives of the Software itself--works derived only from the Software by you under this License (for example, modifying the code of the Software itself to improve its efficacy); “derivative works” of the Software do not include, for example, games, apps, or content that you create using the Software. You keep all right, title, and interest to your own content. |
|||
|
|||
3.2. Unity owns its content. While you keep all right, title, and interest to your own content per the above, as between Unity and you, Unity will own all right, title, and interest to all intellectual property rights (including patent, trademark, and copyright) in the Software and derivative works of the Software, and you hereby assign and agree to assign all such rights in those derivative works to Unity. |
|||
|
|||
3.3. You have a license to those derivative works. Subject to this License, Unity grants to you the same worldwide, non-exclusive, no-charge, and royalty-free copyright license to derivative works of the Software you create as is granted to you for the Software under this License. |
|||
|
|||
1. *Trademarks*. You are not granted any right or license under this License to use any trademarks, service marks, trade names, products names, or branding of Unity or its affiliates ("**_Trademarks_**"). Descriptive uses of Trademarks are permitted; see, for example, Unity’s Branding Usage Guidelines at [https://unity3d.com/public-relations/brand](https://unity3d.com/public-relations/brand). |
|||
|
|||
1. *Notices & Third-Party Rights*. This License, including the copyright notice above, must be provided in all substantial portions of the Software and derivative works thereof (or, if that is impracticable, in any other location where such notices are customarily placed). Further, if the Software is accompanied by a Unity "third-party notices" or similar file, you acknowledge and agree that software identified in that file is governed by those separate license terms. |
|||
|
|||
1. *DISCLAIMER, LIMITATION OF LIABILITY*. THE SOFTWARE AND ANY DERIVATIVE WORKS THEREOF IS PROVIDED ON AN "AS IS" BASIS, AND IS PROVIDED WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND/OR NONINFRINGEMENT. IN NO EVENT SHALL ANY COPYRIGHT HOLDER OR AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES (WHETHER DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL, INCLUDING PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF USE, DATA, OR PROFITS, AND BUSINESS INTERRUPTION), OR OTHER LIABILITY WHATSOEVER, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM OR OUT OF, OR IN CONNECTION WITH, THE SOFTWARE OR ANY DERIVATIVE WORKS THEREOF OR THE USE OF OR OTHER DEALINGS IN SAME, EVEN WHERE ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|||
|
|||
1. *USE IS ACCEPTANCE and License Versions*. Your receipt and use of the Software constitutes your acceptance of this License and its terms and conditions. Software released by Unity under this License may be modified or updated and the License with it; upon any such modification or update, you will comply with the terms of the updated License for any use of any of the Software under the updated License. |
|||
|
|||
1. *Use in Compliance with Law and Termination*. Your exercise of the license granted herein will at all times be in compliance with applicable law and will not infringe any proprietary rights (including intellectual property rights); this License will terminate immediately on any breach by you of this License. |
|||
Render Pipeline Core copyright © 2018 Unity Technologies ApS |
|||
1. *Severability*. If any provision of this License is held to be unenforceable or invalid, that provision will be enforced to the maximum extent possible and the other provisions will remain in full force and effect. |
|||
Licensed under the Unity Companion License for Unity-dependent projects--see [Unity Companion License](http://www.unity3d.com/legal/licenses/Unity_Companion_License). |
|||
1. *Governing Law and Venue*. This License is governed by and construed in accordance with the laws of Denmark, except for its conflict of laws rules; the United Nations Convention on Contracts for the International Sale of Goods will not apply. If you reside (or your principal place of business is) within the United States, you and Unity agree to submit to the personal and exclusive jurisdiction of and venue in the state and federal courts located in San Francisco County, California concerning any dispute arising out of this License ("**_Dispute_**"). If you reside (or your principal place of business is) outside the United States, you and Unity agree to submit to the personal and exclusive jurisdiction of and venue in the courts located in Copenhagen, Denmark concerning any Dispute. |
|||
Unless expressly provided otherwise, the Software under this license is made available strictly on an “AS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the license for details on these and other terms and conditions. |
|
|||
**Unity Companion Package License v1.0 ("_License_")** |
|||
|
|||
Copyright © 2017 Unity Technologies ApS ("**_Unity_**") |
|||
|
|||
Unity hereby grants to you a worldwide, non-exclusive, no-charge, and royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute the software that is made available with this License ("**_Software_**"), subject to the following terms and conditions: |
|||
|
|||
1. *Unity Companion Use Only*. Exercise of the license granted herein is limited to exercise for the creation, use, and/or distribution of applications, software, or other content pursuant to a valid Unity development engine software license ("**_Engine License_**"). That means while use of the Software is not limited to use in the software licensed under the Engine License, the Software may not be used for any purpose other than the creation, use, and/or distribution of Engine License-dependent applications, software, or other content. No other exercise of the license granted herein is permitted. |
|||
|
|||
1. *No Modification of Engine License*. Neither this License nor any exercise of the license granted herein modifies the Engine License in any way. |
|||
|
|||
1. *Ownership & Grant Back to You*. |
|||
|
|||
3.1. You own your content. In this License, "derivative works" means derivatives of the Software itself--works derived only from the Software by you under this License (for example, modifying the code of the Software itself to improve its efficacy); “derivative works” of the Software do not include, for example, games, apps, or content that you create using the Software. You keep all right, title, and interest to your own content. |
|||
|
|||
3.2. Unity owns its content. While you keep all right, title, and interest to your own content per the above, as between Unity and you, Unity will own all right, title, and interest to all intellectual property rights (including patent, trademark, and copyright) in the Software and derivative works of the Software, and you hereby assign and agree to assign all such rights in those derivative works to Unity. |
|||
|
|||
3.3. You have a license to those derivative works. Subject to this License, Unity grants to you the same worldwide, non-exclusive, no-charge, and royalty-free copyright license to derivative works of the Software you create as is granted to you for the Software under this License. |
|||
|
|||
1. *Trademarks*. You are not granted any right or license under this License to use any trademarks, service marks, trade names, products names, or branding of Unity or its affiliates ("**_Trademarks_**"). Descriptive uses of Trademarks are permitted; see, for example, Unity’s Branding Usage Guidelines at [https://unity3d.com/public-relations/brand](https://unity3d.com/public-relations/brand). |
|||
|
|||
1. *Notices & Third-Party Rights*. This License, including the copyright notice above, must be provided in all substantial portions of the Software and derivative works thereof (or, if that is impracticable, in any other location where such notices are customarily placed). Further, if the Software is accompanied by a Unity "third-party notices" or similar file, you acknowledge and agree that software identified in that file is governed by those separate license terms. |
|||
|
|||
1. *DISCLAIMER, LIMITATION OF LIABILITY*. THE SOFTWARE AND ANY DERIVATIVE WORKS THEREOF IS PROVIDED ON AN "AS IS" BASIS, AND IS PROVIDED WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND/OR NONINFRINGEMENT. IN NO EVENT SHALL ANY COPYRIGHT HOLDER OR AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES (WHETHER DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL, INCLUDING PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF USE, DATA, OR PROFITS, AND BUSINESS INTERRUPTION), OR OTHER LIABILITY WHATSOEVER, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM OR OUT OF, OR IN CONNECTION WITH, THE SOFTWARE OR ANY DERIVATIVE WORKS THEREOF OR THE USE OF OR OTHER DEALINGS IN SAME, EVEN WHERE ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|||
|
|||
1. *USE IS ACCEPTANCE and License Versions*. Your receipt and use of the Software constitutes your acceptance of this License and its terms and conditions. Software released by Unity under this License may be modified or updated and the License with it; upon any such modification or update, you will comply with the terms of the updated License for any use of any of the Software under the updated License. |
|||
|
|||
1. *Use in Compliance with Law and Termination*. Your exercise of the license granted herein will at all times be in compliance with applicable law and will not infringe any proprietary rights (including intellectual property rights); this License will terminate immediately on any breach by you of this License. |
|||
High Definition Render Pipeline copyright © 2018 Unity Technologies ApS |
|||
1. *Severability*. If any provision of this License is held to be unenforceable or invalid, that provision will be enforced to the maximum extent possible and the other provisions will remain in full force and effect. |
|||
Licensed under the Unity Companion License for Unity-dependent projects--see [Unity Companion License](http://www.unity3d.com/legal/licenses/Unity_Companion_License). |
|||
1. *Governing Law and Venue*. This License is governed by and construed in accordance with the laws of Denmark, except for its conflict of laws rules; the United Nations Convention on Contracts for the International Sale of Goods will not apply. If you reside (or your principal place of business is) within the United States, you and Unity agree to submit to the personal and exclusive jurisdiction of and venue in the state and federal courts located in San Francisco County, California concerning any dispute arising out of this License ("**_Dispute_**"). If you reside (or your principal place of business is) outside the United States, you and Unity agree to submit to the personal and exclusive jurisdiction of and venue in the courts located in Copenhagen, Denmark concerning any Dispute. |
|||
Unless expressly provided otherwise, the Software under this license is made available strictly on an “AS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the license for details on these and other terms and conditions. |
|
|||
**Unity Companion Package License v1.0 ("_License_")** |
|||
|
|||
Copyright © 2017 Unity Technologies ApS ("**_Unity_**") |
|||
|
|||
Unity hereby grants to you a worldwide, non-exclusive, no-charge, and royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute the software that is made available with this License ("**_Software_**"), subject to the following terms and conditions: |
|||
|
|||
1. *Unity Companion Use Only*. Exercise of the license granted herein is limited to exercise for the creation, use, and/or distribution of applications, software, or other content pursuant to a valid Unity development engine software license ("**_Engine License_**"). That means while use of the Software is not limited to use in the software licensed under the Engine License, the Software may not be used for any purpose other than the creation, use, and/or distribution of Engine License-dependent applications, software, or other content. No other exercise of the license granted herein is permitted. |
|||
|
|||
1. *No Modification of Engine License*. Neither this License nor any exercise of the license granted herein modifies the Engine License in any way. |
|||
|
|||
1. *Ownership & Grant Back to You*. |
|||
|
|||
3.1. You own your content. In this License, "derivative works" means derivatives of the Software itself--works derived only from the Software by you under this License (for example, modifying the code of the Software itself to improve its efficacy); “derivative works” of the Software do not include, for example, games, apps, or content that you create using the Software. You keep all right, title, and interest to your own content. |
|||
|
|||
3.2. Unity owns its content. While you keep all right, title, and interest to your own content per the above, as between Unity and you, Unity will own all right, title, and interest to all intellectual property rights (including patent, trademark, and copyright) in the Software and derivative works of the Software, and you hereby assign and agree to assign all such rights in those derivative works to Unity. |
|||
|
|||
3.3. You have a license to those derivative works. Subject to this License, Unity grants to you the same worldwide, non-exclusive, no-charge, and royalty-free copyright license to derivative works of the Software you create as is granted to you for the Software under this License. |
|||
|
|||
1. *Trademarks*. You are not granted any right or license under this License to use any trademarks, service marks, trade names, products names, or branding of Unity or its affiliates ("**_Trademarks_**"). Descriptive uses of Trademarks are permitted; see, for example, Unity’s Branding Usage Guidelines at [https://unity3d.com/public-relations/brand](https://unity3d.com/public-relations/brand). |
|||
|
|||
1. *Notices & Third-Party Rights*. This License, including the copyright notice above, must be provided in all substantial portions of the Software and derivative works thereof (or, if that is impracticable, in any other location where such notices are customarily placed). Further, if the Software is accompanied by a Unity "third-party notices" or similar file, you acknowledge and agree that software identified in that file is governed by those separate license terms. |
|||
|
|||
1. *DISCLAIMER, LIMITATION OF LIABILITY*. THE SOFTWARE AND ANY DERIVATIVE WORKS THEREOF IS PROVIDED ON AN "AS IS" BASIS, AND IS PROVIDED WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND/OR NONINFRINGEMENT. IN NO EVENT SHALL ANY COPYRIGHT HOLDER OR AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES (WHETHER DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL, INCLUDING PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF USE, DATA, OR PROFITS, AND BUSINESS INTERRUPTION), OR OTHER LIABILITY WHATSOEVER, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM OR OUT OF, OR IN CONNECTION WITH, THE SOFTWARE OR ANY DERIVATIVE WORKS THEREOF OR THE USE OF OR OTHER DEALINGS IN SAME, EVEN WHERE ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|||
|
|||
1. *USE IS ACCEPTANCE and License Versions*. Your receipt and use of the Software constitutes your acceptance of this License and its terms and conditions. Software released by Unity under this License may be modified or updated and the License with it; upon any such modification or update, you will comply with the terms of the updated License for any use of any of the Software under the updated License. |
|||
|
|||
1. *Use in Compliance with Law and Termination*. Your exercise of the license granted herein will at all times be in compliance with applicable law and will not infringe any proprietary rights (including intellectual property rights); this License will terminate immediately on any breach by you of this License. |
|||
Lightweight Render Pipeline copyright © 2018 Unity Technologies ApS |
|||
1. *Severability*. If any provision of this License is held to be unenforceable or invalid, that provision will be enforced to the maximum extent possible and the other provisions will remain in full force and effect. |
|||
Licensed under the Unity Companion License for Unity-dependent projects--see [Unity Companion License](http://www.unity3d.com/legal/licenses/Unity_Companion_License). |
|||
1. *Governing Law and Venue*. This License is governed by and construed in accordance with the laws of Denmark, except for its conflict of laws rules; the United Nations Convention on Contracts for the International Sale of Goods will not apply. If you reside (or your principal place of business is) within the United States, you and Unity agree to submit to the personal and exclusive jurisdiction of and venue in the state and federal courts located in San Francisco County, California concerning any dispute arising out of this License ("**_Dispute_**"). If you reside (or your principal place of business is) outside the United States, you and Unity agree to submit to the personal and exclusive jurisdiction of and venue in the courts located in Copenhagen, Denmark concerning any Dispute. |
|||
Unless expressly provided otherwise, the Software under this license is made available strictly on an “AS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the license for details on these and other terms and conditions. |
|
|||
# Contributions |
|||
|
|||
## If you are interested in contributing, here are some ground rules: |
|||
* Talk to us before doing the work -- we love contributions, but we might already be working on the same thing, or we might have different opinions on how it should be implemented. |
|||
|
|||
## All contributions are subject to the [Unity Contribution Agreement(UCA)](https://unity3d.com/legal/licenses/Unity_Contribution_Agreement) |
|||
By making a pull request, you are confirming agreement to the terms and conditions of the UCA, including that your Contributions are your original creation and that you have complete right and authority to make your Contributions. |
|||
|
|||
## Once you have a change ready following these ground rules. Simply make a pull request in Github |
|
|||
fileFormatVersion: 2 |
|||
guid: d18fefd6a4409be4a92111b29cb078c1 |
|||
TextScriptImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
//#define LOG_VARIANTS
|
|||
//#define LOG_ONLY_LWRP_VARIANTS
|
|||
|
|||
using System.Collections.Generic; |
|||
using UnityEditor.Build; |
|||
using UnityEditor.Rendering; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.Rendering; |
|||
using UnityEngine.Experimental.Rendering.LightweightPipeline; |
|||
using UnityEngine.Rendering; |
|||
using LightweightRP = UnityEngine.Experimental.Rendering.LightweightPipeline.LightweightPipeline; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering.LightweightPipeline |
|||
{ |
|||
#if UNITY_2018_2_OR_NEWER
|
|||
public class ShaderPreprocessor : IPreprocessShaders |
|||
{ |
|||
#if LOG_VARIANTS
|
|||
int m_TotalVariantsInputCount; |
|||
int m_TotalVariantsOutputCount; |
|||
#endif
|
|||
|
|||
// Multiple callback may be implemented.
|
|||
// The first one executed is the one where callbackOrder is returning the smallest number.
|
|||
public int callbackOrder { get { return 0; } } |
|||
|
|||
bool StripUnusedShader(PipelineCapabilities capabilities, Shader shader) |
|||
{ |
|||
if (shader.name.Contains("Debug")) |
|||
return true; |
|||
|
|||
if (shader.name.Contains("HDRenderPipeline")) |
|||
return true; |
|||
|
|||
if (!CoreUtils.HasFlag(capabilities, PipelineCapabilities.DirectionalShadows) && |
|||
shader.name.Contains("ScreenSpaceShadows")) |
|||
return true; |
|||
|
|||
return false; |
|||
} |
|||
|
|||
bool StripUnusedPass(PipelineCapabilities capabilities, ShaderSnippetData snippetData) |
|||
{ |
|||
if (snippetData.passType == PassType.Meta) |
|||
return true; |
|||
|
|||
if (snippetData.passType == PassType.ShadowCaster) |
|||
if (!CoreUtils.HasFlag(capabilities, PipelineCapabilities.DirectionalShadows) && !CoreUtils.HasFlag(capabilities, PipelineCapabilities.LocalShadows)) |
|||
return true; |
|||
|
|||
return false; |
|||
} |
|||
|
|||
bool StripUnusedVariant(PipelineCapabilities capabilities, ShaderCompilerData compilerData) |
|||
{ |
|||
if (compilerData.shaderKeywordSet.IsEnabled(LightweightKeywords.AdditionalLights) && |
|||
!CoreUtils.HasFlag(capabilities, PipelineCapabilities.AdditionalLights)) |
|||
return true; |
|||
|
|||
if (compilerData.shaderKeywordSet.IsEnabled(LightweightKeywords.VertexLights) && |
|||
!CoreUtils.HasFlag(capabilities, PipelineCapabilities.VertexLights)) |
|||
return true; |
|||
|
|||
if (compilerData.shaderKeywordSet.IsEnabled(LightweightKeywords.DirectionalShadows) && |
|||
!CoreUtils.HasFlag(capabilities, PipelineCapabilities.DirectionalShadows)) |
|||
return true; |
|||
|
|||
if (compilerData.shaderKeywordSet.IsEnabled(LightweightKeywords.LocalShadows) && |
|||
!CoreUtils.HasFlag(capabilities, PipelineCapabilities.LocalShadows)) |
|||
return true; |
|||
|
|||
if (compilerData.shaderKeywordSet.IsEnabled(LightweightKeywords.SoftShadows) && |
|||
!CoreUtils.HasFlag(capabilities, PipelineCapabilities.SoftShadows)) |
|||
return true; |
|||
|
|||
return false; |
|||
} |
|||
|
|||
bool StripInvalidVariants(ShaderCompilerData compilerData) |
|||
{ |
|||
bool isShadowVariant = compilerData.shaderKeywordSet.IsEnabled(LightweightKeywords.DirectionalShadows) || |
|||
compilerData.shaderKeywordSet.IsEnabled(LightweightKeywords.LocalShadows); |
|||
|
|||
if (compilerData.shaderKeywordSet.IsEnabled(LightweightKeywords.SoftShadows) && !isShadowVariant) |
|||
return true; |
|||
|
|||
if (compilerData.shaderKeywordSet.IsEnabled(LightweightKeywords.VertexLights) && |
|||
!compilerData.shaderKeywordSet.IsEnabled(LightweightKeywords.AdditionalLights)) |
|||
return true; |
|||
|
|||
// Note: LWRP doesn't support Dynamic Lightmap.
|
|||
if (compilerData.shaderKeywordSet.IsEnabled(LightweightKeywords.DirectionalLightmap) && |
|||
!compilerData.shaderKeywordSet.IsEnabled(LightweightKeywords.Lightmap)) |
|||
return true; |
|||
|
|||
return false; |
|||
} |
|||
|
|||
bool StripUnused(PipelineCapabilities capabilities, Shader shader, ShaderSnippetData snippetData, ShaderCompilerData compilerData) |
|||
{ |
|||
if (StripUnusedShader(capabilities, shader)) |
|||
return true; |
|||
|
|||
if (StripUnusedPass(capabilities, snippetData)) |
|||
return true; |
|||
|
|||
if (StripUnusedVariant(capabilities, compilerData)) |
|||
return true; |
|||
|
|||
if (StripInvalidVariants(compilerData)) |
|||
return true; |
|||
|
|||
return false; |
|||
} |
|||
|
|||
#if LOG_VARIANTS
|
|||
void LogVariants(Shader shader, ShaderSnippetData snippetData, int prevVariantsCount, int currVariantsCount) |
|||
{ |
|||
#if LOG_ONLY_LWRP_VARIANTS
|
|||
if (shader.name.Contains("LightweightPipeline")) |
|||
#endif
|
|||
{ |
|||
float percentageCurrent = (float)currVariantsCount / (float)prevVariantsCount * 100f; |
|||
float percentageTotal = (float)m_TotalVariantsOutputCount / (float)m_TotalVariantsInputCount * 100f; |
|||
|
|||
string result = string.Format("STRIPPING: {0} ({1} pass) ({2}) -" + |
|||
" Remaining shader variants = {3}/{4} = {5}% - Total = {6}/{7} = {8}%", |
|||
shader.name, snippetData.passName, snippetData.shaderType.ToString(), currVariantsCount, |
|||
prevVariantsCount, percentageCurrent, m_TotalVariantsOutputCount, m_TotalVariantsInputCount, |
|||
percentageTotal); |
|||
Debug.Log(result); |
|||
} |
|||
} |
|||
|
|||
#endif
|
|||
|
|||
public void OnProcessShader(Shader shader, ShaderSnippetData snippetData, IList<ShaderCompilerData> compilerDataList) |
|||
{ |
|||
PipelineCapabilities capabilities = LightweightRP.GetPipelineCapabilities(); |
|||
int prevVariantCount = compilerDataList.Count; |
|||
|
|||
for (int i = 0; i < compilerDataList.Count; ++i) |
|||
{ |
|||
if (StripUnused(capabilities, shader, snippetData, compilerDataList[i])) |
|||
{ |
|||
compilerDataList.RemoveAt(i); |
|||
--i; |
|||
} |
|||
} |
|||
|
|||
#if LOG_VARIANTS
|
|||
m_TotalVariantsInputCount += prevVariantCount; |
|||
m_TotalVariantsOutputCount += compilerDataList.Count; |
|||
|
|||
LogVariants(shader, snippetData, prevVariantCount, compilerDataList.Count); |
|||
#endif
|
|||
} |
|||
} |
|||
#endif // UNITY_2018_2_OR_NEWER
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 9f7bf504ded5bcb48835f194831914c8 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.LightweightPipeline |
|||
{ |
|||
[Flags] |
|||
public enum FrameRenderingConfiguration |
|||
{ |
|||
None = (0 << 0), |
|||
Stereo = (1 << 0), |
|||
Msaa = (1 << 1), |
|||
BeforeTransparentPostProcess = (1 << 2), |
|||
PostProcess = (1 << 3), |
|||
DepthPrePass = (1 << 4), |
|||
DepthCopy = (1 << 5), |
|||
DefaultViewport = (1 << 6), |
|||
IntermediateTexture = (1 << 7) |
|||
} |
|||
|
|||
[Flags] |
|||
public enum PipelineCapabilities |
|||
{ |
|||
AdditionalLights = (1 << 0), |
|||
VertexLights = (1 << 1), |
|||
DirectionalShadows = (1 << 2), |
|||
LocalShadows = (1 << 3), |
|||
SoftShadows = (1 << 4), |
|||
} |
|||
|
|||
public class CameraComparer : IComparer<Camera> |
|||
{ |
|||
public int Compare(Camera lhs, Camera rhs) |
|||
{ |
|||
return (int)(lhs.depth - rhs.depth); |
|||
} |
|||
} |
|||
|
|||
public class LightweightKeywords |
|||
{ |
|||
public static readonly string AdditionalLightsText = "_ADDITIONAL_LIGHTS"; |
|||
public static readonly string VertexLightsText = "_VERTEX_LIGHTS"; |
|||
public static readonly string MixedLightingSubtractiveText = "_MIXED_LIGHTING_SUBTRACTIVE"; |
|||
public static readonly string MainLightCookieText = "_MAIN_LIGHT_COOKIE"; |
|||
public static readonly string DirectionalShadowsText = "_SHADOWS_ENABLED"; |
|||
public static readonly string LocalShadowsText = "_LOCAL_SHADOWS_ENABLED"; |
|||
public static readonly string SoftShadowsText = "_SHADOWS_SOFT"; |
|||
public static readonly string CascadeShadowsText = "_SHADOWS_CASCADE"; |
|||
|
|||
#if UNITY_2018_2_OR_NEWER
|
|||
public static readonly ShaderKeyword AdditionalLights = new ShaderKeyword(AdditionalLightsText); |
|||
public static readonly ShaderKeyword VertexLights = new ShaderKeyword(VertexLightsText); |
|||
public static readonly ShaderKeyword MixedLightingSubtractive = new ShaderKeyword(MixedLightingSubtractiveText); |
|||
public static readonly ShaderKeyword MainLightCookie = new ShaderKeyword(MainLightCookieText); |
|||
public static readonly ShaderKeyword DirectionalShadows = new ShaderKeyword(DirectionalShadowsText); |
|||
public static readonly ShaderKeyword LocalShadows = new ShaderKeyword(LocalShadowsText); |
|||
public static readonly ShaderKeyword SoftShadows = new ShaderKeyword(SoftShadowsText); |
|||
|
|||
public static readonly ShaderKeyword Lightmap = new ShaderKeyword("LIGHTMAP_ON"); |
|||
public static readonly ShaderKeyword DirectionalLightmap = new ShaderKeyword("DIRLIGHTMAP_COMBINED"); |
|||
#endif
|
|||
} |
|||
|
|||
public partial class LightweightPipeline |
|||
{ |
|||
static Mesh s_FullscreenMesh = null; |
|||
public static Mesh fullscreenMesh |
|||
{ |
|||
get |
|||
{ |
|||
if (s_FullscreenMesh != null) |
|||
return s_FullscreenMesh; |
|||
|
|||
float topV = 1.0f; |
|||
float bottomV = 0.0f; |
|||
|
|||
Mesh mesh = new Mesh { name = "Fullscreen Quad" }; |
|||
mesh.SetVertices(new List<Vector3> |
|||
{ |
|||
new Vector3(-1.0f, -1.0f, 0.0f), |
|||
new Vector3(-1.0f, 1.0f, 0.0f), |
|||
new Vector3(1.0f, -1.0f, 0.0f), |
|||
new Vector3(1.0f, 1.0f, 0.0f) |
|||
}); |
|||
|
|||
mesh.SetUVs(0, new List<Vector2> |
|||
{ |
|||
new Vector2(0.0f, bottomV), |
|||
new Vector2(0.0f, topV), |
|||
new Vector2(1.0f, bottomV), |
|||
new Vector2(1.0f, topV) |
|||
}); |
|||
|
|||
mesh.SetIndices(new[] { 0, 1, 2, 2, 1, 3 }, MeshTopology.Triangles, 0, false); |
|||
mesh.UploadMeshData(true); |
|||
return mesh; |
|||
} |
|||
} |
|||
|
|||
static PipelineCapabilities s_PipelineCapabilities; |
|||
|
|||
public static PipelineCapabilities GetPipelineCapabilities() |
|||
{ |
|||
return s_PipelineCapabilities; |
|||
} |
|||
|
|||
static void SetPipelineCapabilities(LightweightPipelineAsset pipelineAsset) |
|||
{ |
|||
s_PipelineCapabilities = 0U; |
|||
|
|||
if (pipelineAsset.MaxPixelLights > 1 || pipelineAsset.SupportsVertexLight) |
|||
s_PipelineCapabilities |= PipelineCapabilities.AdditionalLights; |
|||
|
|||
if (pipelineAsset.SupportsVertexLight) |
|||
s_PipelineCapabilities |= PipelineCapabilities.VertexLights; |
|||
|
|||
if (pipelineAsset.SupportsDirectionalShadows) |
|||
s_PipelineCapabilities |= PipelineCapabilities.DirectionalShadows; |
|||
|
|||
if (pipelineAsset.SupportsLocalShadows) |
|||
s_PipelineCapabilities |= PipelineCapabilities.LocalShadows; |
|||
|
|||
bool anyShadows = pipelineAsset.SupportsDirectionalShadows || pipelineAsset.SupportsLocalShadows; |
|||
if (pipelineAsset.SupportsSoftShadows && anyShadows) |
|||
s_PipelineCapabilities |= PipelineCapabilities.SoftShadows; |
|||
} |
|||
|
|||
public static void DrawFullScreen(CommandBuffer commandBuffer, Material material, |
|||
MaterialPropertyBlock properties = null, int shaderPassId = 0) |
|||
{ |
|||
commandBuffer.DrawMesh(fullscreenMesh, Matrix4x4.identity, material, 0, shaderPassId, properties); |
|||
} |
|||
|
|||
public static void StartStereoRendering(Camera camera, ref ScriptableRenderContext context, FrameRenderingConfiguration renderingConfiguration) |
|||
{ |
|||
if (CoreUtils.HasFlag(renderingConfiguration, FrameRenderingConfiguration.Stereo)) |
|||
context.StartMultiEye(camera); |
|||
} |
|||
|
|||
public static void StopStereoRendering(Camera camera, ref ScriptableRenderContext context, FrameRenderingConfiguration renderingConfiguration) |
|||
{ |
|||
if (CoreUtils.HasFlag(renderingConfiguration, FrameRenderingConfiguration.Stereo)) |
|||
context.StopMultiEye(camera); |
|||
} |
|||
|
|||
public static void GetLightCookieMatrix(VisibleLight light, out Matrix4x4 cookieMatrix) |
|||
{ |
|||
cookieMatrix = Matrix4x4.Inverse(light.localToWorld); |
|||
|
|||
if (light.lightType == LightType.Directional) |
|||
{ |
|||
float scale = 1.0f / light.light.cookieSize; |
|||
|
|||
// apply cookie scale and offset by 0.5 to convert from [-0.5, 0.5] to texture space [0, 1]
|
|||
Vector4 row0 = cookieMatrix.GetRow(0); |
|||
Vector4 row1 = cookieMatrix.GetRow(1); |
|||
cookieMatrix.SetRow(0, new Vector4(row0.x * scale, row0.y * scale, row0.z * scale, row0.w * scale + 0.5f)); |
|||
cookieMatrix.SetRow(1, new Vector4(row1.x * scale, row1.y * scale, row1.z * scale, row1.w * scale + 0.5f)); |
|||
} |
|||
else if (light.lightType == LightType.Spot) |
|||
{ |
|||
// we want out.w = 2.0 * in.z / m_CotanHalfSpotAngle
|
|||
// c = cotHalfSpotAngle
|
|||
// 1 0 0 0
|
|||
// 0 1 0 0
|
|||
// 0 0 1 0
|
|||
// 0 0 2/c 0
|
|||
// the "2" will be used to scale .xy for the cookie as in .xy/2 + 0.5
|
|||
float scale = 1.0f / light.range; |
|||
float halfSpotAngleRad = Mathf.Deg2Rad * light.spotAngle * 0.5f; |
|||
float cs = Mathf.Cos(halfSpotAngleRad); |
|||
float ss = Mathf.Sin(halfSpotAngleRad); |
|||
float cotHalfSpotAngle = cs / ss; |
|||
|
|||
Matrix4x4 scaleMatrix = Matrix4x4.identity; |
|||
scaleMatrix.m00 = scaleMatrix.m11 = scaleMatrix.m22 = scale; |
|||
scaleMatrix.m33 = 0.0f; |
|||
scaleMatrix.m32 = scale * (2.0f / cotHalfSpotAngle); |
|||
|
|||
cookieMatrix = scaleMatrix * cookieMatrix; |
|||
} |
|||
|
|||
// Remaining light types don't support cookies
|
|||
} |
|||
|
|||
public static bool IsSupportedShadowType(LightType lightType) |
|||
{ |
|||
return lightType == LightType.Directional || lightType == LightType.Spot; |
|||
} |
|||
|
|||
public static bool IsSupportedCookieType(LightType lightType) |
|||
{ |
|||
return lightType == LightType.Directional || lightType == LightType.Spot; |
|||
} |
|||
|
|||
public static bool PlatformSupportsMSAABackBuffer() |
|||
{ |
|||
#if UNITY_ANDROID || UNITY_IPHONE || UNITY_TVOS || UNITY_SAMSUNGTV
|
|||
return true; |
|||
#else
|
|||
return false; |
|||
#endif
|
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: d973de1eba2f6934e9c31429e8e40c09 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#ifndef LIGHTWEIGHT_DEPTH_COPY_INCLUDED |
|||
#define LIGHTWEIGHT_DEPTH_COPY_INCLUDED |
|||
|
|||
#include "LWRP/ShaderLibrary/Core.hlsl" |
|||
|
|||
struct VertexInput |
|||
{ |
|||
float4 vertex : POSITION; |
|||
float2 uv : TEXCOORD0; |
|||
UNITY_VERTEX_INPUT_INSTANCE_ID |
|||
}; |
|||
|
|||
struct VertexOutput |
|||
{ |
|||
float4 position : SV_POSITION; |
|||
float2 uv : TEXCOORD0; |
|||
UNITY_VERTEX_INPUT_INSTANCE_ID |
|||
UNITY_VERTEX_OUTPUT_STEREO |
|||
}; |
|||
|
|||
VertexOutput vert(VertexInput i) |
|||
{ |
|||
VertexOutput o; |
|||
UNITY_SETUP_INSTANCE_ID(i); |
|||
UNITY_TRANSFER_INSTANCE_ID(i, o); |
|||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); |
|||
o.uv = i.uv; |
|||
o.position = TransformObjectToHClip(i.vertex.xyz); |
|||
return o; |
|||
} |
|||
|
|||
#if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED) |
|||
#define DEPTH_TEXTURE_MS Texture2DMSArray |
|||
#define DEPTH_TEXTURE(name) TEXTURE2D_ARRAY(name) |
|||
#define LOAD(uv, sampleIndex) LOAD_TEXTURE2D_ARRAY_MSAA(_CameraDepthTexture, uv, unity_StereoEyeIndex, sampleIndex) |
|||
#define SAMPLE(uv) SAMPLE_TEXTURE2D_ARRAY(_CameraDepthTexture, sampler_CameraDepthTexture, uv, unity_StereoEyeIndex).r |
|||
#else |
|||
#define DEPTH_TEXTURE_MS Texture2DMS |
|||
#define DEPTH_TEXTURE(name) TEXTURE2D(name) |
|||
#define LOAD(uv, sampleIndex) LOAD_TEXTURE2D_MSAA(_CameraDepthTexture, uv, sampleIndex) |
|||
#define SAMPLE(uv) SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, sampler_CameraDepthTexture, uv) |
|||
#endif |
|||
|
|||
#ifdef _MSAA_DEPTH |
|||
DEPTH_TEXTURE_MS<float> _CameraDepthTexture; |
|||
float _SampleCount; |
|||
float4 _CameraDepthTexture_TexelSize; |
|||
#else |
|||
DEPTH_TEXTURE(_CameraDepthTexture); |
|||
SAMPLER(sampler_CameraDepthTexture); |
|||
#endif |
|||
|
|||
float SampleDepth(float2 uv) |
|||
{ |
|||
#ifdef _MSAA_DEPTH |
|||
int2 coord = int2(uv * _CameraDepthTexture_TexelSize.zw); |
|||
int samples = (int)_SampleCount; |
|||
#if UNITY_REVERSED_Z |
|||
float outDepth = 1.0; |
|||
#define DEPTH_OP min |
|||
#else |
|||
float outDepth = 0.0; |
|||
#define DEPTH_OP max |
|||
#endif |
|||
|
|||
for (int i = 0; i < samples; ++i) |
|||
outDepth = DEPTH_OP(LOAD(uv, i), outDepth); |
|||
|
|||
return outDepth; |
|||
#else |
|||
return SAMPLE(uv); |
|||
#endif |
|||
} |
|||
|
|||
float frag(VertexOutput i) : SV_Depth |
|||
{ |
|||
UNITY_SETUP_INSTANCE_ID(i); |
|||
return SampleDepth(i.uv); |
|||
} |
|||
|
|||
#endif // LIGHTWEIGHT_DEPTH_COPY_INCLUDED |
|
|||
fileFormatVersion: 2 |
|||
guid: 971e7c84ed6bc40fc95bdbb2e008013f |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
nonModifiableTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 1556a6d19597541c8bed4b90c704fb06 |
|||
timeCreated: 1505115136 |
|||
licenseType: Free |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.LightweightPipeline |
|||
{ |
|||
public class CameraComparer : IComparer<Camera> |
|||
{ |
|||
public int Compare(Camera lhs, Camera rhs) |
|||
{ |
|||
return (int)(lhs.depth - rhs.depth); |
|||
} |
|||
} |
|||
|
|||
[Flags] |
|||
public enum FrameRenderingConfiguration |
|||
{ |
|||
None = 0, |
|||
Stereo = (1 << 0), |
|||
Msaa = (1 << 1), |
|||
BeforeTransparentPostProcess = (1 << 2), |
|||
PostProcess = (1 << 3), |
|||
DepthPrePass = (1 << 4), |
|||
DepthCopy = (1 << 5), |
|||
DefaultViewport = (1 << 6), |
|||
IntermediateTexture = (1 << 7) |
|||
} |
|||
|
|||
public static class LightweightUtils |
|||
{ |
|||
static Mesh s_FullscreenMesh = null; |
|||
public static Mesh fullscreenMesh |
|||
{ |
|||
get |
|||
{ |
|||
if (s_FullscreenMesh != null) |
|||
return s_FullscreenMesh; |
|||
|
|||
float topV = 1.0f; |
|||
float bottomV = 0.0f; |
|||
|
|||
Mesh mesh = new Mesh {name = "Fullscreen Quad"}; |
|||
mesh.SetVertices(new List<Vector3> |
|||
{ |
|||
new Vector3(-1.0f, -1.0f, 0.0f), |
|||
new Vector3(-1.0f, 1.0f, 0.0f), |
|||
new Vector3( 1.0f, -1.0f, 0.0f), |
|||
new Vector3( 1.0f, 1.0f, 0.0f) |
|||
}); |
|||
|
|||
mesh.SetUVs(0, new List<Vector2> |
|||
{ |
|||
new Vector2(0.0f, bottomV), |
|||
new Vector2(0.0f, topV), |
|||
new Vector2(1.0f, bottomV), |
|||
new Vector2(1.0f, topV) |
|||
}); |
|||
|
|||
mesh.SetIndices(new[] { 0, 1, 2, 2, 1, 3 }, MeshTopology.Triangles, 0, false); |
|||
mesh.UploadMeshData(true); |
|||
return mesh; |
|||
} |
|||
} |
|||
|
|||
public static void DrawFullScreen(CommandBuffer commandBuffer, Material material, |
|||
MaterialPropertyBlock properties = null, int shaderPassId = 0) |
|||
{ |
|||
commandBuffer.DrawMesh(fullscreenMesh, Matrix4x4.identity, material, 0, shaderPassId, properties); |
|||
} |
|||
|
|||
public static void StartStereoRendering(Camera camera, ref ScriptableRenderContext context, FrameRenderingConfiguration renderingConfiguration) |
|||
{ |
|||
if (HasFlag(renderingConfiguration, FrameRenderingConfiguration.Stereo)) |
|||
context.StartMultiEye(camera); |
|||
} |
|||
|
|||
public static void StopStereoRendering(Camera camera, ref ScriptableRenderContext context, FrameRenderingConfiguration renderingConfiguration) |
|||
{ |
|||
if (HasFlag(renderingConfiguration, FrameRenderingConfiguration.Stereo)) |
|||
context.StopMultiEye(camera); |
|||
} |
|||
|
|||
public static void GetLightCookieMatrix(VisibleLight light, out Matrix4x4 cookieMatrix) |
|||
{ |
|||
cookieMatrix = Matrix4x4.Inverse(light.localToWorld); |
|||
|
|||
if (light.lightType == LightType.Directional) |
|||
{ |
|||
float scale = 1.0f / light.light.cookieSize; |
|||
|
|||
// apply cookie scale and offset by 0.5 to convert from [-0.5, 0.5] to texture space [0, 1]
|
|||
Vector4 row0 = cookieMatrix.GetRow(0); |
|||
Vector4 row1 = cookieMatrix.GetRow(1); |
|||
cookieMatrix.SetRow(0, new Vector4(row0.x * scale, row0.y * scale, row0.z * scale, row0.w * scale + 0.5f)); |
|||
cookieMatrix.SetRow(1, new Vector4(row1.x * scale, row1.y * scale, row1.z * scale, row1.w * scale + 0.5f)); |
|||
} |
|||
else if (light.lightType == LightType.Spot) |
|||
{ |
|||
// we want out.w = 2.0 * in.z / m_CotanHalfSpotAngle
|
|||
// c = cotHalfSpotAngle
|
|||
// 1 0 0 0
|
|||
// 0 1 0 0
|
|||
// 0 0 1 0
|
|||
// 0 0 2/c 0
|
|||
// the "2" will be used to scale .xy for the cookie as in .xy/2 + 0.5
|
|||
float scale = 1.0f / light.range; |
|||
float halfSpotAngleRad = Mathf.Deg2Rad * light.spotAngle * 0.5f; |
|||
float cs = Mathf.Cos(halfSpotAngleRad); |
|||
float ss = Mathf.Sin(halfSpotAngleRad); |
|||
float cotHalfSpotAngle = cs / ss; |
|||
|
|||
Matrix4x4 scaleMatrix = Matrix4x4.identity; |
|||
scaleMatrix.m00 = scaleMatrix.m11 = scaleMatrix.m22 = scale; |
|||
scaleMatrix.m33 = 0.0f; |
|||
scaleMatrix.m32 = scale * (2.0f / cotHalfSpotAngle); |
|||
|
|||
cookieMatrix = scaleMatrix * cookieMatrix; |
|||
} |
|||
|
|||
// Remaining light types don't support cookies
|
|||
} |
|||
|
|||
public static bool IsSupportedShadowType(LightType lightType) |
|||
{ |
|||
return lightType == LightType.Directional || lightType == LightType.Spot; |
|||
} |
|||
|
|||
public static bool IsSupportedCookieType(LightType lightType) |
|||
{ |
|||
return lightType == LightType.Directional || lightType == LightType.Spot; |
|||
} |
|||
|
|||
public static bool PlatformSupportsMSAABackBuffer() |
|||
{ |
|||
#if UNITY_ANDROID || UNITY_IPHONE || UNITY_TVOS || UNITY_SAMSUNGTV
|
|||
return true; |
|||
#else
|
|||
return false; |
|||
#endif
|
|||
} |
|||
|
|||
public static bool HasFlag(FrameRenderingConfiguration mask, FrameRenderingConfiguration flag) |
|||
{ |
|||
return (mask & flag) != 0; |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue