Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Changing the Surface Appearance of a 3D Object

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

By default, new 3D objects have solid, single-colored surfaces. To change the appearance, you must apply a texture to the 3D object. A texture is a 2D image that you wrap around a 3D object.

What to Use

Use the following block diagram objects to change the surface appearance of a 3D object:

What to Do

Create the following block diagram to programmatically change the appearance of a 3D object.
Customize the gray sections for your unique programming goals.

The following list describes important details about the previous diagram:

Obtain a reference to the 3D object whose appearance you want to change. Your programming goals determine how you obtain this reference. The most common way to obtain a 3D object reference is to create a new 3D object. This example obtains a 3D object reference by creating a new 3D box.
The Specials:Texturing property enables a 3D object to have a texture. If you do not set the Specials:Texturing property to On, you cannot apply texture to a 3D object. If the object to which you want to apply the texture is a child of another object, you can set the Specials:Texturing property to Inherit Value to inherit the texture settings of the parent object.
Obtain LabVIEW image data that defines the texture you want to appear. Use one of the following ways to obtain LabVIEW image data:
  • To convert a standard image format such as JPG to LabVIEW image data, use the appropriate Read VI from the Graphics Formats palette.
  • To access an image that is part of a pre-existing 3D object, use a 3D picture control property or method.
  • To define a custom image, create an image cluster.
This example uses the Read JPEG File VI to convert a JPG file to LabVIEW image data.
The Texture VI converts the LabVIEW image data to a SceneTexture reference. You must convert image data to a SceneTexture reference so that you can interact with SceneTexture properties and methods to change the way that the texture appears on a 3D object.
The Apply Mode property specifies how the texture appears on a 3D object. If you do not set the apply mode for the texture, LabVIEW applies the texture with blending, where the image data blends with the background color of the object. If you want the texture to retain the coloration of the original 2D image, set Apply Mode to As a Decal or As a replacement. This example uses the Apply Mode property of the texture to specify that the texture image appears with its original colors as a decal.
The Texture:Set Texture method assigns a texture to the referenced 3D object.
Use the SceneObject reference to display or manipulate the new 3D object. You can use this reference to achieve the following goals:
  • To display the 3D object—Create a 3D picture control from the front panel and wire the reference to the associated block diagram terminal.
  • To control the size and position of the 3D object—Wire the reference to one of the Transformation VIs.
  • To add the object to multi-object 3D scene— Use the reference to create a 3D scene that contains multiple 3D objects.
  • To interact with other attributes of the 3D object— Wire the reference to a SceneObject property or method. These properties and methods control attributes and behaviors of the 3D object, such as its color, light source, and texture.
This example displays the textured 3D object by using a 3D picture control.

Tips and Troubleshooting Information

  • You can create more complex textures. Use the SceneTexture properties of the SceneTexture reference to configure other texture settings, such as the filter mode, horizontal or vertical wrap mode, and transformations to apply to the texture.
  • Does the texture unexpectedly appear on multiple 3D objects in the scene? You may have applied the texture to the parent object in a hierarchy of 3D objects. Changes to a parent 3D object apply to all children of that object. To fix this problem, apply the texture to the child object reference rather than to the parent object reference.
  • Does the texture not appear at all? The Specials:Texturing property must resolve to the On value, whether because you directly set the property to On or because it inherits the On value from its parent. Verify that you set the Special.Texturing property to an appropriate value.
  • Does the 3D picture control appear as a refnum on the front panel? You must create the 3D picture control from the front panel, not from a terminal on the block diagram. After you create the 3D picture control from the front panel, wire the associated block diagram terminal to a SceneObject reference to display the referenced object.
  • Can you not interact with the 3D picture control on the front panel? You must configure a camera to view a 3D scene from different perspectives.
  • Always wire error in and error out terminals. The example in this topic omits error handling to emphasize programming logic, but error handling enables debugging and controls data flow.


Refer to the 3D Model of Solar System VI in the labview\examples\Graphics and Sound\3D Picture Control directory for an example of a 3D scene that contains objects with textures.

Related Topics


Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit