How to work with 3DPI - Example One. Docs | Last | Next
C. Coloring the Cube

The new created Cube is nice as is, but perhaps you need to know why it is checkered red and white and how to change the colors.
These next steps give the reason for the Cubes appearance, how to colorize it, and simple ways to create shaders.

  • Reason for the red and white checkerboard appearance
  • Change the shader to one color
  • Colorize each side of Cube
     

  • Reason for the red and white checkerboard appearance top


    Responsible for the visual appearance of a model regarding its light-behavior, colors, and the reason about pictures that can appear on its faces, is the Shader.
    The 3DPI shows quickly why the Cube has a red and white checkerboard appearance.

    Look at the property "shaderList".

    (The Model-TAB is still active.)

    A box has 6 sides. The number "6" beside the shaderlist.count entry in the 3DPI reveals that each side of the model can be displayed differently by assigning a different shader to each side. The value beside "shaderList" is currently showing "ALL" and the 3DPI shows which shader is used for all the sides of the model: it is the "DefaultShader".

    Click the grey gradient button to the left of shaderList.count.

    This icon works like a hyperlink. The 3DPI now selects the Shader-TAB and automatically activates the "DefaultShader".

    The bottom part of the 3DPI displays new properties, the properties of a shader of type #standard.

    One important property of the shader is the #texture resp. #textureList. In the PopUp next to it, the 3DPI displays "DefaultTexture" meaning the default texture is used for this shader.

    Click on the texture button on the left.

    Now the 3DPI navigates to the Texture-TAB displaying the only existing texture in the name list, the "DefaultTexture", that is automatically selected recognized by a white hilite.
    The bottom part of the 3DPI is filled with new properties and you ask yourself "What is this Texture about?"
     

    Click on the "Preview" Button on the bottom.

    A red-and-white picture appears, scaled up to fit into the preview area. This is the image of the "DefaultTexture".

    A texture is an object within the shockwave3D world, which stores images; images a shader can use to display on a models face.


    Changing the shader to one color top
     
    The easiest way to display a model in one color only is to use a shader without texture and to change the color of the shader. The Cube in this example has the default shader assigned to all its faces. Changing two properties of this shader is the quickest way instead of creating a new shader.
    1. Click on the Shader-TAB.
       
      The "DefaultShader" is selected again, and it´s properties and values appear in the bottom part of the 3DPI.
       
    2. Set the texture property to "void" by selecting "void" from the PopUp beside the property #textureList.

      This is the way to switch the connection to the texture off. The shader uses no texture, no image anymore and the box looses the checked appearance.
       
    3. Change the diffuse color.
       
      Simply click the little square left of the field which displays the color value and a PopUp color palette displays allowing you to choose a new color value quickly or you can type a new RGB or Hexadecimal color value inside the displayed field.
       

    That´s it.




    Colorizing each side of the Cube top

     
    For a models sides, different appeearances; different Models; different shaders are needed.

    1. Click on the New Button to open the dialog for creating a new shader.
       
      A dialog box will open asking for a name and type of the shader.

    2. Type "blueShader" for the name in this dialog. You could leave the name as suggested by the 3DPI, but in this case it might be better to change it .
       
    3. Select the #standard Radio Button within the dialog.
       
    4. Click "OK" to close the dialog box and to create the shader.
       
      The new created shader appears in the name list, and is automatically selected, the shader properties displayed.
       
    5. Set the texture property to void by selecting "void" from the PopUp beside the property #textureList.
       
    6. Change the diffuse color to blue.
       
    7. Repeat steps 1 to 6, name the new shader "greenShader" and select green for the diffuse color.

    TIP:
    Clicking the "New" Button while holding down the option key (= alt key) the dialog will be skipped.
    A new shader is automatically created and named by the 3DPI: "shader_1", "shader_2", and so on. The shader type will automatically be the same as choosen within the dialog.
    The dialog can also be skipped on a PC by clicking the right mouse Button on the "New" Button.


     
    3 shaders now exist all using different colors for the diffuse property. Here you can click the names of the shaders in the 3DPI name list, switch the selection, and watch or change the diffuse color for each shader.

    Until now the Cube had nothing to do with the shaders. Assign the newly created shaders to the Cube:

    1. Select the Model-TAB.
       

       
      The 3DPI navigates to the Model-TAB, automatically selects the model and displays its properties. 

    2. Assign a different shader to each side of the box.
       

       
      Type a number in the left field, one by one from 1 to 6, and choose a shader from the drop down box on the right side. The final combination can appear this way:
      1 (front) ... blueShader
      2 (right) ... DefaultShader
      3 (back) ... blueShader
      4 (left) ... DefaultShader
      5 (top) ... greenShader
      6 (bottom) ... greenShader
      In this example, the sides 3, 4 and 5 of the model are currently the "front visible" sides.
    That´s it.   

    Last: B. Creating a Cube. Next: D. Animating the Cube.