Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Mesh Geometry for a Cube and a Sphere

 
 
Old 03-01-2006   #1 (permalink)
Kevin Hoffman


 
 

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 SpecsSystem Spec
Old 03-01-2006   #2 (permalink)
Jason [Mobiform]


 
 

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 SpecsSystem Spec
Old 03-02-2006   #3 (permalink)
Kevin Hoffman


 
 

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 SpecsSystem Spec
Old 03-02-2006   #4 (permalink)
Kevin Hoffman


 
 

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 SpecsSystem Spec
Old 03-02-2006   #5 (permalink)
Erno


 
 

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 SpecsSystem Spec
Old 03-02-2006   #6 (permalink)
Kevin Hoffman


 
 

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 SpecsSystem Spec
Old 03-02-2006   #7 (permalink)
Erno


 
 

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 SpecsSystem Spec
Old 03-03-2006   #8 (permalink)
Erno


 
 

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 SpecsSystem Spec
Old 03-03-2006   #9 (permalink)
Jordan Parker [MSFT]


 
 

Re: Mesh Geometry for a Cube and a Sphere

In WPF3D, every Brush ends up becoming a texture -- even
SolidColorBrushes -- and, unlike other APIs, we don't have vertex colors. I
see that your exported Blender mesh uses a SolidColorBrush so I bet Blender
was just using vertex colors and not generating texture coordinates. We do
not generate texture coordinates for you but we do let you get away with
using a SolidColorBrush without texture coordinates.

Try putting your image on the model in Blender before exporting.

Jordan

> 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 SpecsSystem Spec
Old 03-04-2006   #10 (permalink)
Bob Brown


 
 

Re: Mesh Geometry for a Cube and a Sphere

Erno,
You should be able to "disable" backface culling by setting the BackMaterial
property on GeometryModel3D. This is a relatively new feature.

http://windowssdk.msdn.microsoft.com...ckMaterial.asp

-Bob


"Erno" <no-spam> wrote in message
news:%23s2zvegPGHA.344@TK2MSFTNGP11.phx.gbl...
> 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
>
>


My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Screen geometry problem - registry??? Vista General
Logitech Quickcam Sphere Vista hardware & devices


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46