AB4D Forum
Different images for each face of a cube - Printable Version

+- AB4D Forum (https://forum.ab4d.com)
+-- Forum: Products Forums (https://forum.ab4d.com/forumdisplay.php?fid=4)
+--- Forum: Ab3d.PowerToys (https://forum.ab4d.com/forumdisplay.php?fid=9)
+--- Thread: Different images for each face of a cube (/showthread.php?tid=48)



Different images for each face of a cube - z8195a - 07-09-2010

I need to generate cubes via code at run time and I used the Model3DFactory to figure out how to do that. I also need to use an image as the material for each cube. I saw the BoxVisual3D and figured out how to apply an image to a brush and then to a material.

My problem is that each of the six faces of the cube has to have a different image and the material is applied to the entire cube, resulting in the same image appearing in each face of the cube.

How can I apply a different image to each face of a cube?

FYI, I need to do this at run time. I don't know beforehand how many cubes I'll need to generate, their sizes, or what images will go on each face of each cube.


RE: Different images for each face of a cube - abenedik - 10-18-2011

This can be done very easily with MultiMaterialBoxVisual3D from Ab3d.PowerToys:
For example:
Code:
<visuals:MultiMaterialBoxVisual3D CenterPosition="-60 0 0" Size="46 56 13"
                                  FrontMaterial="frontImage.jpg"
                                  BackMaterial="Red"
                                  RightMaterial="Blue"
                                  FallbackMaterial="White"/>