• 2D
  • drawing 2D decals aka rendering nodes to framebuffer

Hello everyone.<br><br>I want to do something like this [ open spoiler ]:<br><br>

<img title="Image: http://s22.postimg.org/cts0om77l/final.png" alt="" src="http://s22.postimg.org/cts0om77l/final.png"><br>

<br>where level geometry is on the left, and the desired effect is on the right<br><br>So AFAIK I need to setup some texture buffer and shader for the "splatter" thing:<br><br>1) render my visible geometry ( TileMap ) to specific framebuffer as bw mask<br>2) then render the game level normally<br>3) use prev. created framebuffer to do some simple math in shaders to achieve "overlay" effect with decals.<br><br>Is that possible?<br><br>P.S. <br>Maybe it's a general shader question, but I'll post into 2D because I'm dealing with orthogonal stuff.<br><br>

Not sure if this is what you are looking for, but I wrote a shader to mask sprites, or any canvas item, by a single color.<br>I wrote the shader so that I could pull off a similar effect, so maybe it will work for you?<br>Here is a link to the question that holds the shader: link<br><br>I'm not certain on how you would get the visible geometry into a frame bufffer and convert it to a black and white mask, but outside of that, I think your setup is possible.<br><br>Hope this helps!

Hi there and thanks for the reply. <br><br>I think that your approach is very alike to what I want to achieve here but... I've got variable backgrounds and tile textures, actually. <br><br>So I can not color-mask those out ( it will require too much of uniforms or a fixed pallete within my assets ).<br><br>But the basic idea is the same, yes. <br><br>Thats why I'm thinking of creating a framebuffer with a bw mask in it - like it would be possible in a normal OpenGL application, for example. <br><br>Such technique would allow to get rid of the color variations inside the tiles.<br><br>And only then I'll be able to apply the same logic as you have prestented in your colormasking shader.<br>