-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move shaders from gdscript to gdshader, part2
- Loading branch information
Showing
17 changed files
with
179 additions
and
170 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
5 changes: 5 additions & 0 deletions
5
addons/shaderV/rgba/generate_shapes/chekerboardPattern.gdshader
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,5 @@ | ||
shader_type canvas_item; | ||
float _checkerboardPatternFunc(vec2 uv, vec2 _checker_size){ | ||
float fmodRes = mod(floor(_checker_size.x * uv.x) + floor(_checker_size.y * uv.y), 2.0); | ||
return max(sign(fmodRes), 0.0); | ||
} |
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
13 changes: 13 additions & 0 deletions
13
addons/shaderV/rgba/generate_shapes/generateCircle.gdshader
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,13 @@ | ||
shader_type canvas_item; | ||
vec4 _generateCircleFunc(vec2 _uv_circle, vec2 _center_circle, vec2 _scale_factor_circle, float _innerRad_circle, float _outRad_circle, float _hard_circle) { | ||
float _innerRadiusCheck0 = min(_innerRad_circle, _outRad_circle); | ||
float _outerRadiusCheck0 = max(_innerRad_circle, _outRad_circle); | ||
|
||
float currentPositionCircle = length((_uv_circle - _center_circle) * _scale_factor_circle); | ||
float maxIntencityCenterCircle = (_outerRadiusCheck0 + _innerRadiusCheck0) * 0.5; | ||
float rd0 = _outerRadiusCheck0 - maxIntencityCenterCircle; | ||
float circleDistribution = min(max(abs(currentPositionCircle - maxIntencityCenterCircle) / rd0, 0.0), 1.0); | ||
vec4 _outputColor0 = vec4(1.0); | ||
_outputColor0.a = 1.0 - pow(circleDistribution, _hard_circle); | ||
return _outputColor0; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
shader_type canvas_item; | ||
vec4 _generateCircle2Func(vec2 _uv_gc2, vec2 _pos_gc2, vec2 _scale_gc2, float _rad_gc2, | ||
float _bordIn_gc2, float _bordOut_gc2, vec4 _col_gc2){ | ||
float _dst_gc2 = length((_uv_gc2 - _pos_gc2) * _scale_gc2); | ||
_col_gc2.a *= smoothstep(_rad_gc2 - _bordIn_gc2, _rad_gc2, _dst_gc2) | ||
- smoothstep(_rad_gc2, _rad_gc2 + _bordOut_gc2, _dst_gc2); | ||
return _col_gc2; | ||
} |
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
10 changes: 10 additions & 0 deletions
10
addons/shaderV/rgba/generate_shapes/generateRegularNgon.gdshader
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,10 @@ | ||
shader_type canvas_item; | ||
float _polygonFunc(vec2 _uv_polygon, vec2 _pos_polygon, vec2 _size_polygon, float _sides_polygon, float _angle_polygon, float _smooth_polygon){ | ||
_uv_polygon = (_uv_polygon - _pos_polygon) / (_size_polygon * 2.0); | ||
float a_polygon = atan(_uv_polygon.x, _uv_polygon.y) + _angle_polygon; | ||
float r_polygon = 6.28318530718 / float(int(max(_sides_polygon, 3.0))); | ||
float d_polygon = cos(floor(0.5 + a_polygon / r_polygon) * r_polygon - a_polygon) * length(_uv_polygon); | ||
return (max(sign(_smooth_polygon - 0.0), 0.0) * ( 1.0 - smoothstep(0.1 - 0.0001, 0.1 + _smooth_polygon, d_polygon) ) + | ||
(max(sign(-_smooth_polygon + 0.0), 0.0)) * ( 1.0 - smoothstep(0.1 + _smooth_polygon - 0.0001, 0.1, d_polygon) ) + | ||
(1.0 - abs(sign(_smooth_polygon - 0.0))) * ( 1.0 - step(0.1, d_polygon)) ); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
shader_type canvas_item; | ||
vec4 _generateSpiralFunc(vec2 _uv_genSpir, vec2 _pivot_genSpir, float _size_genSpir, float _lineAmnt_genSpir, | ||
float _spd_genSpir, float _soft_genSpir, float _t1me_genSpir, vec4 _col_genSpir){ | ||
_uv_genSpir -= _pivot_genSpir; | ||
float _va1ue_genSpir = 1.0 - sin(length(_uv_genSpir) * _size_genSpir + | ||
floor(_lineAmnt_genSpir) * atan(_uv_genSpir.x, _uv_genSpir.y) + | ||
_t1me_genSpir * _spd_genSpir ) / _soft_genSpir; | ||
return vec4(_col_genSpir.rgb, _col_genSpir.a * _va1ue_genSpir); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
shader_type canvas_item; | ||
vec4 _gridFunc(vec2 _grid_uv, vec2 _gridline_thickness, vec2 _gridline_smooth, vec2 _gridcell_count, vec4 _grid_col, vec4 _grid_bg_col){ | ||
vec2 _grid_vec = fract(_grid_uv * _gridcell_count); | ||
_grid_vec = min(_grid_vec, vec2(1.0) - _grid_vec); | ||
_grid_vec = smoothstep(_grid_vec - _gridline_smooth, _grid_vec + _gridline_smooth, _gridline_thickness / vec2(2.0)); | ||
return mix(_grid_bg_col, _grid_col, clamp(_grid_vec.x + _grid_vec.y, 0.0, 1.0)); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
shader_type canvas_item; | ||
float _scanLinesSharpFunc(vec2 _uv_scLiShrp, float _amount_scLiShrp, float _fill_scLiShrp, float _spd_scLiShrp, float _time_scLiShrp) { | ||
return step(fract(_uv_scLiShrp.y * _amount_scLiShrp + _time_scLiShrp * _spd_scLiShrp), _fill_scLiShrp); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
shader_type canvas_item; | ||
float _generateRandomStripesFunc(vec2 _uv_stripes, float _fill_stripes, float _amount_stripes){ | ||
_fill_stripes = min(max(_fill_stripes, 0.0), 1.0); | ||
return 1.0 - step(_fill_stripes, fract(sin(dot(floor(vec2(_uv_stripes.y) * _amount_stripes), vec2(12.9898, 78.233))) * 43758.5453123)); | ||
} |