Skip to content

Commit

Permalink
Fix shaders (mostly the dissolve logic)
Browse files Browse the repository at this point in the history
[CI BUILD]
  • Loading branch information
andybak committed Sep 15, 2024
1 parent 5517311 commit 206ed65
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Assets/Resources/Brushes/Basic/Bubbles/Bubbles.shader
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Category {
{

if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard;
if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard;
if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard;

float4 tex = tex2D(_MainTex, i.texcoord);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Shader "Brush/Special/DiamondHull" {
uniform half _Opacity;

struct Input {
float4 vertex : SV_POSITION;
float4 color : Color;
float2 tex : TEXCOORD0;
float3 viewDir;
Expand Down Expand Up @@ -182,7 +183,7 @@ Shader "Brush/Special/DiamondHull" {
void surf (Input IN, inout SurfaceOutputStandardSpecular o) {

if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard;
if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard;
if (_Dissolve < 1 && Dither8x8(IN.vertex.xy) >= _Dissolve) discard;

// Hardcode some shiny specular values
o.Smoothness = .8;
Expand Down
2 changes: 1 addition & 1 deletion Assets/Resources/Brushes/Basic/Plasma/Plasma.shader
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Category {
fixed4 frag (v2f i) : COLOR
{
if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard;
if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard;
if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard;

// Workaround for b/30500118, caused by b/30504121
i.color.a = saturate(i.color.a);
Expand Down
2 changes: 1 addition & 1 deletion Assets/Resources/Brushes/Basic/Snow/Snow.shader
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Category {
fixed4 frag (v2f i) : SV_Target
{
if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard;
if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard;
if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard;

float4 texCol = tex2D(_MainTex, i.texcoord);
float4 color = SrgbToNative(2.0f * i.color * _TintColor * texCol);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Category {
fixed4 frag (v2f i) : SV_Target
{
if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard;
if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard;
if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard;

float4 c = i.color * _TintColor * tex2D(_MainTex, i.texcoord);
c = encodeHdr(c.rgb * c.a);
Expand Down
2 changes: 1 addition & 1 deletion Assets/Resources/Brushes/Basic/Wireframe/Wireframe.shader
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Category {
fixed4 frag (v2f i) : COLOR
{
if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard;
if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard;
if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard;

half w = 0;
#ifdef AUDIO_REACTIVE
Expand Down
3 changes: 2 additions & 1 deletion Assets/Resources/X/Brushes/BubbleWand/BubbleWand.shader
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Properties {
float2 tex : TEXCOORD0;
float3 viewDir;
uint id : SV_VertexID;
float4 screenPos;
INTERNAL_DATA
};

Expand Down Expand Up @@ -121,7 +122,7 @@ Properties {
void surf (Input IN, inout SurfaceOutputStandardSpecular o) {

if (_ClipEnd > 0 && !(IN.id.x > _ClipStart && IN.id.x < _ClipEnd)) discard;
if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard;
if (_Dissolve < 1 && Dither8x8(IN.screenPos.xy) >= _Dissolve) discard;

// Hardcode some shiny specular values
o.Smoothness = .9;
Expand Down
2 changes: 1 addition & 1 deletion Assets/Resources/X/Brushes/Digital/Digital.shader
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Category {
fixed4 frag (v2f i) : COLOR {

if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard;
if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard;
if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard;

float stroke_width = .1;
float antialias_feather_px = 4;
Expand Down
2 changes: 1 addition & 1 deletion Assets/Resources/X/Brushes/Drafting/Drafting.shader
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Shader "Brush/Special/Drafting" {
fixed4 frag (v2f i) : COLOR {

if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard;
if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard;
if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard;

half4 c = i.color * tex2D(_MainTex, i.texcoord );
c = encodeHdr(c.rgb * c.a * _Opacity);
Expand Down
2 changes: 1 addition & 1 deletion Assets/Resources/X/Brushes/Race/Race.shader
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Category {
fixed4 frag (v2f i) : COLOR {

if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard;
if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard;
if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard;

// copied from Digital.shader with a modification on the chance
// that a tile will connect with its neighbor
Expand Down
2 changes: 1 addition & 1 deletion Assets/Resources/X/Brushes/Rain/Rain.shader
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Category {
fixed4 frag (v2f i) : COLOR
{
if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard;
if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard;
if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard;

float u_scale = _Speed;
float t = fmod(GetTime().y * 4 * u_scale, u_scale);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Category {
fixed4 frag (v2f i) : SV_Target
{
if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard;
if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard;
if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard;

float4 tex = tex2D(_MainTex, i.texcoord);

Expand Down
2 changes: 1 addition & 1 deletion Assets/Resources/X/Brushes/Wind/Wind.shader
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Category {
fixed4 frag (v2f i) : COLOR
{
if (_ClipEnd > 0 && !(i.id.x > _ClipStart && i.id.x < _ClipEnd)) discard;
if (_Dissolve < 1 && Dither8x8(i.pos.xy) >= _Dissolve) discard;
if (_Dissolve < 1 && Dither8x8(i.vertex.xy) >= _Dissolve) discard;

// Simple scrollin'
float time = GetTime().y * _Speed;
Expand Down

0 comments on commit 206ed65

Please sign in to comment.