Simple dynamic holographic card effect ( foil )

Explanation tweet.

Foil effect with video I tweeted.

 

Dragon and Potion By Icongeek26

ffect video I twitted.https://twitter.com/thebasdagger/status/1414528156917194754?s=20

Shader code
shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_schlick_ggx;
uniform sampler2D texture_albedo : hint_albedo;
uniform float threshold = 0.1;
uniform float effect_alpha_mult : hint_range(0,1) = 1.0;
uniform float direction : hint_range(0,1) = 0.5;
uniform float specular = 1.0;
uniform float metallic : hint_range(0,1) = 0.75 ;
uniform float roughness: hint_range(0,1) = 0.75;
uniform float emission_energy: hint_range(0,1) = 0.2;
uniform sampler2D gradient: hint_albedo;
uniform sampler2D noise: hint_albedo;

void vertex() {

}

void fragment() {
	vec2 base_uv = UV;
	vec4 albedo_tex = texture(texture_albedo,UV);
	vec4 noise_tex = texture(noise,base_uv);
	vec4 gradient_tex = texture(gradient, vec2((0.25+(NORMAL.y*direction*2.0-NORMAL.x*(1.0-direction)*2.0)/2.0+(UV.y*direction+UV.x*(1.0-direction))/2.0), 0.0));
	ALBEDO = albedo_tex.rgb;
	ALPHA = albedo_tex.a;
	if(albedo_tex.r < threshold && albedo_tex.g < threshold && albedo_tex.b < threshold && albedo_tex.a > 0.3)
	{
		METALLIC = metallic;
		ROUGHNESS = roughness;
		SPECULAR = specular;
		ALBEDO = mix(ALBEDO, gradient_tex.rgb*(noise_tex.rgb*2.0), (effect_alpha_mult-length(ALBEDO))*gradient_tex.a*effect_alpha_mult);
		EMISSION =  ALBEDO*emission_energy;
	}
}
Tags
card, effect, foil, gradient, holographic, reflection, shine
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

Related shaders

Holographic Sight Reticle

Dynamic Depth of Field

simple trail effect

Subscribe
Notify of
guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
ilies
ilies
1 year ago

Can this be done in 2D (with extra modifications)