Jump to content

Some Extras


havenphillip

1,435 views

 Share

Hello, fellow noobs. Hope you're doing well.

I have a few extra shaders I had wanted to get out to you earlier but couldn't because they weren't complete or they were a bit off-track. I have some more extras I want to add but here's a few for now.

I had wanted to do a multiple lights + alpha shader but it turned out to be a little trickier than I anticipated. I finally got it, though. Haven't tried this out in various situations but I doubt there will be any problem using this for whatever you might intend it for.

bpmlalpha.thumb.jpg.1bd7be10e4b69a2165f7e4ef066407c0.jpg

48a_multiple lights blinn-phong + alpha.zip

 

A kernels shader from LearnOpenGL. There's a sharpen, blur, and edge detect kernel included in the shader. You just have to comment or uncomment the sections depending on which you want to use. I also included a kernels post effects shader so you can use these as post effects as well. Actually all the post effect shaders I posted can be changed to model shaders. I'm just not sure whether that's something people might want. Maybe I'll do that next so we have them.

kernels.thumb.jpg.88b205b80b8705faaa37b4d54f3be2ae.jpg

01c_kernels.zip

 

This shader shows how you can add lighted areas to your shaders. I used the blur kernel here on a glow map to get a bit of a softglow effect. Nice thing about this is you can design your glow map to anything you want (provided you have a basic understanding of some texture editing program).

1047329764_softglow.jpg.26a2334d3ca087cf47f3ff210ff97a46.jpg

01b_softglow.zip

 

You know how sometimes you might find a cool rock in a creek that seems all colorful but then when you take it home and it dries out it's just a boring dry rock? I found a little trick for giving things that damp look. The whole of it is:

   float dampen = 0.3;

   outcolor += (-0.5 * dampen);

...that's it. It's a good trick for decreasing the brightness without sacrificing the colors. Increase the specular so it's nice and shiny and you get a pretty convincing noob "wet" look.

dampen.thumb.jpg.fd53d44470ef248eaf0879c462a8354c.jpg

01a_dampen.zip

 

Use this shader to get ambient occlusion out of your heightmap.

aoexample.thumb.jpg.ac16ac8fb25dff58236ce9d886bbb1c9.jpg

37a_ao from height.zip

 

I had wanted to add a 3D version of the bepuddled shader but it took awhile to get it to a place I was happy with. When the rain hit here I decided to finish it. There are a lot of variables you can tweak in both the evaluation and fragment stages to get it to your liking. I set them all to what I considered close to universal but tweak them all to your liking. Should be fairly easy to figure out how to use this one. There's a lot to it, though. It's kind of a long shader. I included the ambient occlusion shader from above in here, for instance. It's got six textures in play. I tried to use reference puddles from the internet but couldn't find too many good examples of how the mud color and the fresnel work together. But I think the skybox brightness is biased by the color of the mud in the puddle somewhat.

You can increase the "hillness" of the shader but keep in mind it won't affect collisions so probably best to keep them low. Also I wouldn't recommend this on a sloped surface because the puddles don't take the slope of the model into consideration (puddles on the side of a hill? The solution for this would be somewhere in the  slope blend shader [25_slope blend] but I had to call it here. Hours already into this).

You can see the heightmap is used for a lot of things here, including how the opacity of the puddle mud changes. And of course you can affect the mud brightness and hue. I've found that vec3(1.0, 1.0, 0.95) looks like a good mud color regardless of the brightness. I tried this with a lot of different textures and with a few adjustments each time it looks good. Included a 4x4 plane. Looks like the picture if you scale it to 30x1x30.

Notice also the dampen effect from above is used around the edges of the puddle areas:

puddle3d.thumb.jpg.ea297c68a90f3e9379cc8310bf245e83.jpg

41a_bupuddled + tessellation.zip

 

  • Like 7
 Share

1 Comment


Recommended Comments

Guest
Add a comment...

×   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.

×
×
  • Create New...