![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Mesh Geometry for a Cube and a Sphere Does anyone know where I can find the mesh geometry for a Unit Sphere (1 radius) and a Unit Cube? I've got mesh for a plane, and that works just fine. All of the cube samples I have seen have failed to produce a proper cube. I think earlier CTPs had relaxed requirements for specifying triangle indices and its messing up the new CTP. Even the so-called cube from the MSDN site when run against the Feb CTP doesn't produce a legitimate cube - there's a gaping hole in the front face of the cube that goes into the back face of the rear sides. I have need of creating several spheres and cubes in a scene... What I plan on doing is creating the geometry for origin-centered small shapes, and then I can create multiple instances of them by offset and scale transforming each new instance. Can anyone point me in the right direction? I've tried using Aurora, but the cube produced by that app is like 200 units wide, pre-transformed, and I can't get the tool to reduce anything in size without crashing it. Thanks! |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: Mesh Geometry for a Cube and a Sphere Well, I used the Blender exporter to export the geometry for a single Unit Cube... It looked OK in the renderer inside Blender...but when I put the geometry into my XAML, all I get is a single side (the side of the cube I'm facing is a plane, and nothing else is visible)... Am I doing something wrong in the XAML ? This has happened to me before when attempting to do truly 3D objects (e.g. more than just a plane). Here's the XAML I'm using to display my cube: <Window x:Class="Cube1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Cube1" Height="517" Width="553" KeyDown="Window_Keydown" > <Grid VerticalAlignment="Center" HorizontalAlignment="Center"> <Grid Width="300" Height="300"> <Grid.RowDefinitions> <RowDefinition/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition/> </Grid.ColumnDefinitions> <Grid.Background > <SolidColorBrush Color="Black"/> </Grid.Background> <Viewport3D Grid.Column="0" Grid.Row="0" Name="mainViewport" ClipToBounds="False"> <Viewport3D.Camera> <PerspectiveCamera x:Name="perspCamera" FarPlaneDistance="100" LookDirection="0,0,-1" UpDirection="0,1,0" NearPlaneDistance="1" Position="0,0,4" FieldOfView="70" > <PerspectiveCamera.Transform> <MatrixTransform3D></MatrixTransform3D> </PerspectiveCamera.Transform> </PerspectiveCamera> </Viewport3D.Camera> <ModelVisual3D> <ModelVisual3D.Content> <Model3DGroup > <DirectionalLight Color="White" Direction="0,0, -1" /> <AmbientLight Color="Blue" /> <GeometryModel3D x:Name="OB_Cube"> <GeometryModel3D.Material> <DiffuseMaterial x:Name="MA_Material"> <DiffuseMaterial.Brush> <SolidColorBrush Color="#cccccc"/> </DiffuseMaterial.Brush> </DiffuseMaterial> </GeometryModel3D.Material> <GeometryModel3D.Geometry> <MeshGeometry3D x:Name="ME_Cube" Positions="1.000000,1.000000,-1.000000 1.000000,-1.000000,-1.000000 -1.000000,-1.000000,-1.000000 -1.000000,1.000000,-1.000000 1.000000,0.999999,1.000000 -1.000000,1.000000,1.000000 -1.000000,-1.000000,1.000000 0.999999,-1.000001,1.000000 1.000000,1.000000,-1.000000 1.000000,0.999999,1.000000 0.999999,-1.000001,1.000000 1.000000,-1.000000,-1.000000 1.000000,-1.000000,-1.000000 0.999999,-1.000001,1.000000 -1.000000,-1.000000,1.000000 -1.000000,-1.000000,-1.000000 -1.000000,-1.000000,-1.000000 -1.000000,-1.000000,1.000000 -1.000000,1.000000,1.000000 -1.000000,1.000000,-1.000000 1.000000,0.999999,1.000000 1.000000,1.000000,-1.000000 -1.000000,1.000000,-1.000000 -1.000000,1.000000,1.000000" Normals="0.577349,0.577349,-0.577349 0.577349,-0.577349,-0.577349 -0.577349,-0.577349,-0.577349 -0.577349,0.577349,-0.577349 0.577349,0.577349,0.577349 -0.577349,0.577349,0.577349 -0.577349,-0.577349,0.577349 0.577349,-0.577349,0.577349 0.577349,0.577349,-0.577349 0.577349,0.577349,0.577349 0.577349,-0.577349,0.577349 0.577349,-0.577349,-0.577349 0.577349,-0.577349,-0.577349 0.577349,-0.577349,0.577349 -0.577349,-0.577349,0.577349 -0.577349,-0.577349,-0.577349 -0.577349,-0.577349,-0.577349 -0.577349,-0.577349,0.577349 -0.577349,0.577349,0.577349 -0.577349,0.577349,-0.577349 0.577349,0.577349,0.577349 0.577349,0.577349,-0.577349 -0.577349,0.577349,-0.577349 -0.577349,0.577349,0.577349" TextureCoordinates="" TriangleIndices="0 1 2 0 2 3 4 5 6 4 6 7 8 9 10 8 10 11 12 13 14 12 14 15 16 17 18 16 18 19 20 21 22 20 22 23"/> </GeometryModel3D.Geometry> </GeometryModel3D> </Model3DGroup> </ModelVisual3D.Content> </ModelVisual3D> </Viewport3D> </Grid> </Grid> </Window> Sorry about the geometry spam, but I thought it was important to show that as well, since it came right from the Blender exporter. If anybody can shed some light on why I'm only seeing one side of this cube, that would be really nice. |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Mesh Geometry for a Cube and a Sphere I assume the camera is looking directly at the box, so its going to see only one side of the box. Try putting a 45 degree rotation on the box, then you should at least see 2 sides. I dont think this would happen for more complex object type unless you scale is WAY off. For example if your camera is 2 ( 3D units ) away from the object but the object could be much too large to fit into the view frustum of the camera. Jason "Kevin Hoffman" <alothien@gmail.com> wrote in message news:1141250297.016084.209270@z34g2000cwc.googlegroups.com... > Well, I used the Blender exporter to export the geometry for a single > Unit Cube... It looked OK in the renderer inside Blender...but when I > put the geometry into my XAML, all I get is a single side (the side of > the cube I'm facing is a plane, and nothing else is visible)... Am I > doing something wrong in the XAML ? This has happened to me before when > attempting to do truly 3D objects (e.g. more than just a plane). > > Here's the XAML I'm using to display my cube: > > <Window x:Class="Cube1.Window1" > xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > Title="Cube1" Height="517" Width="553" KeyDown="Window_Keydown" > > > <Grid VerticalAlignment="Center" HorizontalAlignment="Center"> > <Grid Width="300" Height="300"> > <Grid.RowDefinitions> > <RowDefinition/> > </Grid.RowDefinitions> > <Grid.ColumnDefinitions> > <ColumnDefinition/> > </Grid.ColumnDefinitions> > <Grid.Background > > <SolidColorBrush Color="Black"/> > </Grid.Background> > > <Viewport3D Grid.Column="0" Grid.Row="0" Name="mainViewport" > ClipToBounds="False"> > <Viewport3D.Camera> > <PerspectiveCamera x:Name="perspCamera" > FarPlaneDistance="100" > LookDirection="0,0,-1" > UpDirection="0,1,0" > NearPlaneDistance="1" > Position="0,0,4" > FieldOfView="70" > > <PerspectiveCamera.Transform> > <MatrixTransform3D></MatrixTransform3D> > </PerspectiveCamera.Transform> > </PerspectiveCamera> > </Viewport3D.Camera> > > <ModelVisual3D> > <ModelVisual3D.Content> > <Model3DGroup > > <DirectionalLight Color="White" Direction="0,0, -1" /> > <AmbientLight Color="Blue" /> > <GeometryModel3D x:Name="OB_Cube"> > <GeometryModel3D.Material> > <DiffuseMaterial x:Name="MA_Material"> > <DiffuseMaterial.Brush> > <SolidColorBrush Color="#cccccc"/> > </DiffuseMaterial.Brush> > </DiffuseMaterial> > </GeometryModel3D.Material> > <GeometryModel3D.Geometry> > <MeshGeometry3D x:Name="ME_Cube" > Positions="1.000000,1.000000,-1.000000 1.000000,-1.000000,-1.000000 > -1.000000,-1.000000,-1.000000 -1.000000,1.000000,-1.000000 > 1.000000,0.999999,1.000000 -1.000000,1.000000,1.000000 > -1.000000,-1.000000,1.000000 0.999999,-1.000001,1.000000 > 1.000000,1.000000,-1.000000 1.000000,0.999999,1.000000 > 0.999999,-1.000001,1.000000 1.000000,-1.000000,-1.000000 > 1.000000,-1.000000,-1.000000 0.999999,-1.000001,1.000000 > -1.000000,-1.000000,1.000000 -1.000000,-1.000000,-1.000000 > -1.000000,-1.000000,-1.000000 -1.000000,-1.000000,1.000000 > -1.000000,1.000000,1.000000 -1.000000,1.000000,-1.000000 > 1.000000,0.999999,1.000000 1.000000,1.000000,-1.000000 > -1.000000,1.000000,-1.000000 -1.000000,1.000000,1.000000" > Normals="0.577349,0.577349,-0.577349 0.577349,-0.577349,-0.577349 > -0.577349,-0.577349,-0.577349 -0.577349,0.577349,-0.577349 > 0.577349,0.577349,0.577349 -0.577349,0.577349,0.577349 > -0.577349,-0.577349,0.577349 0.577349,-0.577349,0.577349 > 0.577349,0.577349,-0.577349 0.577349,0.577349,0.577349 > 0.577349,-0.577349,0.577349 0.577349,-0.577349,-0.577349 > 0.577349,-0.577349,-0.577349 0.577349,-0.577349,0.577349 > -0.577349,-0.577349,0.577349 -0.577349,-0.577349,-0.577349 > -0.577349,-0.577349,-0.577349 -0.577349,-0.577349,0.577349 > -0.577349,0.577349,0.577349 -0.577349,0.577349,-0.577349 > 0.577349,0.577349,0.577349 0.577349,0.577349,-0.577349 > -0.577349,0.577349,-0.577349 -0.577349,0.577349,0.577349" > TextureCoordinates="" TriangleIndices="0 1 2 0 2 3 4 5 6 4 6 7 8 9 10 8 > 10 11 12 13 14 12 14 15 16 17 18 16 18 19 20 21 22 20 22 23"/> > </GeometryModel3D.Geometry> > </GeometryModel3D> > > </Model3DGroup> > </ModelVisual3D.Content> > </ModelVisual3D> > </Viewport3D> > </Grid> > </Grid> > </Window> > > Sorry about the geometry spam, but I thought it was important to show > that as well, since it came right from the Blender exporter. If anybody > can shed some light on why I'm only seeing one side of this cube, that > would be really nice. > |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: Mesh Geometry for a Cube and a Sphere I thought I mentioned it... I have code in this sample that rotates the camera 360 degrees in both directions. Assuming you're looking at an honest-to-goodness cube, if I rotate the camera to the right, some of the left side of the cube should appear as the camera will no longer be directly facing the camera. No matter what angle I am viewing the cube fom, the cube appears to be a plane. As I said, I've had this happen with other geometry that I've taken from various postings and samples for cubes, and I've gotten the plane effect there as well. So you didn't see anything else inherently wrong with the XAML that might produce a bad cube? I've also tried increasing the FieldOfView and distance from the camera to the cube in hopes that I would see the rest of the cube ... but I still only see a plane. |
My System Specs![]() |
| | #5 (permalink) |
| Guest | Re: Mesh Geometry for a Cube and a Sphere Well, I think I said to someone : "this is either coded wrong, or this is my own stupidity shining through" Turns out it was the latter. I rotated the cube 45 degrees and things appeared as I expected them to. What I still don't understand is why the other faces of the cube wouldn't appear after I rotated the camera... Is there some issue where if the face doesn't appear at the beginning of the scene, the camera won't see the faces as it moves/rotates? (hopefully that's not true). So - I tried to put an ImageBrush onto the sides: <EmissiveMaterial> <EmissiveMaterial.Brush> <ImageBrush ImageSource="stars.jpg" /> </EmissiveMaterial.Brush> </EmissiveMaterial> That image is in every one of my output directories and the main directory of my solution. I have the same image mapped onto a 3d surface in another solution, and that works fine... in this case, every face mapped with that image becomes transparent, disappears.. I realize you're humoring a complete newbie here...but. .any thoughts? |
My System Specs![]() |
| | #6 (permalink) |
| Guest | Re: Mesh Geometry for a Cube and a Sphere Ah! I guess you didn't take the winding order of the triangle indices into account! Triangles are only visible from the counterclockwise side. (WPF uses backface culling and I haven't found a way of disableing it yet) So... specify you indices counterclockwise and you should be ok. Erno ---- WPF tutorials: http://blogs.infosupport.com/ernow/articles/1878.aspx "Kevin Hoffman" <alothien@gmail.com> wrote in message news:1141309104.560760.20000@t39g2000cwt.googlegroups.com... > Well, I think I said to someone : "this is either coded wrong, or this > is my own stupidity shining through" > Turns out it was the latter. > > I rotated the cube 45 degrees and things appeared as I expected them > to. What I still don't understand is why the other faces of the cube > wouldn't appear after I rotated the camera... Is there some issue where > if the face doesn't appear at the beginning of the scene, the camera > won't see the faces as it moves/rotates? (hopefully that's not true). > > So - I tried to put an ImageBrush onto the sides: > > <EmissiveMaterial> > <EmissiveMaterial.Brush> > <ImageBrush ImageSource="stars.jpg" /> > </EmissiveMaterial.Brush> > </EmissiveMaterial> > > That image is in every one of my output directories and the main > directory of my solution. I have the same image mapped onto a 3d > surface in another solution, and that works fine... in this case, every > face mapped with that image becomes transparent, disappears.. I realize > you're humoring a complete newbie here...but. .any thoughts? > |
My System Specs![]() |
| | #7 (permalink) |
| Guest | Re: Mesh Geometry for a Cube and a Sphere "I" didn't think I had to take winding order of triangle indices into account - I exported this 3d object from a 3d modeling application directly into XAML - I thought that would have been taken care of automatically... The object renders properly in the 3d modeling app. |
My System Specs![]() |
| | #8 (permalink) |
| Guest | Re: Mesh Geometry for a Cube and a Sphere Sorry! I didn't realize you were using an importer/exporter. Did you try other samples? Erno ---- WPF tutorials: http://blogs.infosupport.com/ernow/articles/1878.aspx "Kevin Hoffman" <alothien@gmail.com> wrote in message news:1141312649.013040.93640@j33g2000cwa.googlegroups.com... > "I" didn't think I had to take winding order of triangle indices into > account - I exported this 3d object from a 3d modeling application > directly into XAML - I thought that would have been taken care of > automatically... The object renders properly in the 3d modeling app. > |
My System Specs![]() |
| | #9 (permalink) |
| Guest | Re: Mesh Geometry for a Cube and a Sphere I have tried other samples. I can paint other types of brushes onto the cube and all works just fine - Its just when I try and put the image on the cube it seems to mess up. I'm sure it has to do with the TextureCoordinates .. I don't know why Blender doesn't provide that property in its XAML export output. If there's another free 3d modeling tool that I should be using that won't give me this texture problem, I'd love to know which tool it is. Zam3D is only available for the Jan CTP. |
My System Specs![]() |
| | #10 (permalink) |
| Guest | Re: Mesh Geometry for a Cube and a Sphere :-) I am building such a tool http://blogs.infosupport.com/ernow/articles/3603.aspx Do you add the texturecoordinates by hand? If so, could you show the code and/or xaml? Erno ---- WPF tutorials: http://blogs.infosupport.com/ernow/articles/1878.aspx "Kevin Hoffman" <alothien@gmail.com> wrote in message news:1141321579.256109.195420@p10g2000cwp.googlegroups.com... >I have tried other samples. I can paint other types of brushes onto the > cube and all works just fine - Its just when I try and put the image on > the cube it seems to mess up. I'm sure it has to do with the > TextureCoordinates .. I don't know why Blender doesn't provide that > property in its XAML export output. > > If there's another free 3d modeling tool that I should be using that > won't give me this texture problem, I'd love to know which tool it is. > Zam3D is only available for the Jan CTP. > |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Logitech Quickcam Sphere/ORB | AndyMc | Drivers | 2 | 01-07-2008 10:14 PM |
| Semi-Stretching Geometry Path | Tom | Avalon | 2 | 03-30-2006 10:05 AM |
| Best Practice for 3D Cube mesh | Avery Z | Avalon | 1 | 03-17-2006 09:02 PM |
| Geometry path relative to edges of Grid or Canvas | Griff | Avalon | 2 | 01-31-2006 07:00 AM |
| 3d sphere in avalon | Avalon | 1 | 01-10-2006 03:53 PM | |