Engine Release v1.35.2

Engine v1.35.2 has been released. Release notes:

Twitter announcement: https://twitter.com/playcanvas/status/1321097186864730112
Facebook announcement: https://www.facebook.com/playcanvas/posts/3953362291358225

To stay updated on engine development, hit Watch on the repo. Support us by hitting Star too! :smiley:

11 Likes

How do we access the specular fade option? Is this accessible through the editor, or only through code?

Only through code right now. Next step is to expose it in the Editor.

1 Like

Good to know. Thank you!

From the example, this appears to be the attribute to set:

material.opacityFadesSpecular = false;

Or set it to “true”
Based on the description, it would seem that fading specular out would be the default, though I’m not sure.

Added a material flag to disable material opacity fading out specular and added a value to specifically alpha fade out materials (including specular) - plus example (#2489)

I don’t understand the meaning of “added a value to specifically alpha fade out materials.”
Doesn’t the .opacity value already do that? What is the distinction that I’m missing?

I’ll let @ray explain. :smile:

The reason for this change was that it was reported that specular was being incorrectly affected by material opacity - making it difficult to render correct looking shiny translucent materials such as glass. It was also known that material opacity is also sometimes used to fade in or out objects - and when fading in or out objects, it is expected that the specular highlights on shiny objects are also faded in or out.

After some discussion, the solution implemented was to add a flag to prevent specular from being affected by material opacity if set to false, but set the flag default to true so that existing materials in existing projects continue to render as they did before the change. A new material value was added to allow objects to be faded in or out when specular is flagged to not be affected by material opacity.

Once the new material properties are exposed in the editor, it is likely that we will want to set the opacityFadesSpecular flag to false in newly created materials and recommend that if fading objects in or out in scripts, that the alphaFade value is used. For existing projects, if you wish to have un-faded translucent specular, you can set the opacityFadesSpecular to false and if you do fade in or out objects by changing the material opacity value in scripts, you can change the alphaFade value instead.

Hopefully this answer helps to clarify what was changed and why.

1 Like

It was always clear to me the reason for adding specular fade with opacity. But the announcement blurb seems to say that there are two new additions. If there are two new additions, I still don’t understand.

“Added a material flag to … and added a value to specifically alpha fade out materials” suggests two items, one Boolean and one with some numeric value (such as a new kind of opacity?). I read “flag” as Boolean and “value” as some variable. But I don’t see any such variable in the Spec Fade example code. On further search I did find alphaFade in the online documentation. Perhaps this is the “new material value” you mentioned? If so, why isn’t it used in the sample project and how is it used?

https://developer.playcanvas.com/en/api/pc.StandardMaterial.html#alphaFade

Anyway, that’s my confusion. Is there one thing or are there two things?

There are 2 new properties added, a flag and a value - the opacityFadesSpecular flag is the important one because it allows improved rendering of specular highlights on translucent materials (such as glass) if set to false - and this is shown in the engine example.

The alphaFade value is only needed to workaround a problem in a specific case where some projects will want to have improved rendering of specular highlights on translucent materials, but also will want to fade in and out objects that have translucent materials on - if you simply set the opacityFadesSpecular to true when fading you will get a ‘pop’ where specular highlights will suddenly change.

Both new properties will be exposed in the editor - we don’t have engine examples for all material properties - but as you mentioned, the documentation does describe how the alphaFade value relates to the opacityFadesSpecular flag.

And in the meantime, we can certainly consider adding an extra engine example to show fading of translucent objects using material opacity when the opacityFadesSpecular flag is true and using alphaFade when the opacityFadesSpecular is false.

1 Like

Thanks for taking the time to reply in depth. I really appreciate it. And if both are exposed in the editor, that will make life much easier for those of us more content oriented than programming oriented.

Forget the question below. It is a new specular that is added when a fill light it faded up. Doh!!!


BTW, is the odd specular behavior below related to these two new features? When the green plane is partially dissolved up in front of the helicopter, the specular on the lower front window changes - or more precisely it looks like a second specular highlight is added. It disappears when the plane is dissolved away. It comes and goes smoothly. There is no pop.


1 Like