Skip to content
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

[Backport 8.x.x] Fixed error Maximum allowed thread group count is 65535 when resolution is very high #2623

Merged
merged 67 commits into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
937e9c1
[10.x.x] Axf: add normal gradients and all mapping modes (uv, planar,…
slunity Jun 12, 2020
d094c5a
[10.x.x] Axf fix shininess exp to roughness, ssr transparent and alph…
slunity Jun 12, 2020
5f86be4
Update Light-Component.md (#682)
JordanL8 Jun 6, 2020
16f7161
push meta
sebastienlagarde Jul 7, 2020
7baef35
removed undesired change in AXF
sebastienlagarde Jul 7, 2020
fb33c79
Fix transparent movec scene view #698
FrancescoC-unity Jun 2, 2020
4ce96aa
Porting console fixes to staging (#699)
FrancescoC-unity Jun 4, 2020
fda10a8
Update HDRP-Camera.md (#706)
JordanL8 Jun 6, 2020
dbad64a
Pre warm RT Handle system so that reallocations are reduced. #713
FrancescoC-unity Jun 6, 2020
80ed29a
Update PlanarReflectionProbeCache.cs
sebastienlagarde Jul 7, 2020
cc93c2d
Update preview naming in raytrace component #753
sebastienlagarde Jun 7, 2020
644061c
Workaround for GetKernelThreadGroupSizes returning wrong data #760
FrancescoC-unity Jun 9, 2020
81f925d
Sanitize transparent motion vectors setting #761
adrien-de-tocqueville Jun 9, 2020
51ea72a
Standard terrain upgrader (#762)
remi-chapelain Jun 9, 2020
aedd7ba
Update Reflection-Probe (#790)
JordanL8 Jun 9, 2020
c8e4097
Fix reflection probe framesettings override #796
adrien-de-tocqueville Jun 10, 2020
88bde23
Force post process parent setting to be before child settings #799
FrancescoC-unity Jun 9, 2020
320605e
Fixed 1253367 by rebaking probe with missing baked texture. #818
fredericv-unity3d Jun 21, 2020
f23a6f7
Fix issue with blocky artifacts when decals affecting metallic are ap…
FrancescoC-unity Jun 10, 2020
b948613
Fixed blend distance editing (1248931) #838
fredericv-unity3d Jun 12, 2020
4fc7521
Fix API breaking change: Add Public quality to Raytracing volume effect
sebastienlagarde Jul 7, 2020
f8fc08a
Fix API breaking change: Add Public quality to Raytracing volume effe…
sebastienlagarde Jul 7, 2020
e4260ec
Merge branch '8.x.x/release' into 8.x.x/hd/staging
sebastienlagarde Jul 7, 2020
02f56c7
Update HDR information. Also updated format and links. (#853)
JordanL8 Jun 11, 2020
8c920f4
Fix message for metal and ao (#859)
sebastienlagarde Jun 11, 2020
0e04f76
d Fix issue with the blue line of prefab modifications for Volume mod…
FrancescoC-unity Jun 11, 2020
9de5cb2
Recompute FOV when generating PixelCoord To WorldSpace View Direction…
FrancescoC-unity Jun 11, 2020
08b7f9e
Upgrade default legacy terrain to HDRP default TerrainLit (#883)
remi-chapelain Jun 12, 2020
8f01531
Editing volumes via script doc (#884)
JordanL8 Jun 15, 2020
f4e391d
Update HDRenderPipeline.cs (#994)
sebastienlagarde Jun 19, 2020
bf89377
Delete 9713_VirtualTexturing.meta
sebastienlagarde Jun 19, 2020
3b7f7fb
Fix SSAO with double sided material and normal mode to none #1043
FrancescoC-unity Jul 3, 2020
deacc88
Fix emissive mesh layer mask behaviour #1062
FrancescoC-unity Jul 2, 2020
e5e102f
Use the wide mode to force the UI drawing on a single line (1251235) …
fredericv-unity3d Jul 3, 2020
805e51c
Fix custom pass after post process buffer #1072
sebastienlagarde Jul 7, 2020
c9574da
Fix for area light baked data not updating when changing the gizmo #1075
FrancescoC-unity Jul 4, 2020
3d88d6b
Fixed an error when switch area light shape to disk while an emissiv…
fredericv-unity3d Jul 3, 2020
bf6e812
Have the PBR Sky not render black when below horizon #1116
FrancescoC-unity Jul 3, 2020
cc8ba57
Find the appropriate default frame settings per editor (case 1247631)…
fredericv-unity3d Jul 3, 2020
c122273
Fix taaFrameIndex and restore TAA tests for XR #534
fabien-unity May 18, 2020
2a79682
fix typo in the Render Pipeline Wizard #1037
fabien-unity Jun 29, 2020
cb7e9ad
Add light layer on indirect lighting controller #777
EvgeniiG Jun 16, 2020
3a00afa
[8.x.x Backport] Fix exposure white flash when enabling SSR (#842)
FrancescoC-unity Jul 7, 2020
ffdc83e
[8.x.x Backport] Fix transparent/opaque motion vector inconsistencies…
FrancescoC-unity Jul 7, 2020
4ab3b4f
[8.x.x Backport] Fix depth pyramid issues with dynamic resolution (#847)
FrancescoC-unity Jul 7, 2020
c87a238
[Backport 8.x.x] Fixed a serialization issue, preventing quality leve…
JulienIgnace-Unity Jul 7, 2020
5719763
[Backport 8.x.x] Fixed Look Dev with Light Theme (#1106)
JulienIgnace-Unity Jul 7, 2020
da56fbd
[Backport 8.x.x] Fixed decal duplication when editing a prefab in con…
JulienIgnace-Unity Jul 7, 2020
04ad6e9
Fix API breaking change in indirect controller
sebastienlagarde Jul 7, 2020
40cd33b
Fix area light gizmo not updating engine side light v2 #1156
FrancescoC-unity Jul 6, 2020
50e94b4
Merge branch '8.x.x/release' into 8.x.x/hd/staging
sebastienlagarde Jul 7, 2020
54cb443
Merge branch '8.x.x/release' into 8.x.x/hd/staging
sebastienlagarde Jul 8, 2020
f6cbe28
Add missing ClothObj.
sebastienlagarde Jul 8, 2020
9e4b936
HDRP: Default indirect Lighting controller Layers to Everything to ea…
sebastienlagarde Jul 8, 2020
c52ab11
Update HDRenderPipelineResources.asset
sebastienlagarde Jul 8, 2020
d0b7f95
Fixed logic of test on presence of HDRP asset that would wrongly trig…
eturquin Jun 10, 2020
0560e04
Merge branch '8.x.x/release' into 8.x.x/hd/staging
sebastienlagarde Jul 9, 2020
a294a18
Rename h to hlsl
FrancescoC-unity Jun 18, 2020
64b4aa0
Update cas include paths (#1227)
FrancescoC-unity Jul 9, 2020
1046768
Fix XR single-pass macros in tessellation shaders #1160
fabien-unity Jul 9, 2020
a9351ac
Hdrp/fix hierarchicalbox gizmo symetry and homothety mode ensuring fa…
RSlysz Jul 9, 2020
70c18df
Merge branch '8.x.x/release' into 8.x.x/hd/staging
sebastienlagarde Jul 23, 2020
add2d74
[8.x.x backport] Fix issues with history sampling and hw dynamic res …
FrancescoC-unity Sep 4, 2020
19af4db
[Backport 8.x.x] Fixed an issue where look dev lighting would go blac…
JulienIgnace-Unity Sep 8, 2020
7756921
Fix
FrancescoC-unity Nov 13, 2020
4f4ee1a
Changelog
FrancescoC-unity Nov 13, 2020
92f5e78
Merge branch '8.x.x/hd/staging' into 8.x.x/hd/fix-max-thread-count-bug
sebastienlagarde Nov 17, 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
Prev Previous commit
Next Next commit
Merge branch '8.x.x/release' into 8.x.x/hd/staging
  • Loading branch information
sebastienlagarde committed Jul 8, 2020
commit 54cb443fa7355fd0da8d0d33c39830d258630c86
2 changes: 1 addition & 1 deletion com.unity.render-pipelines.core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [8.2.0] - 2020-07-08

Version Updated
The version number for this package has increased due to a version update of a related graphics package.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [8.2.0] - 2020-07-08

Version Updated
The version number for this package has increased due to a version update of a related graphics package.
Expand Down
2 changes: 1 addition & 1 deletion com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [8.2.0] - 2020-07-07
## [8.2.0] - 2020-07-08

### Added
- Added a function (HDRenderPipeline.ResetRTHandleReferenceSize) to reset the reference size of RTHandle systems.
Expand Down
8 changes: 0 additions & 8 deletions com.unity.render-pipelines.high-definition/Editor/Wizard.meta

This file was deleted.

2 changes: 1 addition & 1 deletion com.unity.render-pipelines.lightweight/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [8.2.0] - 2020-07-08

Version Updated
The version number for this package has increased due to a version update of a related graphics package.
Expand Down
42 changes: 22 additions & 20 deletions com.unity.render-pipelines.universal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,42 @@ All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [8.2.0] - 2020-07-08

### Added
- Added option to enable/disable Adaptive Performance when it's package is available.
- Added an option to enable/disable Adaptive Performance when the Adaptive Performance package is available in the project.
- Added new sections to documentation: [Writing custom shaders](https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@8.2/manual/writing-custom-shaders-urp.html), and [Using the beginCameraRendering event](https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@8.2/manual/using-begincamerarendering.html).

### Changed
- The 2D Renderer now supports camera stacking.
- The pipeline is now computing tangent space in per fragment.
- URP is now computing tangent space per fragment.

### Fixed
- Fixed an issue where grid lines were being drawn on top of opaque objects in the preview window [case 1240723](https://issuetracker.unity3d.com/issues/urp-grid-is-rendered-in-front-of-the-model-in-the-inspector-animation-preview-window-when-depth-or-opaque-texture-is-enabled)
- Fixed an issue where objects in the preview window were being affected by layer mask settings in the default renderer [case 1204376](https://issuetracker.unity3d.com/issues/urp-prefab-preview-is-blank-when-a-custom-forward-renderer-data-and-default-layer-mask-is-mixed-are-used)
- Fixed issues with performance when importing fbx files
- Fixed issues with NullReferenceException happening with URP shaders
- Fixed an issue where the emission value in particle shaders would not update in the editor without entering playmode.
- Fixed an issue where grid lines were drawn on top of opaque objects in the preview window. [Case 1240723](https://issuetracker.unity3d.com/issues/urp-grid-is-rendered-in-front-of-the-model-in-the-inspector-animation-preview-window-when-depth-or-opaque-texture-is-enabled).
- Fixed an issue where objects in the preview window were affected by layer mask settings in the default renderer. [Case 1204376](https://issuetracker.unity3d.com/issues/urp-prefab-preview-is-blank-when-a-custom-forward-renderer-data-and-default-layer-mask-is-mixed-are-used).
- Fixed issues with performance when importing fbx files.
- Fixed issues with NullReferenceException happening with URP shaders.
- Fixed an issue where the emission value in particle shaders would not update in the editor without entering Play mode.
- Fixed SceneView Draw Modes not being properly updated after opening new scene view panels or changing the editor layout.
- Fixed issue on Nintendo Switch where maximum number of visible lights in C# code did not match maximum number in shader code.
- Fixed GLES shaders compilation failing on Windows platform (not a mobile platform) due to uniform count limit.
- Fixed an issue where preset button could still be used, when it is not supposed to. [case 1246261](https://issuetracker.unity3d.com/issues/urp-reset-functionality-does-not-work-for-renderobject-preset-asset)
- Fixed an issue that causes viewport to not work correctly when rendering to textures. [case 1225103](https://issuetracker.unity3d.com/issues/urp-the-viewport-rect-isnt-correctly-applied-when-the-camera-is-outputting-into-a-rendertexture)
- Fixed an issue where the preset button could still be used, when it was not supposed to. [Case 1246261](https://issuetracker.unity3d.com/issues/urp-reset-functionality-does-not-work-for-renderobject-preset-asset).
- Fixed an issue that caused viewport to not work correctly when rendering to textures. [Case 1225103](https://issuetracker.unity3d.com/issues/urp-the-viewport-rect-isnt-correctly-applied-when-the-camera-is-outputting-into-a-rendertexture).
- Fixed an issue that caused incorrect sampling of HDR reflection probe textures.
- Fixed UI text of RenderObjects feature to display LightMode tag instead of Shader Pass Name. [case 1201696](https://issuetracker.unity3d.com/issues/render-feature-slash-pass-ui-has-a-field-for-shader-pass-name-when-it-actually-expects-shader-pass-lightmode)
- Fixed an issue that caused memory allocations when sorting cameras. [case 1226448](https://issuetracker.unity3d.com/issues/2d-renderer-using-more-than-one-camera-that-renders-out-to-a-render-texture-creates-gc-alloc-every-frame)
- Fixed an issue that caused the inverse view and projection matrix to output wrong values in some platforms. [case 1243990](https://issuetracker.unity3d.com/issues/urp-8-dot-1-breaks-unity-matrix-i-vp)
- Fixed UI text of RenderObjects feature to display LightMode tag instead of Shader Pass Name. [Case 1201696](https://issuetracker.unity3d.com/issues/render-feature-slash-pass-ui-has-a-field-for-shader-pass-name-when-it-actually-expects-shader-pass-lightmode).
- Fixed an issue that caused memory allocations when sorting cameras. [Case 1226448](https://issuetracker.unity3d.com/issues/2d-renderer-using-more-than-one-camera-that-renders-out-to-a-render-texture-creates-gc-alloc-every-frame).
- Fixed an issue that caused the inverse view and projection matrix to output wrong values in some platforms. [Case 1243990](https://issuetracker.unity3d.com/issues/urp-8-dot-1-breaks-unity-matrix-i-vp).
- Fixed an issue where only unique names of cameras could be added to the camera stack.
- Fixed an issue with URP switching such that every avaiable URP makes a total set of supported features such that all URPs are taken into consideration. [case 1157420](https://issuetracker.unity3d.com/issues/lwrp-srp-switching-doesnt-work-even-with-manually-adding-shadervariants-per-scene)
- Fixed an issue with URP switching so that every available URP makes a total set of supported features, so that all URPs are taken into consideration. [Case 1157420](https://issuetracker.unity3d.com/issues/lwrp-srp-switching-doesnt-work-even-with-manually-adding-shadervariants-per-scene).
- Fixed an issue that caused incorrect sampling of HDR reflection probe textures.
- Fixed an issue that caused Android GLES to render blank screen when Depth texture was enabled without Opaque texture [case 1219325](https://issuetracker.unity3d.com/issues/scene-is-not-rendered-on-android-8-and-9-when-depth-texture-is-enabled-in-urp-asset)
- Fixed an issue where XR multipass throws errors saying that it doesn't support camera stack spamming.
- Metallic slider on the Lit shader is now linear meaning correct values are used for PBR.
- Fixed issue where using DOF at the same time as Dynamic Scaling, the depth buffer was sampled with incorrect UVs. [case 1225467](https://issuetracker.unity3d.com/product/unity/issues/guid/1225467/)
- Fixed an issue that caused Android GLES to render blank screen when Depth texture was enabled without Opaque texture. [Case 1219325](https://issuetracker.unity3d.com/issues/scene-is-not-rendered-on-android-8-and-9-when-depth-texture-is-enabled-in-urp-asset).
- Fixed an issue where XR multipass repeatedly throws error messages "Multi pass stereo mode doesn't support Camera Stacking".
- Metallic slider on the Lit shader is now linear, so that correct values are used for PBR.
- Fixed an issue where using DOF at the same time as Dynamic Scaling, the depth buffer was sampled with incorrect UVs. [Case 1225467](https://issuetracker.unity3d.com/product/unity/issues/guid/1225467/).
- Fixed an issue where URP Simple Lit shader had attributes swapped incorrectly for BaseMap and BaseColor properties.
- Fixed an issue where camera stacking with MSAA on OpenGL resulted in a black screen. [case 1250602](https://issuetracker.unity3d.com/issues/urp-camera-stacking-results-in-black-screen-when-msaa-and-opengl-graphics-api-are-used)
- Fixed issue with Model Importer materials using the Legacy standard shader instead of URP's Lit shader when import happens at Editor startup.
- Fixed an issue where camera stacking with MSAA on OpenGL resulted in a black screen. [Case 1250602](https://issuetracker.unity3d.com/issues/urp-camera-stacking-results-in-black-screen-when-msaa-and-opengl-graphics-api-are-used).
- Fixed an issue where Model Importer Materials used the Standard Shader from the Built-in Render Pipeline instead of URP Lit shader when the import happened at Editor startup.
- Fixed an issue causing shadows to be incorrectly rendered when a light was close to the shadow caster.

## [8.1.0] - 2020-04-21

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,10 @@ static private void RenderShadows(CommandBuffer cmdBuffer, int layerToRender, Li
cmdBuffer.ClearRenderTarget(true, true, Color.black);

BoundingSphere lightBounds = light.GetBoundingSphere(); // Gets the local bounding sphere...
float shadowRadius = 1.42f * lightBounds.radius;

cmdBuffer.SetGlobalVector("_LightPos", light.transform.position);
cmdBuffer.SetGlobalFloat("_LightRadius", lightBounds.radius);
cmdBuffer.SetGlobalFloat("_ShadowRadius", shadowRadius);

Material shadowMaterial = GetShadowMaterial(1);
Material removeSelfShadowMaterial = GetRemoveSelfShadowMaterial(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public class ShadowCaster2D : ShadowCasterGroup2D
[SerializeField] Mesh m_Mesh;
[SerializeField] int m_InstanceId;


internal ShadowCasterGroup2D m_ShadowCasterGroup = null;
internal ShadowCasterGroup2D m_PreviousShadowCasterGroup = null;

Expand Down Expand Up @@ -84,7 +83,7 @@ internal bool IsShadowedLayer(int layer)

private void Awake()
{
if(m_ApplyToSortingLayers == null)
if (m_ApplyToSortingLayers == null)
m_ApplyToSortingLayers = SetDefaultSortingLayers();

Bounds bounds = new Bounds(transform.position, Vector3.one);
Expand Down Expand Up @@ -175,5 +174,6 @@ void Reset()
OnEnable();
}
#endif

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ static Edge CreateEdge(int triangleIndexA, int triangleIndexB, List<Vector3> ver
retEdge.AssignVertexIndices(triangles[triangleIndexA], triangles[triangleIndexB]);

Vector3 vertex0 = vertices[retEdge.vertexIndex0];
vertex0.z = 0;
Vector3 vertex1 = vertices[retEdge.vertexIndex1];
vertex1.z = 0;

Vector3 edgeDir = Vector3.Normalize(vertex1 - vertex0);
retEdge.tangent = Vector3.Cross(-Vector3.forward, edgeDir);
Expand Down Expand Up @@ -88,7 +90,7 @@ static void SortEdges(List<Edge> edgesToProcess)
edgesToProcess.Sort();
}

static void CreateShadowTriangles(List<Vector3> vertices, List<int> triangles, List<Vector4> tangents, List<Edge> edges)
static void CreateShadowTriangles(List<Vector3> vertices, List<Color> colors, List<int> triangles, List<Vector4> tangents, List<Edge> edges)
{
for(int edgeIndex=0; edgeIndex<edges.Count; edgeIndex++)
{
Expand All @@ -99,6 +101,8 @@ static void CreateShadowTriangles(List<Vector3> vertices, List<int> triangles, L

int newVertexIndex = vertices.Count;
vertices.Add(vertices[edge.vertexIndex0]);
colors.Add(colors[edge.vertexIndex0]);

tangents.Add(-edge.tangent);

triangles.Add(edge.vertexIndex0);
Expand All @@ -121,34 +125,45 @@ static void InitializeTangents(int tangentsToAdd, List<Vector4> tangents)

public static void GenerateShadowMesh(Mesh mesh, Vector3[] shapePath)
{
Color meshInteriorColor = new Color(0, 0, 0, 1);
List<Vector3> vertices = new List<Vector3>();
List<int> triangles = new List<int>();
List<Vector4> tangents = new List<Vector4>();
List<Color> extrusion = new List<Color>();

// Create interior geometry
int pointCount = shapePath.Length;
var inputs = new ContourVertex[pointCount];
for (int i = 0; i < pointCount; ++i)
inputs[i] = new ContourVertex() { Position = new Vec3() { X = shapePath[i].x, Y = shapePath[i].y }, Data = meshInteriorColor };
var inputs = new ContourVertex[2 * pointCount];
for (int i = 0; i < pointCount; i++)
{
Color extrusionData = new Color(shapePath[i].x, shapePath[i].y, shapePath[i].x, shapePath[i].y);
int nextPoint = (i + 1) % pointCount;
inputs[2*i] = new ContourVertex() { Position = new Vec3() { X = shapePath[i].x, Y = shapePath[i].y, Z=0 }, Data = extrusionData };

extrusionData = new Color(shapePath[i].x, shapePath[i].y, shapePath[nextPoint].x, shapePath[nextPoint].y);
Vector2 midPoint = 0.5f * (shapePath[i] + shapePath[nextPoint]);
inputs[2*i+1] = new ContourVertex() { Position = new Vec3() { X = midPoint.x, Y = midPoint.y, Z = 0}, Data = extrusionData };
}

Tess tessI = new Tess();
tessI.AddContour(inputs, ContourOrientation.Original);
tessI.Tessellate(WindingRule.EvenOdd, ElementType.Polygons, 3, InterpCustomVertexData);

var indicesI = tessI.Elements.Select(i => i).ToArray();
var verticesI = tessI.Vertices.Select(v => new Vector3(v.Position.X, v.Position.Y, 0)).ToArray();
var extrusionI = tessI.Vertices.Select(v => new Color(((Color)v.Data).r, ((Color)v.Data).g, ((Color)v.Data).b, ((Color)v.Data).a)).ToArray();

vertices.AddRange(verticesI);
triangles.AddRange(indicesI);
extrusion.AddRange(extrusionI);

InitializeTangents(vertices.Count, tangents);

List<Edge> edges = new List<Edge>();
PopulateEdgeArray(vertices, triangles, edges);
SortEdges(edges);
CreateShadowTriangles(vertices, triangles, tangents, edges);
CreateShadowTriangles(vertices, extrusion, triangles, tangents, edges);

Color[] finalExtrusion = extrusion.ToArray();
Vector3[] finalVertices = vertices.ToArray();
int[] finalTriangles = triangles.ToArray();
Vector4[] finalTangents = tangents.ToArray();
Expand All @@ -157,6 +172,7 @@ public static void GenerateShadowMesh(Mesh mesh, Vector3[] shapePath)
mesh.vertices = finalVertices;
mesh.triangles = finalTriangles;
mesh.tangents = finalTangents;
mesh.colors = finalExtrusion;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public ForwardRenderer(ForwardRendererData data) : base(data)
m_RenderOpaqueForwardPass = new DrawObjectsPass("Render Opaques", true, RenderPassEvent.BeforeRenderingOpaques, RenderQueueRange.opaque, data.opaqueLayerMask, m_DefaultStencilState, stencilData.stencilReference);
m_CopyDepthPass = new CopyDepthPass(RenderPassEvent.AfterRenderingSkybox, m_CopyDepthMaterial);
m_DrawSkyboxPass = new DrawSkyboxPass(RenderPassEvent.BeforeRenderingSkybox);
m_CopyColorPass = new CopyColorPass(RenderPassEvent.BeforeRenderingTransparents, m_SamplingMaterial);
m_CopyColorPass = new CopyColorPass(RenderPassEvent.AfterRenderingSkybox, m_SamplingMaterial);
m_TransparentSettingsPass = new TransparentSettingsPass(RenderPassEvent.BeforeRenderingTransparents, data.shadowTransparentReceive);
m_RenderTransparentForwardPass = new DrawObjectsPass("Render Transparents", false, RenderPassEvent.BeforeRenderingTransparents, RenderQueueRange.transparent, data.transparentLayerMask, m_DefaultStencilState, stencilData.stencilReference);
m_OnRenderObjectCallbackPass = new InvokeOnRenderObjectCallbackPass(RenderPassEvent.BeforeRenderingPostProcessing);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Shader "Hidden/ShadowGroup2D"
float3 vertex : POSITION;
float4 tangent: TANGENT;
float2 uv : TEXCOORD0;
float4 extrusion : COLOR;
};

struct Varyings
Expand All @@ -49,7 +50,7 @@ Shader "Hidden/ShadowGroup2D"
float4 _MainTex_ST;

uniform float3 _LightPos;
uniform float _LightRadius;
uniform float _ShadowRadius;

Varyings vert (Attributes v)
{
Expand All @@ -58,20 +59,37 @@ Shader "Hidden/ShadowGroup2D"
float3 lightDir = _LightPos - vertexWS;
lightDir.z = 0;

// Start of code to see if this point should be extruded
float3 lightDirection = normalize(lightDir);

float3 endpoint = vertexWS + (_LightRadius * -lightDirection);
float3 endpoint = vertexWS + (_ShadowRadius * -lightDirection);

float3 worldTangent = TransformObjectToWorldDir(v.tangent.xyz);

float sharedShadowTest = saturate(ceil(dot(lightDirection, worldTangent)));
float3 sharedShadowOffset = sharedShadowTest * _LightRadius * -lightDirection;

// Start of code to calculate offset
float3 vertexWS0 = TransformObjectToWorld(float3(v.extrusion.xy, 0));
float3 vertexWS1 = TransformObjectToWorld(float3(v.extrusion.zw, 0));
float3 shadowDir0 = vertexWS0 - _LightPos;
shadowDir0.z = 0;
shadowDir0 = normalize(shadowDir0);

float3 shadowDir1 = vertexWS1 -_LightPos;
shadowDir1.z = 0;
shadowDir1 = normalize(shadowDir1);

float3 shadowDir = normalize(shadowDir0 + shadowDir1);


float3 sharedShadowOffset = sharedShadowTest * _ShadowRadius * shadowDir;

float3 position;
position = vertexWS + sharedShadowOffset;

o.vertex = TransformWorldToHClip(position);



// RGB - R is shadow value (to support soft shadows), G is Self Shadow Mask, B is No Shadow Mask
o.color = 1; // v.color;
o.color.g = 0.5;
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.