Jump to content
  • Advertisement
Sign in to follow this  

(Hex)Shape-Pattern Shading?

This topic is 1216 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The goal here is to create an overlay effect which is aware of, ideally with a shader, which is specific to a series of shapes.

The idea is to only render hexes when a masking overlay completely envelopes the hex, like so:


...where the green dots represent hexes that would be filled and red represent partial hexes that could either be filled or ignored (either way/whichever is easier).

I've considered using a mask pre-chunked into hexes and clamping the uv position to 'tile-sized' increments, but aside from that feeling kind of hacky / unclean / error-prone, it'd be really nice to be able to use this with masks based off of other effects (like an explosion effect or distortion wave).

I've tried Googling this but haven't had much luck, and honestly I'm not sure what to look for or even what to call this. Does anyone have any experience with a similar effect or can point me in the right direction?


Share this post

Link to post
Share on other sites

You know, at first it looked like a noise mask (tiny hexes and very smooth), but I think this is actually it!

If you replace line 214 with:

vec3 col = vec3(1, 1, 1)-fbm(vec2(uv.x-time*28.0, uv.y)*0.008);

and change the hex size on line 47 to:
const float hexSize = 80.0;

You can see harsh color differences between the hexes. Of course, it needs a good bit of refactoring and I have to actually figure out what all it's doing but... still, having a reference point is huge. I'm floored, thanks so much! +1
Looking through the site, I think this is actually a little closer to my target effect. I had no idea this site even existed. Shaders have always been black magic to me and I recently decided to take the leap, this is going to be a huge help.
Edited by Natom

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!