How to achieve Fresnel shading?

he … atm i’m releasing a series of captures from a VR experience i made in unity a few years ago :

i was thinking about porting the whole thing to playcanvas (it’s 9 scenes similar to the two you can find on youtube). the only thing i’d need to make this happen is a fresnel shader (could also work with decent matcap though) … did some test with cubemaps and cranking up specular/gloss but wasn’t satisfied with the results. so if there is anyone able to help me i’d go through the whole process rebuilding the whole experience in PC …



Any thoughts @ray?

1 Like

@rtz23 - you should be able get a good exaggerated fresnel effect using a Sphere Map and playing with specular and reflectivity values - heres screen grab of a quick experiment I did:

I used an asset from a PlayCanvas tutorial project: - hopefully you should be able to tune the gradient in the SphereMap to your needs.


@ray nice. i like. seeing this i must say that i did not intuitivly understandd how those sphere maps in pc are supposed to work. i always thought it was another option instead of using a cubemap and was not happy with the results (rendering spherical environments) … looks more as if it could be used like matcaps now that i see it. the only downside is that it rather looks like a reflection as soon as it is in motion. but still good enough …

first try looked like this:

so i guess now i have to start. look forward to ‘swimming with waterbears’ in webXR …




so played around with the approach a bit more and realized it’s not gonna work. as said in the end it is visible as a reflection. and then it is important to have a crisp high frequency (detail) normal map to achieve this scanning electron microscopy look.
leads to noise when sphere map is getting distorted by texture details. check this out:

first solution i came in touch with years ago (using 3dsmax scanline renderer) was fresnel and this is why i made the unity version of it as soon as i found a fresnel shader.

so i could live with the reflective character though i’d need a solution for the noise, which i don’t see.

maybe it’s rather swimming with dolphins then :stuck_out_tongue:

@ray btw noise artifacts i talk about are also visible in your screenshot

@ray hmm ok … i could improve it by adjusting the sphere map and making the gradient softer… which still takes a bit from the effect. but the noise is still but less visible…

Try to see if enabling the anisotropic filtering on that sphere map helps … give is a higher level of anisotropy as well.

But if you still have that shader you used before, it might be reasonably easy to just port it as is?

omg… it’s a slider. i never got how that anisotropy option should work … but brings in more value. awesome. good advice… i’m not into shaders - this is why i asked for collab/assistance in the first place. noise looks much less annoying now. it is not completly avoidable though. but i really think it looks close to how it should in the end now. so maybe no shader hussle necessary …

1 Like