Visualbrush with a media element over a 3D Plasma TV MeshGeometry3D surface in WPF

Topics: Developer Forum
Mar 22, 2010 at 8:38 AM

Hi,

I would like to show video contents over a plasma tv(3d) object.  In order to do that, I want to apply visual brush with a media element in it, to the surface of the TV which is a MeshGeometry3D object.

However, it does not seems to work.  I think I am missing some mapping stuff about TextureCoordinates..

Would you please let me know how I can show video content over a GeometryModel3D object?

Below is the Plasma TV xaml.. The problem starts from the following tag.

<!-- HERE IS THE MAIN SCREEN OF PLASMA TV -->

Thanks in advance,

Emrah

<Model3DGroup >
                <!-- steklo te0 (XAML Path = (Viewport3D.Children)[0].(ModelVisual3D.Content).(Model3DGroup.Children)[10].(Model3DGroup.Children)[4]) -->
                <Model3DGroup.Transform>
                    <Transform3DGroup>
                        <TranslateTransform3D OffsetX="-0" OffsetY="-0" OffsetZ="-0"/>
                        <ScaleTransform3D ScaleX="0.793322" ScaleY="1" ScaleZ="0.717223"/>
                        <RotateTransform3D>
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D Angle="92.45337913" Axis="1 0 0"/>
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>
                        <TranslateTransform3D OffsetX="6.37025e-007" OffsetY="0.0709801" OffsetZ="-0.0623178"/>
                    </Transform3DGroup>
                </Model3DGroup.Transform>
                <GeometryModel3D >
                    <GeometryModel3D.Material>
                        <MaterialGroup>
                            <DiffuseMaterial>
                                <DiffuseMaterial.Brush>
								
								<!-- HERE IS THE MAIN SCREEN OF PLASMA TV -->
									
									<!--Test: SolidColorBrush works -->
                                    <!--SolidColorBrush Color="#FFFFFF" Opacity="1.000000"/-->
									
									<!--Test: ImageBrush partially works -->
									<!--ImageBrush ImageSource="ebudur.jpg" ViewportUnits="Absolute"/-->
									
									
									<!--Here is the actual problem VisualBrush does not work-->
									<VisualBrush ViewportUnits="Absolute">
							            <VisualBrush.Visual>
							                <MediaElement Source="cep_sube.mpg" LoadedBehavior="Play" />
							            </VisualBrush.Visual>
							        </VisualBrush>		
									
                                </DiffuseMaterial.Brush>
                            </DiffuseMaterial>
                            <SpecularMaterial SpecularPower="298.667">
                                <SpecularMaterial.Brush>
                                    <SolidColorBrush Color="#FFFFFF" Opacity="1.000000"/>
                                </SpecularMaterial.Brush>
                            </SpecularMaterial>
                        </MaterialGroup>
                    </GeometryModel3D.Material>
                    <GeometryModel3D.BackMaterial>
                        <MaterialGroup>
                            <DiffuseMaterial>
                                <DiffuseMaterial.Brush>
                                    <SolidColorBrush Color="#060A0D" Opacity="1.000000"/>
                                </DiffuseMaterial.Brush>
                            </DiffuseMaterial>
                            <SpecularMaterial SpecularPower="298.667">
                                <SpecularMaterial.Brush>
                                    <SolidColorBrush Color="#FFFFFF" Opacity="1.000000"/>
                                </SpecularMaterial.Brush>
                            </SpecularMaterial>
                        </MaterialGroup>
                    </GeometryModel3D.BackMaterial>
                    <GeometryModel3D.Geometry>
                        <MeshGeometry3D
									TriangleIndices="0,1,2 2,3,0 1,4,5 5,2,1 3,2,6 6,7,3 2,5,8 8,6,2 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,47 48,49,50 51,52,53 54,55,56 57,58,59 60,61,62 63,64,65 66,67,68 69,70,71 72,73,74 75,76,77 78,79,80 81,82,83 84,85,86 87,88,89 90,91,92 93,94,95 96,97,98 99,100,101 102,103,104 105,106,107 108,109,110 111,112,113 114,115,116 117,118,119 120,121,122 123,124,125 126,127,128 129,130,131 132,133,134 135,136,137 138,139,140 141,142,143 144,145,146 147,148,149 150,151,152 "
									
									Positions="-20.1311,1.84756,12.616 -8.1494e-009,1.84756,12.616 -8.1494e-009,1.84756,6.79798e-007 -20.1311,1.84756,6.79798e-007 20.1311,1.84756,12.616 20.1311,1.84756,6.79798e-007 -8.1494e-009,1.84756,-12.616 -20.1311,1.84756,-12.616 20.1311,1.84756,-12.616 -20.9185,1.84756,13.4034 -8.1494e-009,1.84756,13.4034 -8.1494e-009,1.84756,12.616 -8.1494e-009,1.84756,12.616 -20.1311,1.84756,12.616 -20.9185,1.84756,13.4034 -8.1494e-009,1.84756,13.4034 20.9185,1.84756,13.4034 20.1311,1.84756,12.616 20.1311,1.84756,12.616 -8.1494e-009,1.84756,12.616 -8.1494e-009,1.84756,13.4034 20.9185,1.84756,13.4034 20.9185,1.84756,6.79798e-007 20.1311,1.84756,6.79798e-007 20.1311,1.84756,6.79798e-007 20.1311,1.84756,12.616 20.9185,1.84756,13.4034 20.9185,1.84756,6.79798e-007 20.9185,1.84756,-13.4034 20.1311,1.84756,-12.616 20.1311,1.84756,-12.616 20.1311,1.84756,6.79798e-007 20.9185,1.84756,6.79798e-007 20.9185,1.84756,-13.4034 -8.1494e-009,1.84756,-13.4034 -8.1494e-009,1.84756,-12.616 -8.1494e-009,1.84756,-12.616 20.1311,1.84756,-12.616 20.9185,1.84756,-13.4034 -8.1494e-009,1.84756,-13.4034 -20.9185,1.84756,-13.4034 -20.1311,1.84756,-12.616 -20.1311,1.84756,-12.616 -8.1494e-009,1.84756,-12.616 -8.1494e-009,1.84756,-13.4034 -20.9185,1.84756,-13.4034 -20.9185,1.84756,6.79798e-007 -20.1311,1.84756,6.79798e-007 -20.1311,1.84756,6.79798e-007 -20.1311,1.84756,-12.616 -20.9185,1.84756,-13.4034 -20.9185,1.84756,6.79798e-007 -20.9185,1.84756,13.4034 -20.1311,1.84756,12.616 -20.1311,1.84756,12.616 -20.1311,1.84756,6.79798e-007 -20.9185,1.84756,6.79798e-007 -8.1494e-009,1.84756,13.4034 -20.9185,1.84756,13.4034 -20.9185,1.80392,13.4034 -20.9185,1.80392,13.4034 -6.51952e-009,1.80392,13.4034 -8.1494e-009,1.84756,13.4034 -20.9185,1.84756,13.4034 -20.9185,1.84756,6.79798e-007 -20.9185,1.80392,-9.15085e-007 -20.9185,1.80392,-9.15085e-007 -20.9185,1.80392,13.4034 -20.9185,1.84756,13.4034 20.9185,1.84756,13.4034 -8.1494e-009,1.84756,13.4034 -6.51952e-009,1.80392,13.4034 -6.51952e-009,1.80392,13.4034 20.9185,1.80392,13.4034 20.9185,1.84756,13.4034 20.9185,1.84756,6.79798e-007 20.9185,1.84756,13.4034 20.9185,1.80392,13.4034 20.9185,1.80392,13.4034 20.9185,1.80392,-9.15085e-007 20.9185,1.84756,6.79798e-007 -20.9185,1.84756,-13.4034 -8.1494e-009,1.84756,-13.4034 -6.51952e-009,1.80392,-13.4034 -6.51952e-009,1.80392,-13.4034 -20.9185,1.80392,-13.4034 -20.9185,1.84756,-13.4034 -20.9185,1.84756,6.79798e-007 -20.9185,1.84756,-13.4034 -20.9185,1.80392,-13.4034 -20.9185,1.80392,-13.4034 -20.9185,1.80392,-9.15085e-007 -20.9185,1.84756,6.79798e-007 20.9185,1.84756,-13.4034 20.9185,1.84756,6.79798e-007 20.9185,1.80392,-9.15085e-007 20.9185,1.80392,-9.15085e-007 20.9185,1.80392,-13.4034 20.9185,1.84756,-13.4034 -8.1494e-009,1.84756,-13.4034 20.9185,1.84756,-13.4034 20.9185,1.80392,-13.4034 20.9185,1.80392,-13.4034 -6.51952e-009,1.80392,-13.4034 -8.1494e-009,1.84756,-13.4034 -6.51952e-009,1.80392,13.4034 -20.9185,1.80392,13.4034 -20.9185,1.22665,13.4034 -20.9185,1.22665,13.4034 1.95586e-008,1.22665,13.4034 -6.51952e-009,1.80392,13.4034 -20.9185,1.80392,13.4034 -20.9185,1.80392,-9.15085e-007 -20.9185,1.22665,-1.78394e-007 -20.9185,1.22665,-1.78394e-007 -20.9185,1.22665,13.4034 -20.9185,1.80392,13.4034 20.9185,1.80392,13.4034 -6.51952e-009,1.80392,13.4034 1.95586e-008,1.22665,13.4034 1.95586e-008,1.22665,13.4034 20.9185,1.22665,13.4034 20.9185,1.80392,13.4034 20.9185,1.80392,-9.15085e-007 20.9185,1.80392,13.4034 20.9185,1.22665,13.4034 20.9185,1.22665,13.4034 20.9185,1.22665,-1.33164e-007 20.9185,1.80392,-9.15085e-007 -20.9185,1.80392,-13.4034 -6.51952e-009,1.80392,-13.4034 1.95586e-008,1.22665,-13.4034 1.95586e-008,1.22665,-13.4034 -20.9185,1.22665,-13.4034 -20.9185,1.80392,-13.4034 -20.9185,1.80392,-9.15085e-007 -20.9185,1.80392,-13.4034 -20.9185,1.22665,-13.4034 -20.9185,1.22665,-13.4034 -20.9185,1.22665,-1.78394e-007 -20.9185,1.80392,-9.15085e-007 20.9185,1.80392,-13.4034 20.9185,1.80392,-9.15085e-007 20.9185,1.22665,-1.33164e-007 20.9185,1.22665,-1.33164e-007 20.9185,1.22665,-13.4034 20.9185,1.80392,-13.4034 -6.51952e-009,1.80392,-13.4034 20.9185,1.80392,-13.4034 20.9185,1.22665,-13.4034 20.9185,1.22665,-13.4034 1.95586e-008,1.22665,-13.4034 -6.51952e-009,1.80392,-13.4034 "
									Normals="0,1,-9.44907e-009 0,1,-9.44907e-009 0,1,-4.72454e-009 0,1,-3.14969e-009 0,1,-9.44907e-009 0,1,-6.29938e-009 0,1,0 0,1,0 0,1,0 0,1,1.51396e-007 0,1,1.51396e-007 0,1,1.51396e-007 -0,1,1.51396e-007 -0,1,1.51396e-007 -0,1,1.51396e-007 0,1,1.51396e-007 0,1,1.51396e-007 0,1,1.51396e-007 -0,1,1.51396e-007 -0,1,1.51396e-007 -0,1,1.51396e-007 0,1,-0 0,1,-0 0,1,-0 1.60845e-007,1,-9.44907e-009 1.60845e-007,1,-9.44907e-009 1.60845e-007,1,-9.44907e-009 -1.42502e-007,1,8.89397e-009 -1.42502e-007,1,8.89397e-009 -1.42502e-007,1,8.89397e-009 -0,1,0 -0,1,0 -0,1,0 -0,1,1.51396e-007 -0,1,1.51396e-007 -0,1,1.51396e-007 0,1,1.51396e-007 0,1,1.51396e-007 0,1,1.51396e-007 -0,1,1.51396e-007 -0,1,1.51396e-007 -0,1,1.51396e-007 0,1,1.51396e-007 0,1,1.51396e-007 0,1,1.51396e-007 -0,1,8.89397e-009 -0,1,8.89397e-009 -0,1,8.89397e-009 1.51396e-007,1,-0 1.51396e-007,1,-0 1.51396e-007,1,-0 -1.51396e-007,1,0 -1.51396e-007,1,0 -1.51396e-007,1,0 0,1,-9.44907e-009 0,1,-9.44907e-009 0,1,-9.44907e-009 -0,0,1 -0,0,1 -0,0,1 0,0,1 0,0,1 0,0,1 -1,-0,0 -1,-0,0 -1,-0,0 -1,0,-0 -1,0,-0 -1,0,-0 -0,0,1 -0,0,1 -0,0,1 0,-0,1 0,-0,1 0,-0,1 1,0,0 1,0,0 1,0,0 1,0,0 1,0,0 1,0,0 0,2.18554e-005,-1 0,2.18554e-005,-1 0,2.18554e-005,-1 0,2.18554e-005,-1 0,2.18554e-005,-1 0,2.18554e-005,-1 -1,-0,0 -1,-0,0 -1,-0,0 -1,0,-0 -1,0,-0 -1,0,-0 1,0,0 1,0,0 1,0,0 1,0,0 1,0,0 1,0,0 0,2.18554e-005,-1 0,2.18554e-005,-1 0,2.18554e-005,-1 0,2.18554e-005,-1 0,2.18554e-005,-1 0,2.18554e-005,-1 0,-1.65202e-006,1 0,-1.65202e-006,1 0,-1.65202e-006,1 0,-1.65202e-006,1 0,-1.65202e-006,1 0,-1.65202e-006,1 -1,0,0 -1,0,0 -1,0,0 -1,0,0 -1,0,0 -1,0,0 0,-1.65202e-006,1 0,-1.65202e-006,1 0,-1.65202e-006,1 -1.88289e-014,-1.65202e-006,1 -1.88289e-014,-1.65202e-006,1 -1.88289e-014,-1.65202e-006,1 1,0,0 1,0,0 1,0,0 1,-0,0 1,-0,0 1,-0,0 -0,-1.65202e-006,-1 -0,-1.65202e-006,-1 -0,-1.65202e-006,-1 -1.88289e-014,-1.65202e-006,-1 -1.88289e-014,-1.65202e-006,-1 -1.88289e-014,-1.65202e-006,-1 -1,0,0 -1,0,0 -1,0,0 -1,0,-0 -1,0,-0 -1,0,-0 1,0,0 1,0,0 1,0,0 1,-0,-0 1,-0,-0 1,-0,-0 -0,-1.65202e-006,-1 -0,-1.65202e-006,-1 -0,-1.65202e-006,-1 0,-1.65202e-006,-1 0,-1.65202e-006,-1 0,-1.65202e-006,-1 "
									TextureCoordinates="0,0 0,1 1,0 1,1"
								/>
						
                    </GeometryModel3D.Geometry>
                </GeometryModel3D>
            </Model3DGroup>