For bugs and new features, use the issue tracker located at GitHub.
Also try the chat room!
Orthographic Camera - Undesired Clipping on Zoom In (Near Plane Issues?)
ezolotko wrote at 2013-08-02 04:28:
Thank you for the great library.
I have successfully used the orthographic camera to display my scene, but with one problem:
when I zoom in my scene by moving the mouse wheel forward, I encounter the polygons clipping like it is shown in the picture:
I tried to reduce the camera near plane distance, but with no noticeable effect. Here is my camera definition:
Camera = new OrthographicCamera
{
LookDirection = new Vector3D(-398.987, -42.626, -19.482),
UpDirection = new Vector3D(-0.049, -0.001, 0.999),
Position = new Point3D(398.987, 42.626, 19.482),
Width = 235,
};
Am I doing anything wrong?ezolotko wrote at 2013-08-05 03:03:
ezolotko wrote at 2013-08-06 04:03:
Mrme wrote at 2013-08-06 10:09:
ezolotko wrote at 2013-08-06 10:17:
ShadesJeff wrote at 2013-09-24 23:02:
To reproduce, open the Camera demo, then switch to the Orthographic mode. Do some random zooming and rotating and you should be able to get it into a mode where the clipping is incorrect. In my trials, it seems that the incorrect clipping only affects the top and bottom regions, it does not appear to clip incorrectly on the left or right.
Sometimes the incorrect clipping is dynamic, e.g. the clipping line will move as you rotate the model whereas other times it is fixed.
objo wrote at 2013-09-25 08:59:
The near plane distance should not be changed when zooming or rotating.
Currently the near plane distance is copied when the user change from perspective to orthographic, maybe this code should be removed.
objo wrote at 2013-09-26 22:40:
Set
ShowCameraInfo = true on the HelixViewport3D to review the settings of the camera.ShadesJeff wrote at 2013-09-26 22:47:
That's essentially was the problem - I had universally specified my look directions as unit vectors, when in fact they need to be scaled to world units in order for the view to function correctly. I still think there is an issue when changing between orthographic and perspective projections (field of view explodes), but I cannot reliably recreate it.
objo wrote at 2013-09-27 11:12:
Maybe zooming in orthographic mode should change the CameraPosition and LookDirection in the same way as for perspective camera.
rinaldin wrote at 2013-10-03 22:14:
so what's the solution? Pressing "S" in my case solved the problem, but I just want to prevent the clipping happening.
From this:
Finally, I ended up using CameraHelper.LookAt to position the camera and OrthographicCamera.Width to zoom - manually, it doesn't produce the effects the CameraController does.How can I leave the default mouse control and ovverride the Zoom function? Sorry, but it is not clear to me.
Giovanni
rinaldin wrote at 2013-10-25 22:27:
var newRelativePosition = relativePosition * (1 + delta);
changing it to:var newRelativePosition = relativePosition * (1.1 + delta);
No more clipping and no need to use LookAt.wangzh wrote at 2014-07-24 04:56:
I finally solved changing the Helix source code in the file ZoomHandles.cs at line:rinaldin,
changing it to:var newRelativePosition = relativePosition * (1 + delta);
No more clipping and no need to use LookAt.var newRelativePosition = relativePosition * (1.1 + delta);
I have the same issue when I use the latest Helix version. I checked the source codes and didn't find the ZoomHandles.cs file. Only ZoomHandler.cs found. Is it same file? Also, I didn't find the code
var newRelativePosition = relativePosition * (1 + delta);
in the file ZoomHandler.cs.Any comment and suggestion to resolve the problem?
Thanks in advance!
rinaldin wrote at 2014-07-24 19:46:
wangzh wrote at 2014-07-25 02:42:
Yes, the file is ZoomHandler.cs, it was a typing mistake. Anyway, I noticed that in the later version of Helix Toolkit that code changes and it is written in a different way. I used the version helixtoolkit_f5a96293a071.rinaldin,
Thanks for your reply. I found the latest revision changed from:
var newRelativePosition = relativePosition * (1 + delta);
var newRelativeTarget = relativeTarget * (1 + delta);
to var f = Math.Pow(2.5, delta);
var newRelativePosition = relativePosition * f;
var newRelativeTarget = relativeTarget * f;
The latest version still has the same issue. It is a great library. However, I am stuck in this step. Since I am new in WPF, I am wondering if you could send me correct HelixToolkit.Wpf.dll to me it will be greatly appreciated.
my email: wangzh2000@yahoo.com
wangzh wrote at 2014-07-25 15:49:
public MainWindow()
{
InitializeComponent();
resetZoom();
}
Then write resetZoom()private void resetZoom()
{
OrthographicCamera myOCamera = new OrthographicCamera(new Point3D(0, 0, 0), new Vector3D(100000, 100000, -100000), new Vector3D(0, 0, 1), 5000);
ViewPort.Camera = myOCamera;
}
Each time, when creating a model, using ZoomExtents() at the end of method, for instance:double z1 = 0;
double h = 500;
private void cylinder_Click(object sender, RoutedEventArgs e)
{
PipeVisual3D pipe = new PipeVisual3D();
pipe.Point1 = new Point3D(0, 0, z1);
pipe.Point2 = new Point3D(0, 0, z1+h);
pipe.Material = Materials.LightGray;
pipe.Diameter = 1200;
pipe.InnerDiameter = 1180;
z1 += h;
SolidModels.Children.Add(pipe);
ViewPort.ZoomExtents();
}
I am a green bee in WPF and C#, any education and new simple way in the issue sharing will be greatly appreciated.This WPF library package is great. Thanks objo for this work!!!
Cheers,
CREATE CURVED PANELS
esi wrote at 2013-10-18 15:30:
I would like to create a curved surface to join two Cube faces together.
is this possible with helix3dToolKit?
I tried with AddExtrudedGeometry and AddLoftedGeometry but I didn't understand the right way to use them.
Did someone used those methods?
Thank You in advance for help
Regards
how do i use doublekeydictionary in my unity project?
How to get a element/object and then rotate it?
musicxpg wrote at 2013-03-20 04:35:
- How can I get handler of the fan? I named the fan in the 3ds file. Can I get the handler?
- How can I rotate it? There are two examples in Helix, however, the elements were generated in the examples, other than from 3ds file.
- How can I change the color of the fan using Helix?
Regards,
Young
Manipulation Events on a HelixViewport3D
JohnSourcer wrote at 2012-12-10 12:50:
Hi All,
I've created a HelixViewport3D which contains a SphereVisual3D. I'm trying to capture manipulation events on it. Does anybody know if this is supported?
HV3D.ZoomExtentsWhenLoaded = true; HV3D.Viewport.IsManipulationEnabled = true; HV3D.Viewport.ManipulationStarting += Viewport_ManipulationStarting;Never fires but TouchDown events fire on HV3D. Does anyone have any guidance on this?
JohnSourcer wrote at 2012-12-10 13:32:
Apols, this has something to do with it being in a Scatterview.
nsousa wrote at 2013-04-04 18:47:
Manipulation events don't work inside a ScatterViewItem.
Anyone has a solution to this problem?
objo wrote at 2013-04-15 12:47:
nsousa wrote at 2013-04-15 12:54:
No, you don't need to have Surface hardware.
You can use the Input Simulator (available in the Surface SDK) to reproduce it.
http://msdn.microsoft.com/en-us/library/ff727911.aspx
Is it possible to find distance between camera and a mesh?
behnam263 wrote at 2014-07-25 21:00:
BogusException wrote at 2014-07-25 21:31:
If you mean the center of the mesh, there has to be at least 2 ways to use the mesh center as origin and camera position in 3d in a simple trig function... as in this example...
Or are you talking about the nearest point/vertices to the camera?
This may help as well, not knowing the actual issue: Fitting view with perspective camera
How to limite camera zoom In/Out
Moez_rebai wrote at 2014-07-18 12:24:
Before Zoom :
After Zoom
Any idea how can i solve that issue
Regards,
everytimer wrote at 2014-07-18 20:54:
How to control the trackball via code?
zoras1986 wrote at 2013-04-21 23:25:
i'm starting my project from the contour demo samples of this awesome tool, but i cannot figure out how to control the trackball (don't know if is right call it like this, i mean the cude with the face "L, B, U, R, S..") by code in a wpf application (so c#). i can't figure out if it's something about the camera (view1.SetView(...)). or the model (model1.transform(...))
can someone help me?
a little piece of code
<ht:HelixViewport3D x:Name="view1" Camera="{ht:PerspectiveCamera 5.3,-12.3,3.3,-6.3,11,-6.6}" CameraChanged="view1_cameraChanged" ShowCameraInfo="True" Margin="0,71,0,0">
<ht:SunLight/>
<ht:FileModelVisual3D x:Name="model1" Source="D:/MARCO/Onthebrain/WPF - 3D - Kinect/Contour sample di Helix/Contour_demo/Contour_demo/bin/Debug/Astronaut.3ds"/>
</ht:HelixViewport3D>
inside a grid...in the .cs file i want to simulate the "right mouse click + mouse movement" input, as in the example, but in code...
thanks!
GridLinesVisual3D
murray_b wrote at 2012-05-10 04:35:
Hi Objo
Can I please request you make widthDirection propery public on this class like the lengthDirection.
I would like to use it for placement of labels at all the grid intersections.
Thanks
Murray
murray_b wrote at 2012-05-10 05:01:
Actually don't worry. Another day of stupidity for me
I just found your code
this.widthDirection = Vector3D.CrossProduct(this.Normal, this.lengthDirection);
How to Draw a Funnel
AQSRanck wrote at 2014-06-25 02:38:
objo wrote at 2014-06-25 09:55:
MeshBuilder.AddSurfaceOfRevolution in the example
Source\Examples\WPF\ExampleBrowser\Examples\BuildingDemo\SiloVisual3D.cs, I think a similar approach can be used to model a funnel.AQSRanck wrote at 2014-06-25 13:59:
Bob
AQSRanck wrote at 2014-06-26 04:15:
Thank you for your suggestion, I should not have much trouble creating a FunnelVisual3D. But I have hit a real snag. I work in VB rather than C# so I need to write my own version of theSiloVisual3D. However, I don't understand the lambda contained in the Dependency property, shown below.
public static readonly DependencyProperty DiameterProperty =
DependencyPropertyEx.Register<double, SiloVisual3D>("Diameter", 40, (s, e) => s.AppearanceChanged());
My version for VB will look about like this: (However the lambda is not quite right)Public Shared ReadOnly DiameterProperty As DependencyProperty =
DependencyPropertyEx.Register(Of Double, SiloVisual3D)("Diameter", 40, Function(s, e) s.AppearanceChanged())
I'm not asking for you to fix my code, but rather to help me understand the C# version, so that I can fix the VB version myself.
Once I master SiloVisual3D (in VB) I fully expect to create an entire library of specialized visuals for my needs, so getting past this snag is kind of important for me.
Now that I see this example from Building Demo, the funnel shape should not be to hard.
Bob
objo wrote at 2014-06-26 05:43:
But you could change to standard dependency property registration with
DependencyProperty.Register, see
http://msdn.microsoft.com/en-us/library/ms750428(v=vs.110).aspx Make sure you add the property changed calback to the metadata.
RobPerkins wrote at 2014-06-26 17:15:
Try:
Public Shared ReadOnly DiameterProperty As DependencyProperty =
DependencyPropertyEx.Register(Of Double, SiloVisual3D)("Diameter", 40, Sub(s, e) s.AppearanceChanged())
(because the lambda is supposed to be a function returning "void" (in C# terms) and in VB, that's represented with a Sub() lambda instead of a Function() )AQSRanck wrote at 2014-06-26 17:45:
Would you believe that I spent the better part of a day because I forgot that rule.
Thank you very much Rob
Customer support service by UserEcho