Pre loader

Tag: ObjectModel3D

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0 votes
3k views

I had great success using ObjectModel3D objects in my XAML file. However, I would like to dynamically add and remove objects based on user input. For this reason, I’ve switched to using codebehind.

private void PopulateScene()
      {
          List<Uri> bitmapImages = DataProcessor.bitmapImages();
          Uri textureSource = new Uri(@"C:\Users\Will\Desktop\lemon_yellow__85006.webp");
  
          var rotation = new Rotation3D()
          {
              Angle = 45,
              Axis = SciChart.Charting3D.Axis.Axis3D.YAxis
          };
  
          foreach(Uri bitmapImage in bitmapImages)
          {
              ObjectModel3D objectModel = new ObjectModel3D()
              {
                  TextureSource = new TextureSource(textureSource),
                  Source = new ObjectModelSource(new Uri(@"C:\Users\Will\Desktop\EarthTile.obj")),
                  Position = new Vector3(1, 0, 1),
                  CoordinateMode = ObjectCoordinateMode.Relative,
                  Scale = new Vector3(2, 1, 1),
                  Rotation = rotation
              };
  
              using (sciChart.SuspendUpdates())
              {
                  sciChart.SceneObjects.Add(objectModel);
              }
          }
      }
  

I get the correct model with the correct texture. However, setting the position, scale or rotation doesn’t seem to work. All objects are in the same place ((0, 0, 0), no matter the coordinate mode), at the same (1, ,1 ,1) scale, and facing the same direction. How

I also have this function;

private void ClearScene()
{
using (sciChart.SuspendUpdates())
{
sciChart.SceneObjects.Clear();
}
}

Even after the object is cleared from SceneObjects, it persists in the chart.

This leads me to my 2 questions;

  1. How do I get the objects I add to the chart to observe the
    transformational parameters I give it? I don’t need to change the
    parameters of objects after they’ve been added to the scene, just
    before.
  2. How do I remove objects from a scene?
0 votes
8k views

Hi, I want to rotate an ObjectModel3D with multiple axis of rotation.
But Rotation property of ObjectModel3D can set only one axis (X or Y or Z).
How can I solve this problem?
Thanks

0 votes
3k views

I created an ObjectModel3D object in ViewModel and bound it to View, but the Scale and Position values are not applicable.
What’s wrong with my code?

View:

<UserControl x:Class="Example.TestChart.Views.TestChartView"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         xmlns:local="clr-namespace:Example.TestChart.Views"
         xmlns:locals="clr-namespace:Example.TestChart.ViewModels"
         xmlns:s3D="http://schemas.abtsoftware.co.uk/scichart3D"
         mc:Ignorable="d" 
         xmlns:prism="http://prismlibrary.com/"
         prism:ViewModelLocator.AutoWireViewModel="True"
         xmlns:object="clr-namespace:SciChart.Charting3D.Visuals.Object;assembly=SciChart.Charting3D"
         d:DesignHeight="300"
         d:DesignWidth="300">


<Grid>
    <s3D:SciChart3DSurface x:Name="SciChart"
                   Grid.Column="1"
                   BorderThickness="0"
                   WorldDimensions="1000,500,500"
                   RenderableSeries="{s3D:SeriesBinding RenderableSeriesCollenction}"
                   SceneObjects="{Binding SceneEntity3Ds}"
                   Grid.Row="1"
                   >

        <s3D:SciChart3DSurface.Camera>
            <s3D:Camera3D 
                          Position="30,400,-1250"
                          Target="40,200,500"
                          />
        </s3D:SciChart3DSurface.Camera>

        <s3D:SciChart3DSurface.XAxis>
            <s3D:NumericAxis3D  AxisTitle ="X" 
                        TextFormatting ="n2" 
                        AutoRange = "Never" 
                        VisibleRange ="0,100" 
                        GrowBy =" 10, 10" 
                        FlipCoordinates="True"
                        TickLabelAlignment ="Camera" 
                        />

        </s3D:SciChart3DSurface.XAxis>
        <s3D:SciChart3DSurface.YAxis>
            <s3D:NumericAxis3D  AxisTitle ="Y" 
                        TextFormatting ="n2" 
                        AutoRange = "Never" 
                        VisibleRange ="0,100" 
                        GrowBy =" 10, 10" 
                        TickLabelAlignment ="Camera" />
        </s3D:SciChart3DSurface.YAxis>
        <s3D:SciChart3DSurface.ZAxis>
            <s3D:NumericAxis3D  AxisTitle ="Z" 
                        TextFormatting ="n2" 
                        AutoRange = "Never" 
                        VisibleRange ="0,100"
                        GrowBy ="10,10" 
                        TickLabelAlignment ="Camera" />

        </s3D:SciChart3DSurface.ZAxis>

        <s3D:SciChart3DSurface.ChartModifier>
            <s3D:ModifierGroup3D>
                <s3D:OrbitModifier3D ExecuteOn="MouseLeftButton"/>
                <s3D:MouseWheelZoomModifier3D />
                <s3D:ZoomExtentsModifier3D AnimateDurationMs="500" ResetPosition="-10,400,-850" ResetTarget="0,200,500"/>
            </s3D:ModifierGroup3D>
        </s3D:SciChart3DSurface.ChartModifier>

    </s3D:SciChart3DSurface>
</Grid>

ViewModel:

    namespace Example.TestChart.ViewModels
{
    using SciChart.Charting3D.Visuals.RenderableSeries;
    using System;
    using System.Collections.ObjectModel;
    using System.Windows.Media;
    using Example.BaseClass;
    using SciChart.Charting3D.Visuals.Object;
    using System.Reflection;
    using System.IO;
    using SciChart.Charting3D;


public class TestChartViewModel : ViewModelBase
{
    public TestChartViewModel() 
    {

        RenderableSeriesCollenction = new ObservableCollection<IRenderableSeries3DViewModel>();
        SceneEntity3Ds = new ObservableCollection<ObjectModel3D>();
        addr();
    }

    public void addr()
    {
        string filePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Objects\\Pawn_Low.obj");
        var obj = new ObjectModel3D(new Uri(filePath), Color.FromRgb(Convert.ToByte(255), Convert.ToByte(255), Convert.ToByte(0)))
        {
            Position = new Vector3(0.5f, 1f, 0.8f),
            CoordinateMode = ObjectCoordinateMode.Relative
        };
        obj.Scale = new Vector3(0.2f, 0.2f, 0.2f);
        SceneEntity3Ds.Add(obj);

    }

    private ObservableCollection<IRenderableSeries3DViewModel> _renderableSeriesCollenction;
    public ObservableCollection<IRenderableSeries3DViewModel> RenderableSeriesCollenction
    {
        get { return _renderableSeriesCollenction; }
        set { _renderableSeriesCollenction = value; }
    }

    private ObservableCollection<ObjectModel3D> _sceneEntity3Ds;
    public ObservableCollection<ObjectModel3D> SceneEntity3Ds
    {
        get { return _sceneEntity3Ds; }
        set { _sceneEntity3Ds = value; }
    }

}

}

1 vote
8k views

I followed the official example (SciChart_AddObjectsToa3DChart), created a simplest test program, copied the “King_Low.obj” file from the official sample program into my test program, but “King_Low.obj” did not show up, what is the problem?

0 votes
5k views

I have a 3D chart where we are loading .obj files. If I set the opacity on the element in Xaml it works. However, we want to be able to adjust the opacity with a slider. When we bind the opacity to the value of the slider the opacity does not change. Is there something else we need to do to get the opacity to change when the slider value changes? The slider has a minimum of 0 and a maximum of 1.

<s3D:SciChart3DSurface x:Name="ThreeDChart"
                           IsAxisCubeVisible="False"
                           IsFpsCounterVisible="False"
                           IsXyzGizmoVisible="True"
                           ShowLicensingWarnings="False">
<s3D:SciChart3DSurface.XAxis>
    <s3D:NumericAxis3D />
</s3D:SciChart3DSurface.XAxis>
<s3D:SciChart3DSurface.YAxis>
    <s3D:NumericAxis3D />
</s3D:SciChart3DSurface.YAxis>
<s3D:SciChart3DSurface.ZAxis>
    <s3D:NumericAxis3D />
</s3D:SciChart3DSurface.ZAxis>
<s3D:SciChart3DSurface.SceneObjects>
    <object:ObjectModel3D x:Name="BrainMesh"
                          CoordinateMode="Relative"
                          Opacity="{Binding BrainOpacity}"
                          Position="0.5, 0.5, 0.5"
                          Scale="5, 5, 5"
                          Source="{StaticResource Brain}" />
</s3D:SciChart3DSurface.SceneObjects>
<s3D:SciChart3DSurface.ChartModifier>
    <s3D:ModifierGroup3D>
        <s3D:OrbitModifier3D />
        <s3D:ZoomExtentsModifier3D />
    </s3D:ModifierGroup3D>
</s3D:SciChart3DSurface.ChartModifier>

Thank you!

Showing 5 results