[SOLVED] Fresnel material issues

Hi,

Some weeks ago I created a material to simulate a velvet for an app by following the instructions in this post:

I was satisfied with the result with some tweaking.

I reopened it today to apply some changes on the app, but it’s seems like recent updates bugged that the process to make the fresnel broken.
My material is totally blasted like if I had put an emissive map on it, but I didn’t.


On the left is what I had some weeks ago, and on the right is what I have now; no settings have been edited between the two.

And here are my settings:


FresnelSettings

I suspect it might be a bug introduced in a recent update; could anybody at playcanvas look into it?

Thanks!

Would you be able to share some very basic project that can reproduce this?

Here is a scene with almost same settings (I cannot share diffuse map, but the result is same):
https://playcanvas.com/project/882921/overview/fresnel-test
I hope this can help!

Thanks!
Calling @slimbuck to investigate this one. He’s on leave this week though.

1 Like

Hi @DevEdge,

In previous versions of the engine we were applying scene intensity to the material’s overridden sphereMap & envMap. This was fixed in 1.52 and so in your example the sphere is white because it no longer is being multiplied by the scene intensity of 0.01.

Material’s “Environment” settings should have its own “Intensity” setting for this. Hopefully we could add this soonish.

Until then you could override this and this chunk by multiplying the calculated reflection by 0.01.

Thanks!

2 Likes

Thank you for getting back to me so shortly!
Unfortunately we do not have the coding experience to edit the necessary source code as you suggested.

Can we count on a hotfix in the near future? [2weeks]
It would be very important to us as we have a project delivery depending on this issue.

Thanks!

Added this as an engine ticket: https://github.com/playcanvas/engine/issues/4033

1 Like

Hi @DevEdge,

Thanks for adding the issue @yaustar!

It’ll take some time to add override intensity, but I’ll try russle up a script-based fix for you today.

Thanks!

Thank you for your top of the line support; it is much appreciated!
I will be looking forward to testing this script.

No worries @DevEdge, I’m sorry we broke your project.

I’ve added a script to the root node of https://playcanvas.com/project/883400 (which is just a fork of your test project) that fixes the issue in your case. It’s not a great solution and may stop working in future, but should tide you over for now.

The script just updates the envConstPS shader chunk as follows:
pc.shaderChunks.envConstPS = pc.shaderChunks.envConstPS.replace('return color;', 'return color * 0.01;');

I’ve realised we actually need to address the underlying environment intensity issue otherwise it will likely crop up again for our users.

Thanks!

2 Likes

The script works like a charm!!
Thank you so much for this quick fix, I’ve never seen software developers react so quickly, I cannot be grateful enough.

2 Likes