logo

Textures

This demo illustrates some possibilities to add textures to geometries within Javaview. We will start with a blank icosahedron and add a texture in two different ways.

Subsection: Navigation

To translate the view, keep the t-key pressed then press the left mouse button an move the mouse in the desired direction. By pressing the s-key, you can zoom the view by holding the left mouse button pressed and moving the mouse vertically. To rotate, press the left mouse button and move the mouse in the desired direction. The orbit rotate mode is preselected, so that you don't have to press any key simultanously. You can preselect a different navigation mode in the context menu of the viewer, which you can reach by pressing the right mouse button within the viewer. In this case you can use the orbit rotate mode by holding the o-key pressed.
You can open a new display in the context menu. On top of the new display you now have the main menu, which you can use to open the individual info panels and other options and functions of Javaview.

Summary
Translate hold t-key and left mouse button pressed and move mouse
Zoom hold s-key and left mouse button pressed, move mouse vertically to zoom
Rotate in Orbit Mode hold o-key and left mouse button pressed, move mouse to rotate
Preselect click right mouse button in viewer window to open context menu and select navigation mode
Open New Display click right mouse button in viewer window to open context menu and select "New Display"

Subsection: Adding a Texture

User Activity
  1. Open control panel by pressing CTRL-i
  2. Add Texture with Method --> Texture --> Make Vertex Texture from XY in the main menu
  3. Open texture panel by pressing CTRL-t
  4. Choose texture file by clicking the Load button (or enter any valid URL in the textfield

Now we will add a texture to the existing geometry. In order to do that, we first need to open the control panel. You can do that by opening the context menu with a click of the right mouse button and select Control Panel or by pressing CTRL-i. Now you can reach the main menu (if you opened a new display, you also have the main menu there).
In the main menu go to Method --> Texture. There you have several different methods to add a texture to the geometry.
For now select Make Vertex Texture from XY. This method will project the geometry onto the XY-plane, then map the texture on the projection.
Now open the texture info panel from the main menu, Inspector --> Geometry --> Texture or press CTRL-t.
You can enter the desired texture in the textfield Image File. In the textfield a path to a file on the server or any valid URL can be entered. Try the value "figures/zebra.jpg" as an example.
If you take a look at the texture now, you will notice that the texture is strongly contorted on some faces. This is caused by the projection on the XY-plane. The faces close to perpendicular to the plane will be strongly contorted, which carries on to the texture.
In the texture panel you can take a look at the texture mapping by enabling the Texture Image checkbox. There you can see how the geometry is mapped onto the texture. You can change that mapping by dragging vertices by holding the p-key pressed and clicking on a vertex.

Ikosaeder mit Textur

Summary
Open control panel Open the context menu with a click of the right mouse button an choose Control Panel or simply press CTRL-i
Add texture In the main menu, Method --> Texture --> Make Vertex Texture from ..., open the texture panel in the menu Inspector -> Geometry -> Textur or press CTRL-t Enter the texture file name in the textfield Image File.
View texture Mapping Open the texture panel in the main menu, Inspector --> Geometry --> Texture or press CTRL-t and then enable the Texture Image checkbox.
Pick and drag vertex While holding the p-key (or choose Pick Vertex in the context menu), click and drag a vertex.

Alternative Method

User Activity
  1. Open control panel by pressing CTRL-i
  2. Open Unfold dialog via Method --> Effect --> Unfold in the main menu.
  3. Unfold geometry with the Unfold
  4. button (do not close the dialog).
  5. Add Texture with Method --> Texture --> Add Vertex Texture from XY in the main menu.
  6. Open texture panel by pressing CTRL-t
  7. Choose texture file by clicking the Load button (or enter any valid URL in the textfield.
  8. Refold geometry with the Refold button in the Unfold dialog.

To avoid contortions on the texture, we could first try to unfold the geometry onto the XY-plane and then add the texture. In the following we will do just that. First you can remove the current texture in the main menu via Method --> Delete --> Remove Texture.
Then we use a built-in effect of Javaview, this we will get in the main menu through Method --> Effect --> Unfold Geometry. Upon that a dialog opens with which we can unfold the geometry. At the bottom are two buttons, Unfold and Refold, those unfold and refold the geometry respectivly. With the Start button you can animate the effect and stop it with the Stop button.
First unfold the geometry completly (i.e the Time textfield has a value of 100). Now, without closing the Unfold dialog, add a texture just like before. Since now the texture is already flat on the XY-plane, there will be no more contortions.
Finally, you can refold the geometry with the Refold button in the Unfold dialog and you will have a texture on the geometry that is not contorted.

Unfolded Geometry with Texture

Summary
Remove texture In the main menu, Method --> Delete --> Remove Texture
Unfold geometry

In the main menu, Method --> Effect --> Unfold Geometry, a dialog opens with which you can control and animate the unfolding process.

Animate unfolding In the Unfold dialog control animation with the Start and Stop buttons.
© 1996-2015 Last modified: 07.05.2013 --- www.javaview.de --- The JavaView Project