Skip to content

Commit 37e9399

Browse files
Fixed ray-tracing variant of the checkerboard shader graph node #6301 (#6539)
1 parent 7f058f1 commit 37e9399

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

com.unity.shadergraph/CHANGELOG.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [12.1.3] - 2021-11-17
88

9-
Version Updated
10-
The version number for this package has increased due to a version update of a related graphics package.
9+
### Fixed
10+
11+
- Fixed the behavior of checkerboard node with raytracing
1112

1213
## [12.1.2] - 2021-10-22
1314

1415
### Fixed
15-
- Fixed a ShaderGraph warning when connecting a node using Object Space BiTangent to the vertex stage [1361512] (https://issuetracker.unity3d.com/issues/shader-graph-cross-implicit-truncation-of-vector-type-errors-are-thrown-when-connecting-transform-node-to-vertex-block)
16-
16+
- Fixed a ShaderGraph warning when connecting a node using Object Space BiTangent to the vertex stage [1361512] (https://issuetracker.unity3d.com/issues/shader-graph-cross-implicit-truncation-of-vector-type-errors-are-thrown-when-connecting-transform-node-to-vertex-block)
17+
1718
## [12.1.1] - 2021-10-04
1819

1920
### Fixed

com.unity.shadergraph/Editor/Data/Nodes/Procedural/CheckerboardNode.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ static string Unity_Checkerboard(
2727
return
2828
@"
2929
{
30-
UV = (UV.xy + 0.5) * Frequency;
31-
$precision2 distance3 = 4.0 * abs(frac(UV + 0.25) - 0.5) - 1.0;
3230
#if defined(SHADER_STAGE_RAY_TRACING)
33-
int2 alpha = saturate(distance3 * FLT_MAX);
34-
Out = lerp(ColorB, ColorA, alpha.x ^ alpha.y);
31+
int2 checker = frac(Frequency * UV) > 0.5;
32+
Out = checker.x ^ checker.y ? ColorA : ColorB;
3533
#else
34+
UV = (UV.xy + 0.5) * Frequency;
35+
$precision2 distance3 = 4.0 * abs(frac(UV + 0.25) - 0.5) - 1.0;
3636
$precision4 derivatives = $precision4(ddx(UV), ddy(UV));
3737
$precision2 duv_length = sqrt($precision2(dot(derivatives.xz, derivatives.xz), dot(derivatives.yw, derivatives.yw)));
3838
$precision2 scale = 0.35 / duv_length.xy;

0 commit comments

Comments
 (0)