felixmariotto / three-mesh-ui

⏹ Make VR user interfaces for Three.js
https://felixmariotto.github.io/three-mesh-ui/#basic_setup
MIT License
1.31k stars 138 forks source link

Text not showing on XRviewer browser IOS #178

Open dromerolovo opened 2 years ago

dromerolovo commented 2 years ago

So, I have this basic ThreeMeshUI.Block

const menu = new ThreeMeshUI.Block( {
        width: 1.2,
        height: 0.5,
        padding: 0.05,
        justifyContent: 'center',
        textAlign: 'left',
        fontFamily: FontJSON,
        fontTexture: FontImage
    });

    const text = new ThreeMeshUI.Text({
        content: "Some text to be displayed",
        fontSize: 0.1
       });

    menu.add(text);
    menu.position.set(0, 0.3, -1.8);
    menu.scale.set( 1, 1, 1);
    menu.rotation.x = -0.55
    scene.add( menu );

It works fine on a Web XR emulator in chrome

image

But when I test it on mobile(IOS) using XRViewer browser it only shows the black block without the text.

image0

Any known reason for this?

Appreciate the help.

swingingtom commented 2 years ago

@dromerolovo thanks for reporting this !

I can't have a look right now, but I will. In the meanwhile, do you have any other informations to share? Is the console free of warnings and/or errors ?

Current guesses are :

If you could add the following in your code, and tells us what happend it could ease our way out ?

// each time your text component is updated
text.onAfterUpdate = function(){

    // be sure it has children merged glyphs
    if( text.children.length > 0 ){

        // change the glyphMaterial for a standard one
        text.children[0].material = new MeshBasicMaterial({color:0xff9900});

    }
}

If the following snippet ( once adapted to your code ) shows orange planes, the error could come from the shader side

swingingtom commented 2 years ago

Hey @dromerolovo , any update on this issue ?

dromerolovo commented 2 years ago

@swingingtom I haven't had time to check it out, but as soon as I have some time I will comment the update of this issue, most probably whis weekend.

swingingtom commented 2 years ago

Thats an old topic but maybe this can be related #50