User avatar
krupitskas
Topic Author
Posts: 23
Joined: 16 Apr 2021, 17:42

Interaction with 3D UI

16 Aug 2021, 19:33

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.

Tags:
 
User avatar
jsantos
Site Admin
Posts: 3311
Joined: 20 Jan 2012, 17:18
Contact:

Re: Interaction with 3D UI

17 Aug 2021, 12:34

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.
 
User avatar
krupitskas
Topic Author
Posts: 23
Joined: 16 Apr 2021, 17:42

Re: Interaction with 3D UI

23 Aug 2021, 10:04

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.
 
User avatar
krupitskas
Topic Author
Posts: 23
Joined: 16 Apr 2021, 17:42

Re: Interaction with 3D UI

23 Aug 2021, 10:13

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?
 
User avatar
krupitskas
Topic Author
Posts: 23
Joined: 16 Apr 2021, 17:42

Re: Interaction with 3D UI

23 Aug 2021, 10:46

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.
 
User avatar
sfernandez
Site Admin
Posts: 2417
Joined: 22 Dec 2011, 19:20

Re: Interaction with 3D UI

23 Aug 2021, 16:38

Could you please create a ticket in our bugtracker? If that is not working it means there is a bug we need to fix.
 
User avatar
krupitskas
Topic Author
Posts: 23
Joined: 16 Apr 2021, 17:42

Re: Interaction with 3D UI

24 Aug 2021, 09:32

 
User avatar
sfernandez
Site Admin
Posts: 2417
Joined: 22 Dec 2011, 19:20

Re: Interaction with 3D UI

26 Aug 2021, 13:02

Thanks for the report, we'll fix it as soon as possible.
 
User avatar
krupitskas
Topic Author
Posts: 23
Joined: 16 Apr 2021, 17:42

Re: Interaction with 3D UI

30 Nov 2021, 08:02

Who is online

Users browsing this forum: Google [Bot] and 1 guest