Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- import ARKit
- class EffectNodeHelper {
- static func getAlphaShader() -> SKShader {
- return SKShader(source: """
- void main() {
- vec2 texCoords = v_tex_coord;
- vec2 colorCoords = vec2(texCoords.x, texCoords.y);
- vec2 alphaCoords = vec2(texCoords.x, texCoords.y);
- vec4 color = texture2D(u_texture, colorCoords);
- float alpha = texture2D(u_texture, alphaCoords).r;
- gl_FragColor = vec4(color.rgb, alpha);
- }
- """)
- }
- }
Add Comment
Please, Sign In to add comment