Hello,
I’ve encountered an issue with the shadowOffset of BABYLON.GUI.TextBlock.
I have setup my GUUI for my scene as an AdvancedDynamicTexture. I have set an ideal width and height for it to scale the UI properly when resizing the canvas. Now, as I make the canvas smaller, the shadow offset doesn’t seem to scale with the text - it get’s further away the smaller the text gets.
Is this an issue with the engine or am I just misunderstanding how AdvancedDynamicTextures work?
I created a small playground to reproduce the issue: https://playground.babylonjs.com/#WB1J4Y#1
Thanks in advance!
1 Like
Hi @dinutaleanu, welcome to the forum, and thanks for asking this question! I’m looking into it now, and appreciate that you supplied a playground with your question.
OK @dinutaleanu, I’m done investigating, and I believe you found a bug! When using the adaptive scaling feature (ideal width and height), all pixel values are supposed to be scaled, but the shadowOffsetX and shadowOffsetY values were not.
I’ve got a fix in this PR: GUI 2D: Fix shadowOffsetX and shadowOffsetY to respect adaptive scaling by AmoebaChant · Pull Request #17377 · BabylonJS/Babylon.js · GitHub
FYI: I tried a little workaround in Babylon.js Playground where I modify shadowOffsetX and shadowOffsetY to account for idealRatio (that’s the ratio of how the current size compares to the ideal size). This isn’t the real fix, because we wouldn’t want shadowOffsetX and Y to change based on the adaptive scaling, but it does simulate the results of the real fix.
Thanks again for reporting this!
1 Like