Skip to content
This repository was archived by the owner on Jun 17, 2025. It is now read-only.

Commit 6c30551

Browse files
authored
Merge pull request #9 from Netherlands3D/feature/supporting-receive-shadows-tile-shader
tiles3d shader shadow strength support
2 parents 2474910 + 292d92a commit 6c30551

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77

8+
## [5.0.9] - 2025-05-20
9+
This release is part of the Netherlands3D fork.
10+
### Added
11+
-shadow strength support in tiles3d shader
12+
813
## [5.0.8] - 2025-05-20
914
This release is part of the Netherlands3D fork.
1015
### Fixed

Runtime/Shader/Tiles3D.shader

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
{
55
_Color ("Color", Color) = (1,1,1,1)
66
baseColorTexture ("Base Color Texture", 2D) = "white" {}
7+
_ShadowStrength ("Shadow Strength", Range(0, 1)) = 0.5
78
}
89
SubShader
910
{
@@ -56,6 +57,7 @@
5657

5758
sampler2D baseColorTexture;
5859
float4 _Color;
60+
float _ShadowStrength;
5961

6062
v2f vert (appdata v)
6163
{
@@ -81,11 +83,12 @@
8183
{
8284
float4 texColor = tex2D(baseColorTexture, i.uv);
8385
float4 color = texColor * _Color;
84-
8586
Light mainLight = GetMainLight(i.shadowCoord); //get dir light
86-
float3 lightCol = Lambert(mainLight.color * mainLight.shadowAttenuation, mainLight.direction, float3(0,1,0)); //lets keep up normal always
87+
float shadowAtten = lerp(1.0, mainLight.shadowAttenuation, _ShadowStrength);
88+
float3 lightCol = Lambert(mainLight.color * shadowAtten, mainLight.direction, float3(0,1,0));
89+
//color.rgb *= lightCol + 1;
90+
color.rgb *= lerp(0, lightCol + 1, shadowAtten);
8791

88-
color.rgb *= lightCol + 1;
8992
return color;
9093
}
9194
ENDHLSL
@@ -119,6 +122,8 @@
119122
UNITY_VERTEX_OUTPUT_STEREO
120123
};
121124

125+
float _ShadowStrength;
126+
122127
Varyings vert(Attributes input)
123128
{
124129
Varyings output;
@@ -128,7 +133,7 @@
128133
float3 worldPos = TransformObjectToWorld(input.vertex.xyz);
129134
float3 worldNormal = TransformObjectToWorldNormal(input.normal);
130135

131-
worldPos += worldNormal * 0.001; //prevent zfighting spots
136+
worldPos += worldNormal * (0.001 * _ShadowStrength); //prevent zfighting spots
132137

133138
output.positionCS = TransformWorldToHClip(worldPos);
134139
return output;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eu.netherlands3d.gltfast",
3-
"version": "5.0.8",
3+
"version": "5.0.9",
44
"displayName": "glTFast [Netherlands3D]",
55
"description": "[Netherlands3D fork] Use glTFast to import and export glTF 3D files efficiently at runtime or in the Editor",
66
"unity": "2019.4",

0 commit comments

Comments
 (0)