179 lines
9.8 KiB
Plaintext
179 lines
9.8 KiB
Plaintext
|
|
|
||
|
|
|
||
|
|
shader_type spatial;
|
||
|
|
|
||
|
|
// Rokojori Shader @alb.382-alp.376-fad.447-geo.20-met.376-nor.278-occ.376-rou.390-sha.391-spa.20-spa.24-spe.376-tra.402-tra.402-uvm.491:
|
||
|
|
/*
|
||
|
|
[ Rokojori.TransparencyModule ] { "alphaScissorTreshold":0.009999999776482582, "blendMode":{"__class__": "Godot.BaseMaterial3D+BlendModeEnum","value__": 1}, "cullMode":{"__class__": "Godot.BaseMaterial3D+CullModeEnum","value__": 0}, "depthDraw":{"__class__": "Godot.BaseMaterial3D+DepthDrawModeEnum","value__": 0}, "noDepthTest":false, "transparency":{"__class__": "Godot.BaseMaterial3D+TransparencyEnum","value__": 1} }
|
||
|
|
[ Rokojori.ShadingModule ] { "diffuseMode":{"__class__": "Godot.BaseMaterial3D+DiffuseModeEnum","value__": 0}, "disableAmbientLight":false, "disableFog":false, "disableReceivingShadows":false, "shadingMode":{"__class__": "Godot.BaseMaterial3D+ShadingModeEnum","value__": 0}, "shadowToOpacity":false, "specularMode":{"__class__": "Godot.BaseMaterial3D+SpecularModeEnum","value__": 0}, "wireFrameMode":false }
|
||
|
|
[ Rokojori.UVModule ] { "channels":[{ "__class__": "Rokojori.UVChannel", "uvTarget": "UV", "uvSource": { "__class__": "Rokojori.MeshUVSource", "meshUV": 0, "sortableCode": true, "uniformGroup": "UVChannels" }, "modifier": { "__class__": "Rokojori.UVScaleOffset", "uvScale": true, "uvUniScale": false, "uvOffset": true, "uvScrolling": true, "sortableCode": true, "uniformGroup": "UVChannels" }, "sortableCode": true, "uniformGroup": "UVChannels"}] }
|
||
|
|
[ Rokojori.GeometryModule ] { "modifiers":[] }
|
||
|
|
[ Rokojori.SpatialVarying ] { "variables":[] }
|
||
|
|
[ Rokojori.SpatialMasksModule ] { "maskVariables":[] }
|
||
|
|
[ Rokojori.AlbedoModule ] { "assignmentType":{"__class__": "Rokojori.TextureModule+AssignmentType","value__": 0}, "filter":{"__class__": "Rokojori.TextureModule+TextureFilter","value__": 5}, "overlayLayers":[], "repeat":true, "srgb":true, "textureDefault":{"__class__": "Rokojori.TextureModule+TextureDefault","value__": 0}, "tintVarying":"", "useTint":true, "uvChannel":"UV", "writeAlpha":false }
|
||
|
|
[ Rokojori.TransparencyModule ] { "alphaScissorTreshold":0.009999999776482582, "blendMode":{"__class__": "Godot.BaseMaterial3D+BlendModeEnum","value__": 1}, "cullMode":{"__class__": "Godot.BaseMaterial3D+CullModeEnum","value__": 0}, "depthDraw":{"__class__": "Godot.BaseMaterial3D+DepthDrawModeEnum","value__": 0}, "noDepthTest":false, "transparency":{"__class__": "Godot.BaseMaterial3D+TransparencyEnum","value__": 1} }
|
||
|
|
[ Rokojori.AlphaModule ] { "assignmentType":{"__class__": "Rokojori.TextureModule+AssignmentType","value__": 0}, "domainMode":{"__class__": "Rokojori.TextureModule+DomainMode","value__": 2}, "filter":{"__class__": "Rokojori.TextureModule+TextureFilter","value__": 5}, "repeat":true, "textureDefault":{"__class__": "Rokojori.TextureModule+TextureDefault","value__": 0}, "uvChannel":"UV" }
|
||
|
|
[ Rokojori.FadingModule ] { "alphaFadeMode":{"__class__": "Rokojori.AlphaFadeMode","value__": 1}, "fadingModifiers":[{ "__class__": "Rokojori.FresnelFading", "advancedControls": true, "alphaFadeMode": 0, "createUniformGroup": false, "sortableCode": true, "uniformGroup": null},{ "__class__": "Rokojori.FresnelFading", "advancedControls": true, "alphaFadeMode": 0, "createUniformGroup": false, "sortableCode": true, "uniformGroup": null}] }
|
||
|
|
[ Rokojori.NormalMapModule ] { "allowNegativeStrength":false, "filter":{"__class__": "Rokojori.TextureModule+TextureFilter","value__": 5}, "maximumStrength":5, "repeat":true, "textureDefault":{"__class__": "Rokojori.TextureModule+TextureDefault","value__": 0}, "useStrength":true, "uvChannel":"UV" }
|
||
|
|
[ Rokojori.OcclusionModule ] { "assignmentType":{"__class__": "Rokojori.TextureModule+AssignmentType","value__": 0}, "domainMode":{"__class__": "Rokojori.TextureModule+DomainMode","value__": 3}, "filter":{"__class__": "Rokojori.TextureModule+TextureFilter","value__": 5}, "repeat":true, "textureDefault":{"__class__": "Rokojori.TextureModule+TextureDefault","value__": 0}, "uvChannel":"UV" }
|
||
|
|
[ Rokojori.RoughnessModule ] { "assignmentType":{"__class__": "Rokojori.TextureModule+AssignmentType","value__": 0}, "clamp":true, "domainMode":{"__class__": "Rokojori.TextureModule+DomainMode","value__": 3}, "filter":{"__class__": "Rokojori.TextureModule+TextureFilter","value__": 5}, "repeat":true, "textureDefault":{"__class__": "Rokojori.TextureModule+TextureDefault","value__": 0}, "uvChannel":"UV" }
|
||
|
|
[ Rokojori.MetallicModule ] { "assignmentType":{"__class__": "Rokojori.TextureModule+AssignmentType","value__": 0}, "domainMode":{"__class__": "Rokojori.TextureModule+DomainMode","value__": 3}, "filter":{"__class__": "Rokojori.TextureModule+TextureFilter","value__": 5}, "repeat":true, "textureDefault":{"__class__": "Rokojori.TextureModule+TextureDefault","value__": 0}, "uvChannel":"UV" }
|
||
|
|
[ Rokojori.SpecularModule ] { "assignmentType":{"__class__": "Rokojori.TextureModule+AssignmentType","value__": 0}, "domainMode":{"__class__": "Rokojori.TextureModule+DomainMode","value__": 0}, "filter":{"__class__": "Rokojori.TextureModule+TextureFilter","value__": 5}, "repeat":true, "textureDefault":{"__class__": "Rokojori.TextureModule+TextureDefault","value__": 0}, "uvChannel":"UV" }
|
||
|
|
*/
|
||
|
|
|
||
|
|
render_mode blend_add, cull_back, depth_draw_opaque, unshaded, diffuse_burley, specular_schlick_ggx;
|
||
|
|
|
||
|
|
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Noise.gdshaderinc"
|
||
|
|
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Light.gdshaderinc"
|
||
|
|
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Math.gdshaderinc"
|
||
|
|
|
||
|
|
// [ U V C H A N N E L S . U V ]
|
||
|
|
group_uniforms UVChannels.UV;
|
||
|
|
|
||
|
|
uniform vec2 UV_scale = vec2( 1.0, 1.0);
|
||
|
|
uniform vec2 UV_offset = vec2( 0.0, 0.0);
|
||
|
|
uniform vec2 UV_scrolling = vec2( 0.0, 0.0);
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
// [ A L B E D O ]
|
||
|
|
group_uniforms albedo;
|
||
|
|
|
||
|
|
uniform vec4 albedo:source_color = vec4( 1.0, 1.0, 1.0, 1.0);
|
||
|
|
uniform sampler2D albedoTexture:source_color, hint_default_white, repeat_enable, filter_linear_mipmap_anisotropic;
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
// [ A L P H A ]
|
||
|
|
group_uniforms alpha;
|
||
|
|
|
||
|
|
uniform float alpha:hint_range( 0.0, 1.0) = 1.0;
|
||
|
|
uniform sampler2D alphaTexture:hint_default_white, repeat_enable, filter_linear_mipmap_anisotropic;
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
// [ F A D I N G ]
|
||
|
|
group_uniforms Fading;
|
||
|
|
|
||
|
|
|
||
|
|
uniform float advancedFresnelFadingZOffset = 0.0f;
|
||
|
|
uniform float advancedFresnelFadingPower = 1.0f;
|
||
|
|
uniform float advancedFresnelFadingPostScale = 1.0f;
|
||
|
|
uniform float advancedFresnelFadingPostOffset = 0.0f;
|
||
|
|
uniform bool advancedFresnelFadingInverse = false;
|
||
|
|
|
||
|
|
|
||
|
|
uniform float advancedFresnelFadingZOffset_2 = 0.0f;
|
||
|
|
uniform float advancedFresnelFadingPower_2 = 1.0f;
|
||
|
|
uniform float advancedFresnelFadingPostScale_2 = 1.0f;
|
||
|
|
uniform float advancedFresnelFadingPostOffset_2 = 0.0f;
|
||
|
|
uniform bool advancedFresnelFadingInverse_2 = false;
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
// [ N O R M A L ]
|
||
|
|
group_uniforms normal;
|
||
|
|
|
||
|
|
uniform float normalStrength:hint_range( 0.0, 5.0) = 1.0;
|
||
|
|
uniform sampler2D normalTexture:hint_normal, repeat_enable, filter_linear_mipmap_anisotropic;
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
// [ O C C L U S I O N ]
|
||
|
|
group_uniforms occlusion;
|
||
|
|
|
||
|
|
uniform float occlusion:hint_range( 0.0, 1.0) = 1.0;
|
||
|
|
|
||
|
|
uniform float occlusionOffset:hint_range( -1.0, 1.0) = 0.0;
|
||
|
|
uniform sampler2D occlusionTexture:hint_default_white, repeat_enable, filter_linear_mipmap_anisotropic;
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
// [ R O U G H N E S S ]
|
||
|
|
group_uniforms roughness;
|
||
|
|
|
||
|
|
uniform float roughness:hint_range( 0.0, 1.0) = 1.0;
|
||
|
|
|
||
|
|
uniform float roughnessOffset:hint_range( -1.0, 1.0) = 0.0;
|
||
|
|
uniform sampler2D roughnessTexture:hint_default_white, repeat_enable, filter_linear_mipmap_anisotropic;
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
// [ M E T A L L I C ]
|
||
|
|
group_uniforms metallic;
|
||
|
|
|
||
|
|
uniform float metallic:hint_range( 0.0, 1.0) = 0.0;
|
||
|
|
|
||
|
|
uniform float metallicOffset:hint_range( -1.0, 1.0) = 0.0;
|
||
|
|
uniform sampler2D metallicTexture:hint_default_white, repeat_enable, filter_linear_mipmap_anisotropic;
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
// [ S P E C U L A R ]
|
||
|
|
group_uniforms specular;
|
||
|
|
|
||
|
|
uniform float specular:hint_range( 0.0, 1.0) = 0.5;
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
void vertex()
|
||
|
|
{
|
||
|
|
|
||
|
|
UV = UV; UV = UV * UV_scale + UV_offset + TIME * UV_scrolling;
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
void fragment()
|
||
|
|
{
|
||
|
|
|
||
|
|
vec4 sampledAlbedo = texture( albedoTexture, UV );
|
||
|
|
ALBEDO = sampledAlbedo.rgb * albedo.rgb;
|
||
|
|
|
||
|
|
vec4 sampledAlpha = texture( alphaTexture, UV );
|
||
|
|
ALPHA = sampledAlpha.r * alpha;
|
||
|
|
|
||
|
|
|
||
|
|
float advancedFresnelFadingAlpha = clamp01( fresnelNormalizedFromViewAdvanced( NORMAL,
|
||
|
|
advancedFresnelFadingZOffset,
|
||
|
|
advancedFresnelFadingPower,
|
||
|
|
advancedFresnelFadingPostScale,
|
||
|
|
advancedFresnelFadingPostOffset
|
||
|
|
) );
|
||
|
|
|
||
|
|
if ( ! advancedFresnelFadingInverse )
|
||
|
|
{ advancedFresnelFadingAlpha = 1.0 - advancedFresnelFadingAlpha; }
|
||
|
|
|
||
|
|
ALPHA *= advancedFresnelFadingAlpha;
|
||
|
|
|
||
|
|
float advancedFresnelFadingAlpha_2 = clamp01( fresnelNormalizedFromViewAdvanced( NORMAL,
|
||
|
|
advancedFresnelFadingZOffset_2,
|
||
|
|
advancedFresnelFadingPower_2,
|
||
|
|
advancedFresnelFadingPostScale_2,
|
||
|
|
advancedFresnelFadingPostOffset_2
|
||
|
|
) );
|
||
|
|
|
||
|
|
if ( ! advancedFresnelFadingInverse_2 )
|
||
|
|
{ advancedFresnelFadingAlpha_2 = 1.0 - advancedFresnelFadingAlpha_2; }
|
||
|
|
|
||
|
|
ALPHA *= advancedFresnelFadingAlpha_2;
|
||
|
|
vec4 sampledNormal = texture( normalTexture, UV );
|
||
|
|
NORMAL_MAP = sampledNormal.rgb;
|
||
|
|
NORMAL_MAP_DEPTH = normalStrength;
|
||
|
|
|
||
|
|
vec4 sampledOcclusion = texture( occlusionTexture, UV );
|
||
|
|
AO = sampledOcclusion.r * occlusion + occlusionOffset;
|
||
|
|
|
||
|
|
vec4 sampledRoughness = texture( roughnessTexture, UV );
|
||
|
|
ROUGHNESS = sampledRoughness.g * roughness + roughnessOffset;
|
||
|
|
ROUGHNESS = clamp01( ROUGHNESS );
|
||
|
|
|
||
|
|
vec4 sampledMetallic = texture( metallicTexture, UV );
|
||
|
|
METALLIC = sampledMetallic.b * metallic + metallicOffset;
|
||
|
|
|
||
|
|
|
||
|
|
}
|