How to display 3d models?

mc 3,726 Reputation points

I want to display 3d models in xamarin.forms.

you may say I could use urhosharp . yes but it only support one scene at the same time which means I can only display 1 items .

what I want to do is write a custom view which display the 3d model so that there can be many views which is 3d.

A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,301 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 69,386 Reputation points Microsoft Vendor


    Welcome to our Microsoft Q&A platform!

    If you use urhosharp to load 3D models, you do not need to create a custom view,Install UrhoSharp.Forms in your platform and PCL projects. Put urhosharp to <StackLayout> and use <ScrollView> to contains that like following code.

       <ContentPage xmlns=""  
                    xmlns:x="" xmlns:urho="clr-namespace:Urho.Forms;assembly=UrhoSharp.Forms"  
                       <urho:UrhoSurface x:Name="HelloWorldUrhoSurface" HorizontalOptions="FillAndExpand" HeightRequest="300"/>  
                       <urho:UrhoSurface x:Name="HelloWorldUrhoSurface2" HorizontalOptions="FillAndExpand" HeightRequest="300"/>  
                           <urho:UrhoSurface x:Name="HelloWorldUrhoSurface3" HorizontalOptions="FillAndExpand" HeightRequest="300"/>  

    Here is layout background code.

       public partial class MainPage : ContentPage  
               public MainPage()  
               protected override async void OnAppearing()  
                   await HelloWorldUrhoSurface.Show<HelloWorld>(new Urho.ApplicationOptions(assetsFolder: null) { Orientation = ApplicationOptions.OrientationType.LandscapeAndPortrait });  
                   await HelloWorldUrhoSurface2.Show<HelloWorld>(new Urho.ApplicationOptions(assetsFolder: null) { Orientation = ApplicationOptions.OrientationType.LandscapeAndPortrait });  
                   await HelloWorldUrhoSurface3.Show<HelloWorld>(new Urho.ApplicationOptions(assetsFolder: null) { Orientation = ApplicationOptions.OrientationType.LandscapeAndPortrait });  

    Here is HelloWorld.cs.

       using Urho;  
       using Urho.Actions;  
       using Urho.Gui;  
       namespace Urho3DDemo  
           public class HelloWorld : Application  
               //public HelloWorld() { }  
               public HelloWorld(ApplicationOptions options) : base(options) { }  
               protected override async void Start()  
               private void CreateText()  
                   // Create Text Element  
                   var text = new Text()  
                       Value = "Hello World!",  
                       HorizontalAlignment = HorizontalAlignment.Center,  
                       VerticalAlignment = VerticalAlignment.Center  
                   text.SetFont(font: ResourceCache.GetFont("Fonts/Anonymous Pro.ttf"), size: 30);  
                   // Add to UI Root  

    Here is running screenshot.


    Best Regards,

    Leon Lu

    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

0 additional answers

Sort by: Most helpful