forked from space-wizards/space-station-14
-
-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1560 from ruddygreat/unshaded-displacements
Add support for unshaded displacements
- Loading branch information
Showing
4 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
Resources/Textures/_Impstation/Shaders/displacement_unshaded.swsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
light_mode unshaded; | ||
|
||
uniform sampler2D displacementMap; | ||
uniform highp float displacementSize; | ||
uniform highp vec4 displacementUV; | ||
|
||
varying highp vec2 displacementUVOut; | ||
|
||
void vertex() { | ||
displacementUVOut = mix(displacementUV.xy, displacementUV.zw, tCoord2); | ||
} | ||
|
||
void fragment() { | ||
highp vec4 displacementSample = texture2D(displacementMap, displacementUVOut); | ||
highp vec2 displacementValue = (displacementSample.xy - vec2(128.0 / 255.0)) / (1.0 - 128.0 / 255.0); | ||
COLOR = zTexture(UV + displacementValue * TEXTURE_PIXEL_SIZE * displacementSize * vec2(1.0, -1.0)); | ||
COLOR.a *= displacementSample.a; | ||
} | ||
|
||
|