Download

Shader - Fresnel from point on screen and vertexnormal?

Hi! I am in the process of creating shaders for a stylized scene and am struggling with a cylindrical metal highlight portion of the material. I am attempting to recreate the metalrailing from this concept by Eugene Bright

I’ve tried doing different forms of fresnel, and dotproducts between a raytrace and vertexnormals in different coordinate spaces, but they all have the same issue with gradient depending on slope/depth/etc.

I’ve pretty much concluded that I have to do a 2D comparison between something like a point on the screen with the vertexnormal to get the desired effect, but I haven’t been able to figure out how to do such a comparison. So I’m looking here to see if anyone could push me in the right direction :slight_smile: For starters - how do I specify a point on the screen in the material editor?

First time poster, so I hope it’s the right place and stuff.

What’s wrong with just increasing the metallic?

EDIT: I’m thinking that might not give you the stylized effect, but it is still probably easier to use metallic and then a postprocess.

Hmm, I don’t think using metallic would do it for me. I want to use the fresnel to create banding, and the banding shouldn’t be fading in and out, so therefore I think it needs to use a 2D comparison. But how would you combine metallic and postprocess for such an effect?

Now that, I’m not sure of. But I know that if I was going for stylized, getting to know post process would be my main focus.

Problem with fresnel, is it depends on where the camera is, this shine on the railings depends on where the light is.

I use postprocess to drive a lot of my shaderlogic, and I do think it’s a good option for this shader as well, but I need the information to pass onto the shader which is the step I’m struggling with. The fresnel indeed depend on the camera, which is why I thought if I somehow converted the dotproduct to be “flat” on the screen (2D), then the effect would be static even if there’s an angle compared to the normal 3D dotproducts.

Thanks for your input, greatly appreciated :slight_smile:

Edit: For clarification, I already use the lightvector for one part of the shader, but the highlights seem to be stronger when facing the camera/middle of the screen.

I don’t know that much about it, but the default post process node will contain the scene colour, which for metallic will have the highlights in the right place to put through the PP shader.

Update: Using the binormal as the axis in AxisAlignedFresnel seemed to do the trick. All these hours spent reading and testing trigonometry for it to be that simple…

1 Like