bvsemmer
Topic Author
Posts: 3
Joined: 29 Sep 2017, 15:59

Best approach to do custom render calls in Neosis

29 Nov 2017, 14:29

Hi,

I am currently investigating if it is possible to replace our current UI solution with Neosis UI. One feature that is heavily used by us are, what we call, CustomDraws. The idea is pretty simple: for some UI elements we handle the rendering ourselves (for example to render a custom 2D grid mesh with our own shaders).

In your samples you have an example where a RenderTarget is used as input. This is a fine approach, but there are some specific cases where this will not work for us and where we would like to render a custom 2D mesh instead. I noticed the UIElement::OnRender(Noesis::DrawingContext* drawingContext). I inherited from that, but OnRender is called only when the UI gets in a dirty state (for example when you hover your mouse over it).

This makes perfect sense performance-wise, but what is the best approach to force the rendering of that element each frame?
Also, since this is an evaluation I do not have any source code but it looks like all rendering calls are recorded in Neosis::DrawingContext, to be rendered later on the device thread? I cannot use this approach aswell since I want to render the object with our own shaders.

I expect to have more flexibility when I implement our own RenderDevice (I am currently using the default D3D11RenderDevice). But before I go on that road, I want to be sure this is the only way of handling this.

Any input on this would be greatly appreciated!

friendly regards
 
User avatar
jsantos
Site Admin
Posts: 1874
Joined: 20 Jan 2012, 17:18
Contact:

Re: Best approach to do custom render calls in Neosis

29 Nov 2017, 16:24

In your samples you have an example where a RenderTarget is used as input. This is a fine approach, but there are some specific cases where this will not work for us and where we would like to render a custom 2D mesh instead. I noticed the UIElement::OnRender(Noesis::DrawingContext* drawingContext). I inherited from that, but OnRender is called only when the UI gets in a dirty state (for example when you hover your mouse over it).
This makes perfect sense performance-wise, but what is the best approach to force the rendering of that element each frame?
The view exposes a rendering event you can hook to. At that point, you can invalidate yourself. Something like this:
void MyControl::OnConnectToView(IView* view)
{
    ParentClass::OnConnectToView(view);
    view->Rendering() += [this](IView*) { InvalidateVisual(); };
}
If you have time, I would like to know why the approach of injecting a RenderTexture that you fill with your engine and Noesis draws inside a XAML tree is not always a valid solution for you. We are these days exploring the architecture to support Effects and I think your point of view may be interesting.
Also, since this is an evaluation I do not have any source code but it looks like all rendering calls are recorded in Neosis::DrawingContext, to be rendered later on the device thread? I cannot use this approach aswell since I want to render the object with our own shaders.
The render architecture is described in this tutorial. Effectively all interaction with the RenderDevice happens in the render thread. But we don't create render threads off the record, the render threads is considered the render where you invoke RenderOffscreen and Render functions.

By the way, let us know if you need source code for the evaluation.

Thanks!
 
bvsemmer
Topic Author
Posts: 3
Joined: 29 Sep 2017, 15:59

Re: Best approach to do custom render calls in Neosis

01 Dec 2017, 14:50

Hi,

Thank you for your reply. I will have a try at it.

As for your question, I would prefer to discuss these outside of this forum. I do not see way to send a PM in this forum though. Is there another way to send you some questions/inquiries?

thanks a lot in advance.
 
User avatar
jsantos
Site Admin
Posts: 1874
Joined: 20 Jan 2012, 17:18
Contact:

Re: Best approach to do custom render calls in Neosis

04 Dec 2017, 11:56

As for your question, I would prefer to discuss these outside of this forum. I do not see way to send a PM in this forum though. Is there another way to send you some questions/inquiries?
Sure, please send email to info address. They will redirect it to me.
 
bvsemmer
Topic Author
Posts: 3
Joined: 29 Sep 2017, 15:59

Re: Best approach to do custom render calls in Neosis

04 Dec 2017, 16:20

Thank you, I have just done that.

Who is online

Users browsing this forum: No registered users and 3 guests