Sign in to follow this  
who_knows

Creating a color mask with glsl

Recommended Posts

Hi, I've been creating textures for a soccer field to make the dark stripes on the grass. But i'd like to do it without texture, just with a grey color mask. Here is my soccer field : http://img571.imageshack.us/img571/9097/captures.png What i'd like to do is to use a texture with the same stripes (with blue and red stripes). When my shaders would find a blue pixel it could apply the grey color. Is it clear enough ? Thanks for your help.

Share this post


Link to post
Share on other sites
Would you like to blend a texture with underlying colours in the framebuffer?
Such as, multiplying this white and grey stiped texture with the soccer field?

You could just sample both textures with sampler2D,
and multiply each channel in the vec3 from both textures.
You could also do the lines and logos painted on the grass like this.

Edit: Just saw that the title of your post said "Mask". Naturally, you
can just have the GLSL program use the color from one texture if the mask
in that coordinate is blue, and the color from another texture if it's not.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this