Graphics.NewbieCubeTexturing - lordmundi/wikidoctest GitHub Wiki

Newbie Cube Texturing

« Extending Doug With Tcl Commands | NewbieIndex | Clone Cube With Open GL »

Intro

This shows how to add a texture to the cube. We'll make the cube a single die (one dice).

Gimp The Texture Image

I used the gimp to make the texture.

New Image

Each side of the cube will be 800×800 pixels. Create a new image that is 2400×1600. [Create New Image][5]

![][6]

Make A Single Divut

To do this, I made a new brush with a 100 pixel radius. So that the edges are crisp, I made the hardness 1.00. [Create Brush][7]

![][8]

Create Single Image With Divuts

I just eye-balled where to put the divuts. Here is the final image as a PNG.. [Dice Texture][9]

![][10]

Enhance

Once I had the image, I blurred it to get rid of some of the blocky edges on the divuts. Choose: Filters -> Blur -> Blur

RGB Format Important

Doug has to have the texture in *.rgb format. Just save the image with the *.rgb extension. Here is the [dice-texture.rgb][11] in *.rgb format.

Modified Cube With Texture Coords

Coords For Duece

Each face of the cube will be mapped with a region of the texture image. Coords for the duece are shown in the following image. [Duece Texture Coords][12]

![][13]

New Cube With Texture Coords

Here is a modified version of the cube: [dice.ac][14]. Note that the second face with vertices 4 7 6 5 has the coords for the duece.

Configure Doug

% cd ${USERDATA}
 % cp [dice.ac][14] models
 % vi user.cfg
   Change:  node( CUBE ) ; model (cube-vangogh.ac) ; parent( CUBE_BASE ) ;  # or whatever yours looks like
       To:  node( CUBE ) ; model ([dice.ac][14]) ;         parent( CUBE_BASE ) ;
 % mkdir ${DOUG_HOME}/textures
 % cp [dice-texture.rgb][11] ${DOUG_HOME}/textures
 % rm user.cfg
 % ln -s dice.cfg user.cfg

Run Doug

% cd ${DOUG_HOME}
 % rm cache/eng_graph.update ; # Make sure Doug isn't pulling out of the cache
 % ./run_graphics &

[Doug Dice][15]

![][16]

Caveats

I had a number of issues getting this to work. Here are some issues:

  1. Using ac3d to build the model and applying a texture didn't transfer to Doug
  2. The shape of the texture image seems to be important for Doug. When I used a long skinny image it didn't work.
  3. Use *rgb files for texture
  4. In the *.ac model file, use a relative path from $DOUG_HOME for the texture image file
  5. I had to put the texture image in ${DOUG_HOME}/textures

« Extending Doug With Tcl Commands | NewbieIndex | Clone Cube With Open GL »

[5]: javascript:toggleObj('gimp_new','hide','Create New Image','Hide','') [6]: dice-image-gimp-new.png "" [7]: javascript:toggleObj('gimp_one_divut','hide','Create Brush','Hide','') [8]: dice-image-gimp-create-brush.png "" [9]: javascript:toggleObj('gimp_dice','hide','Dice Texture','Hide','') [10]: dice-texture-reduced.png "" [11]: dice-texture.rgb [12]: javascript:toggleObj('gimp_texture_coords','hide','Duece Texture Coords','Hide','') [13]: dice-texture-coords.png "" [14]: dice.ac [15]: javascript:toggleObj('die_doug','hide','Doug Dice','Hide','') [16]: doug-dice.png ""