AB4D Forum

Full Version: Different images for each face of a cube
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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"/>