3D is not rendering in WPF Application -
i trying render 3d object using below code. when run application, nothing displayed. seems blank. missing anything?
<page x:class="samplewpfapplication.demopage3" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="demopage3" xmlns:my="clr-namespace:samplewpfapplication"> <grid> <grid.rowdefinitions> <rowdefinition height="126*" /> <rowdefinition height="126*" /> <rowdefinition height="66" /> </grid.rowdefinitions> <viewport3d x:name="theview3d"> <viewport3d.camera> <perspectivecamera position="6,6,6" lookdirection="-4,-4,-4" updirection="0,1,0" /> </viewport3d.camera> <modelvisual3d x:name="themodel"> <modelvisual3d.content> <model3dgroup> <geometrymodel3d x:name="thegeometry"> <geometrymodel3d.geometry> <meshgeometry3d positions="0,1,0 1,-1,1 -1,-1,1 1,-1,-1 -1,-1,-1" normals="0,1,0 -1,0,1 1,0,1 -1,0,-1 1,0,-1" triangleindices="0,2,1 0,3,1 0,3,4 0,2,4" /> </geometrymodel3d.geometry> <geometrymodel3d.material> <diffusematerial> <diffusematerial.brush> <solidcolorbrush color="red" opacity="0.9"/> </diffusematerial.brush> </diffusematerial> </geometrymodel3d.material> <geometrymodel3d.backmaterial> <diffusematerial> <diffusematerial.brush> <solidcolorbrush color="green" opacity="0.9"/> </diffusematerial.brush> </diffusematerial> </geometrymodel3d.backmaterial> </geometrymodel3d> </model3dgroup> </modelvisual3d.content> </modelvisual3d> <modelvisual3d> <modelvisual3d.content> <model3dgroup> <directionallight direction="0,-5,-2" /> <directionallight direction="3,2,2" /> <geometrymodel3d x:name="thegeometry2"> <geometrymodel3d.transform> <scaletransform3d scalex="2" scaley="2" scalez="2"></scaletransform3d> </geometrymodel3d.transform> <geometrymodel3d.geometry> <meshgeometry3d positions="0,1,0 1,-1,1 -1,-1,1 1,-1,-1 -1,-1,-1" normals="0,1,0 -1,0,1 1,0,1 -1,0,-1 1,0,-1" triangleindices="0,2,1 0,3,1 0,3,4 0,2,4" /> </geometrymodel3d.geometry> <geometrymodel3d.material> <diffusematerial> <diffusematerial.brush> <solidcolorbrush color="#7fb0c4de" opacity="0.9"/> </diffusematerial.brush> </diffusematerial> </geometrymodel3d.material> <geometrymodel3d.backmaterial> <diffusematerial> <diffusematerial.brush> <solidcolorbrush color="#7fb0c4de" opacity="0.9"/> </diffusematerial.brush> </diffusematerial> </geometrymodel3d.backmaterial> </geometrymodel3d> </model3dgroup> </modelvisual3d.content> </modelvisual3d> </viewport3d> </grid> </page>
it appears render fine me in kaxaml.
perhaps should try different machine or use kaxaml see if result @ all. @ point, number of things.
edit: noticed didn't copy grid.rowdefinitions
. when add them, clips viewport. if remove those, work?
Comments
Post a Comment