140 likes | 151 Views
Learn how to create a custom island terrain in Unity by generating heightmaps using GIMP and Java, and import it for game development projects.
E N D
Terrains Creating an Island
Note water depth is actually a negative value. So we’ll set the land to be above sea level . . .
. . . by setting it to 36 (+5 above the deepest water value of -31).
Make a table of values (using a linear relationship). But keep the gray values between [0..255] inclusive.
Alternative: Creating binary terrains with Java • Use FileOutputStream for binary output. (System.out.println produces ASCII text output.) • Write a Java program that creates a file of 1000*1000 integer values in the range [0.255]. • Be creative. You may wish to use sin, cos, tan, pow, etc. • Load your file into GIMP. • Send and print your program and a screen dump of the result in GIMP to me.
Extra: • Simply check your raw file in GIMP by creating a .pgm file. Add the following to your code right before you write out the raw bytes: • String s = “P5\n1000 1000\n255\n"; • Using the FileOutputStream, write out the above before you write any raw data.
Bring your new Terrain into Unity • Terrain --> Create Terrain • Terrain --> Import Heightmap – Raw • Then proceed working on Chapter 2: Environments in Unity Game Development Essentials.