billboardMode on a gltf assets doesn't works as it should

#1

I have 3D scene containing a plane expected to be billboarded once in BJS.

Mesh is oriented Y forward inside Blender, as I always did when dealing with billboards (except for .babylon export where it should be Y backward facing)

But as you can see in this playground, billboard object is totally broken.

From this answer I start thinking there is a parent relation issue somewhere but it looks like un-intuitive.

There is a workaround but not very convenient (even by creating a parent dummy), especially:

  • if you have to deal with dozens of billboard meshes
  • if you want preserve your scene hierarchy to keep things clear

So, is this a bug or a feature ? :-p

0 Likes

Wrong billboard position when it's child
#2

Definitely a bug…Working on it

0 Likes

#3

Ok I introduced a new property:

billboardMesh.preserveParentRotationForBillboard = true;

This will help saving parent rotation when dealing with gltf file (as parent rotation helps converting from right handed to left handed)

0 Likes

#4

Fix will be in next nightly

1 Like

#5

You rox, thanks!

0 Likes

#6

Fixed :wink: https://playground.babylonjs.com/#SXM8I2#4

1 Like

#7

Actually I reopen the bug: at the moment you play with the billboard parent rotation, things continues to go wrong

https://playground.babylonjs.com/#SXM8I2#5

0 Likes

#8

This is expected…Parent rotation is NOT supposed to work. The option I added was only to help supporting gltf vertical inversion.

I would recommend that you do not change parent rotation at all

0 Likes

#9

Hmm, I still think that’s a weird behaviour: a billboard should be shown as a billboard no matter if it’s child or parent of an other element isn’it?

0 Likes

#10

Yes but we are also in a realtime environment and the system cannot spend too much cycles blocking all the hierarchy rotations :slight_smile:

0 Likes

#11

Shouldn’t be the user who decide if using performance-cost billboarding is alright or not?

Actually here my current usecase where I’m stuck: I have a globe, and some keypoints on it. These keypoints are custom meshes (not just planes).
They have some text on it, and that’s why they have to be read with mesh facing the screen ; I can’t use GUI 'cause artists have to be able to modify keypoints layout without having to see a bit of code (anyway it will be too difficult to code this GUI rather than using a 3D modeler).

Here a playground which reproduce this usecase: https://www.babylonjs-playground.com/#WC7IJG#4
My billboards works… but not rotate with the earth. If I attached them to a dummy, parented to the globe, same issue. If I set preserveParentRotationForBillboard, they’re not acting as billboards anymore.

For now I don’t see a solution to get rid of this limitations :dizzy_face:

0 Likes

#12

Here is the trick:

  • create dummies
  • do not parent your billboards
  • registerOnBeforeRender: set billboard.position = dummy.position
0 Likes

#13

ok thanks, I will try that.

0 Likes

#14

For those interested, here the trick: https://www.babylonjs-playground.com/#WC7IJG#6

I’m still doubtful about the fact that a mesh set as a billboard doesn’t act as a billboard, IMO it have to act as this no matter its situation :no_mouth: At least this restriction have to be mentionned in the doc & API.

0 Likes

#15

I’m not satisfied either by the situation but I did not find a fast way to support parent rotation.
Agree about the Doc. Fancy doing a PR?

0 Likes

#16

Yep as soon as possible, but I currently doesn’t have enough spare time, but I take note to add this asap :wink:

1 Like

#17

Playground update: actually if you want keep your hierarchy readable (especially in the Inspector) you’re able to use a transformNode (without any transforms) as parent for your billboards https://www.babylonjs-playground.com/#WC7IJG#7

1 Like