dotnet / Microsoft.Maui.Graphics

An experimental cross-platform native graphics library.
MIT License
683 stars 61 forks source link

Is it possible to use MAUI as a 3D GUI? #348

Open MiheevN opened 2 years ago

MiheevN commented 2 years ago

I need to render MAUI inside or on top of 3D space, as well as in the form of 3D textures - widgets. Like in game engines. Is it even possible with this project.

For example, there is Veldrid, and the corresponding theme: https://github.com/mellinoe/veldrid/issues/443 Where I was advised to apply here again

Maybe someone can tell me which projects I should study, for example Microsoft.Maui.Graphics.Blazor Microsoft.Maui.Graphics.Skia But so far I don’t understand at all how to get a rendered image, which can be displayed simply in a picture, and thrown into a render.

You can count my skills as 0, explain like a baby, but the zeal is endless. Since I definitely need a 3D GUI

Timmoth commented 2 years ago

Its not suitable for 3d graphics, of course its possible to rasterize a 3d image onto a canvas pixel by pixel using your own renderer but this wouldn't be taking advantage of your GPU and would be very inefficient (and complicated). You'll be better off learning openGL then using something like Veldrid or Silk.

Best of luck.

MiheevN commented 2 years ago

@Timmoth I already use Veldrid! What is written in the post. But UI and 3D graphics are two different things...

How exactly do you suggest that I effectively draw buttons, forms, tables, etc.?

I'm looking for a method that allows me to create an interface plane, display images from it, and enter keystrokes and mouse clicks.

Timmoth commented 2 years ago

What exactly do you mean by a 3d gui?

If you are talking about rendering a user interface in a 3d environment you could look at something like imgui? (Note there's a imgui wrapper in silk .net)

MiheevN commented 2 years ago

@Timmoth Yes, ImGui creates an interface, but a primitive one. It doesn't suit me at all, unfortunately.

But Need limitless complexity, Blazor is perfect for the moment.

Requires NOT LESS than an interface similar to that of a website.

Timmoth commented 2 years ago

Why not use html / css then?

MiheevN commented 2 years ago

But how? what libraries? what methods? what will the code look like? there are examples? After all, Blazor is Html+Css+JS...

Timmoth commented 2 years ago

I'm afraid I think your asking in the wrong place for that! Maui graphics is for rendering 2d graphics onto a canvas, if you are after creating a nice interface I'd recommend looking at a css library like bootstrap or tailwind. It is possible to achieve 3d looking results in css - a quick search showed this showcase https://bashooka.com/coding/css-3d-design-examples/

Timmoth commented 2 years ago

@MiheevN, I've created a simple demo app that shows how you might achieve some 3D graphics on a canvas - whilst it is possible - it is extremely inefficient (does not take advantage of the GPU for all the matrix operations) not to mention alot of hard work for complex scenarios!

image

Maui Graphics 3d Demo

MiheevN commented 2 years ago

@Timmoth Also a good and useful example, which will undoubtedly come in handy. Thank you!

But unfortunately not exactly what I need.

I already think that I just need planes for the Blazor Site / MAUI render.

Once again thoroughly, WHAT IS REQUIRED:

  1. Object similar to

    UI_Instance.MoveCursor(10,20);
    UI_Instance.SendMouseEvent(Events.LeftMousePress);
    Span<Rgba32> CurrentFrameImage = UI_Instance.Render();
  2. The ability to OVERLAY the interface on top of 3D, and not just render inside. But it solves Span Although Render inside will also be very useful. But it is desirable for him to be on the GPU. But it should be easy when the first thing is decided.

  3. Infinity of instances. For example, a lot of cubes = textures, and on the plane of each there is its own Interface Instance.

  4. The ability to open websites just as easily. What makes it possible to simply make a Browser Object, and run a Blazor Instances inside...