Page 1 of 1

Interaction with 3D UI

Posted: 16 Aug 2021, 19:33
by krupitskas
Hey!
Im working on 3d text tool and recently struggled with rendering. Right now struggling with selection (clicking).
Basically Im rendering whole view with custom matrix
_view_3d_text->GetRenderer()->Render(prod);
Now I need to understand when anyone select text and highlight it

I've tried this:
  
    _temp_text_block->PreviewMouseLeftButtonDown() +=
        [canvas_text_tool](Noesis::BaseComponent* , const Noesis::MouseButtonEventArgs& ) {
            spdlog::info("clicked");
    };
   
This is Noesis::TextBlock, which accept canvas. Works nice when no matrix provided.
When matrix is provided, then clicking region isn't change (nothing renders there, but click callback works).
Also I've thought that Render(matrix) doing immediate calculations, so I've tried
    _view_3d_text->SetProjectionMatrix(prod);
Also no luck.

Checked Oculus example (can't run it though). Didn't saw anything special, same Render(matrix).

So what am I doing wrong?

Thanks.

Re: Interaction with 3D UI

Posted: 17 Aug 2021, 12:34
by jsantos
The projection matrix passed to SetProjectionMatrix is used internally for all hit-testing calculations. Please confirm all events sent to IView are in the (0,0) - (view_width, view_height) range.

Indeed, you need to use SetProjectionMatrix. The alternative of passing the matrix to Render() was created to allow changes at render time (for example for rendering each eye in VR). By the way, inputs from each hand in VR is something we don't have implemented yet, at least without using "hacks" like changing the projection matrix before sending events for each hand. We need a better solution for that, but I would say this is not your case.

Re: Interaction with 3D UI

Posted: 23 Aug 2021, 10:04
by krupitskas
The projection matrix passed to SetProjectionMatrix is used internally for all hit-testing calculations. Please confirm all events sent to IView are in the (0,0) - (view_width, view_height) range.
Yes, without this range text not even beign rendered for me.
Still no luck to be able to click on text with custom 3d matrix provided.

Re: Interaction with 3D UI

Posted: 23 Aug 2021, 10:13
by krupitskas
For simplicity I've added just 3 small radiobuttons, which works fine if not SetProjectionMatrix called (rendered in 2d, clickes fine).
If I provide my matrix, then radibuttons start moves with camera, but not working anymore.
In fact, radiobuttons and text still beign clicked in 2d space.
Please note that I set my projection matrix every frame, because my view matrix changed. Should it be done only once or maybe callbacks reattached?

Re: Interaction with 3D UI

Posted: 23 Aug 2021, 10:46
by krupitskas
I feel like SetProjectionMatrix of IView only affects rendering. Should I use another object to set matrix for the hit test?
btw we still using 0.3.0.

Re: Interaction with 3D UI

Posted: 23 Aug 2021, 16:38
by sfernandez
Could you please create a ticket in our bugtracker? If that is not working it means there is a bug we need to fix.

Re: Interaction with 3D UI

Posted: 24 Aug 2021, 09:32
by krupitskas

Re: Interaction with 3D UI

Posted: 26 Aug 2021, 13:02
by sfernandez
Thanks for the report, we'll fix it as soon as possible.

Re: Interaction with 3D UI

Posted: 30 Nov 2021, 08:02
by krupitskas