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.
Navigation
To translate the view, keep the t-key pressed then press the left mouse button and 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.
- Icosahedron to put a texture on.:
Adding a Texture
Perform the following steps:
- Open control panel by pressing CTRL-i.
- Add Texture with Method --> Texture --> Make Vertex Texture from XY in the main menu.
- Open texture panel by pressing CTRL-t.
- Choose texture file by clicking the Load button (or enter any valid URL in the textfield).
What happens in detail: 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.
- First method to put texture on the icosahedron.:
Alternative Method
Perform the following steps:
- Open control panel by pressing CTRL-i.
- Open Unfold dialog via Method --> Effect --> Unfold in the main menu.
- Unfold geometry with the Unfold button (do not close the dialog).
- Add Texture with Method --> Texture --> Add Vertex Texture from XY in the main menu.
- Open texture panel by pressing CTRL-t.
- Choose texture file by clicking the Load button (or enter any valid URL in the textfield).
- Refold geometry with the Refold button in the Unfold dialog.
What happens in detail: 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.
- Second method to put texture on the icosahedron.: