Jump to content

Alpha mask texture


Rick
 Share

Recommended Posts

There have been several shaders that use masks (in various capacities) - found within 5 minutes of searching for the keyword "mask".

I also remember shadmar having several posts in the past where he was using masks for 2D effects as well.

  • Haha 1

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

  • 3 weeks later...

this could easily be achieved by adding 3 lines of code to any diffuse shader you can find in LE.
for shadows you add the same lines of code in any shadow shader.

//In the Fragment stage of the shader add to //Uniforms
//You can use any texture slot you like
//I used 4 since 1 till 3 are diffuse,normal,specular
uniform sampler2D texture4;//Black and White map


//In the void main(void) method add somewhere at the top
vec4 alphamask = texture(texture4,ex_texcoords0);
//Check for pure black color and discard
if (alphamask.r == 0.0 && alphamask.g == 0.0 && alphamask.b == 0.0) discard;


NOTE: make sure the Vertex stage of the shader passes ex_texcoords0 to the Fragment stage but any diffuse+alphamask shader does this.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...