r/csharp•
error4lol4

XAML and 3-D Graphics using Viewport3D

I'm mucking around with this for a research project an encountering some problems, would anyone with experience in this mind giving me a hand?

Currently, I have a cube. My overall goal is to have it match a 9-Dof sensor in orientation. I created the 6 sides, each a different color - however, from some camera angles, some of the sides won't appear. Any advice?

Relevant code:

       <Viewport3D.Camera>
                            <PerspectiveCamera 
					FarPlaneDistance="200" 
					LookDirection="1,1,-1" 
					UpDirection="1,0,0" 
					NearPlaneDistance="1" 
					Position="-5,-5,5" 
					FieldOfView="60" />
        </Viewport3D.Camera>

And one of the faces of my cube.

                            <GeometryModel3D>

                                <GeometryModel3D.Geometry>
                                    <MeshGeometry3D 
                                        Positions="-1 -1 1  -1 -1 -1  -1 1 1  -1 1 -1" 
                                        Normals="1 0 0  1 0 0  1 0 0  1 0 0"
                                        TriangleIndices="0 1 2  1 3 2">
                                    </MeshGeometry3D>
                                        
                                </GeometryModel3D.Geometry>

                                <GeometryModel3D.Material>
                                    <DiffuseMaterial>
                                        <DiffuseMaterial.Brush>
                                            <SolidColorBrush 
                        Color="Green" 
                        Opacity="1.0"/>
                                        </DiffuseMaterial.Brush>
                                    </DiffuseMaterial>
                                </GeometryModel3D.Material>
                            </GeometryModel3D>

Posted Jul 22, 2015, 6:54 PM UTC · edited

50
Loading comments…