helix-toolkit / helix-toolkit

Helix Toolkit is a collection of 3D components for .NET.
http://helix-toolkit.org/
MIT License
1.84k stars 661 forks source link

Help for BillboardTextVisual3D in WPF- Duplicate label seen #1876

Open gurucharansingh11 opened 1 year ago

gurucharansingh11 commented 1 year ago

We have a WPF application to show the 360 degree Panoramic images. User can place some controls like buttons on top of the Panoramic image viewer and perform some action. We are planning to use BillboardTextVisual3D control now as it is able to show same label without distortion irrespective of camera position. Following is a snapshot of our image viewer application.

Snap1

User can click on the Buy label(BillboardTextVisual3D control) to buy a ticket. However we are facing a problem. It shows the label at the provided position, but additionally it shows same label at another position also. Below image will explain the issue.

IssueExplanation

So if i keep a label at the front and scroll using arrow button towards back, i will find another BillboardTextVisual3D label. If i keep a label at the left side, and scroll around 180 towards right, i will find another label. Red labels in above image is expected label and orange color label is unexpected one.

In my application the duplicate label appears like below which is unwanted.

UnwantedLabel

I am using below code to add BillboardTextVisual3D control

    private BillboardTextVisual3D GetBillBoardText(ComponentData component, Point3D _refPoint)
    {
        BillboardTextVisual3D textItem = new BillboardTextVisual3D()
        {
            Text = AddPadding(component.Name),
            Position = _refPoint,
            Background = new SolidColorBrush(component.FontSettings.FontBackground),
            Foreground = new SolidColorBrush(component.FontSettings.FontColor),
            BorderBrush = new SolidColorBrush(component.FontSettings.FontColor),
            BorderThickness = new Thickness(0.0),
            FontSize= component.FontSettings.FontSize,
            FontFamily = component.FontSettings.FontFamily,                
            DepthOffset =0.5,
            MaterialType= MaterialType.Diffuse
        };
        return textItem;
    }

If i use DepthOffset as 1.0, then i see the BillboardTextVisual3D label only at the unwanted position, not at the expected location. If i use DepthOffset as 0.0 or lower, then i do not see the BillboardTextVisual3D at any of the location. Requesting experts to help me. Any clue or help will be greatly appreciated as i am stuck on this issue for long.

Following is the sample full image which our WPF application displays using Viewport3D(if required).

R0010019

holance commented 1 year ago

Are you using HelixToolkit.Wpf package?

gurucharansingh11 commented 1 year ago

Yes. We are using HelixToolkit.Wpf package in order to create the BillboardTextVisual3D control. For the Panoramic viewer, we are using System.Windows.Controls.Viewport3D

holance commented 1 year ago

So you didn't use the HelixViewport3D from helixtoolkit? What kind of camera are you using for the panoramic viewer?