SC4 Devotion Forum Archives

Other City-Building Games => [Archived] CityMania - Open Source Sim City => Other games => CityMania Graphics => Topic started by: Nique on September 06, 2009, 03:32:09 PM

Title: Terrain Textures
Post by: Nique on September 06, 2009, 03:32:09 PM
JonM, wants to help with graphics.

I have no experience with 3d programming / modeling, just done a handful of tutorials. But JonM wan'ts to know what resolution he must use for creating terrain textures. I would like to say that, of course we should use transition textures:

Textures for rivers and ocean terrain (not the water itself).
Textures for (mowed) grass (at least 4 types i think?)
Mud textures
Dirt textures
beach textures (white sand)
rock textures (for mountains)
forest ground textures (think about dead-leafs, branches)
(etc.)

I'm just talking about terrain textures. No 'lot' textures yet

Because we want this game to be customizable we should let a door open (in the programming part of texturing the terrain) for players to implant or even add their own textures. But because this is just the graphical section of the forums i would like to know in what resolution it would be wise to design.

JonM, if you have any questions, please ask it here.
Title: Re: Terrain Textures
Post by: croxis on September 06, 2009, 05:20:42 PM
512x512?
Title: Re: Terrain Textures
Post by: JonM on September 07, 2009, 06:51:01 AM
I would think 512x512 should be adequate for the closest zoom, so I'll just go ahead and develop some at that res, its a question of scale too. I mean the terrain is 3d, no? because you can have the 512x512 at .5 scale, which always looks much better. And so a 512x512 grass for instance should look like it would make sense at covering 256x256 of space. Follow me?



Title: Re: Terrain Textures
Post by: Korot on September 07, 2009, 07:51:13 AM
Yes, I do, you want to compress the texture to make more details to show through and to allow stretching on uneven ground to look better, right? But that number, is that in tiles/meters or something else, like pixels?

Regards,
Korot
Title: Re: Terrain Textures
Post by: Nique on September 07, 2009, 08:18:21 AM
Quote from: Korot on September 07, 2009, 07:51:13 AM
Yes, I do, you want to compress the texture to make more details to show through and to allow stretching on uneven ground to look better, right? But that number, is that in tiles/meters or something else, like pixels?

Regards,
Korot

pixels i think.

as far i know, the terrain will have 10x10 meter quads. (each point  = 10 meters)

1.0f -> 2.0f
Title: Re: Terrain Textures
Post by: Korot on September 07, 2009, 08:28:09 AM
Quote from: Nique on September 07, 2009, 08:18:21 AM
1.0f -> 2.0f

What does that line mean?

Regards,
Korot
Title: Re: Terrain Textures
Post by: Nique on September 07, 2009, 09:32:34 AM
Quote from: Korot on September 07, 2009, 08:28:09 AM
What does that line mean?

Regards,
Korot

Points in 3 dimensional space are floats

So 16 points from top left to bottom right (x = width, y = height, z = length):


point 00 = 0.0f(x), 1.0f(y), 0.0f(z)
point 01 = 1.0f(x), 1.0f(y), 0.0f(z)
point 02 = 2.0f(x), 0.0f(y), 0.0f(z)
point 03 = 3.0f(x), 0.0f(y), 0.0f(z)
point 04 = 0.0f(x), 1.0f(y), 1.0f(z)
point 05 = 1.0f(x), 1.0f(y), 1.0f(z)
point 06 = 2.0f(x), 0.0f(y), 1.0f(z)
point 07 = 3.0f(x), 0.0f(y), 1.0f(z)
point 08 = 0.0f(x), 1.0f(y), 2.0f(z)
point 09 = 1.0f(x), 0.0f(y), 2.0f(z)
point 10 = 2.0f(x), 1.0f(y), 2.0f(z)
point 11 = 3.0f(x), 0.0f(y), 2.0f(z)
point 12 = 0.0f(x), 0.0f(y), 3.0f(z)
point 13 = 1.0f(x), 0.0f(y), 3.0f(z)
point 14 = 2.0f(x), 0.0f(y), 3.0f(z)
point 15 = 3.0f(x), 0.0f(y), 3.0f(z)


Creates:
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fi5.photobucket.com%2Falbums%2Fy199%2FNe0que%2Fsimcity%25204%2Fbat%2Fdone2.jpg&hash=9fa3e3fea2919806ded4366fd4e60f8b44e6b067)


The distance between every float point (thats what the f means behind each number) is 10 meters


Now, we know that the terrain doesn't need to have float points on X and Z, only the height. If you change the X or Z number you will get different tile sizes. Therefore i only play with the Y axis of each point as we want to keep the tile sizes as they are:

point 00 = 0.0f(x), 0.8f(y), 0.0f(z)
The height(y)is now 8 meters instead of 10.

point 00 = 0.0f(x), 0.05f(y), 0.0f(z)
Here it is only 50 cm.

point 00 = 0.0f(x), 0.005f(y), 0.0f(z)
And here only 5 cm.


and so on...


Anyway, i think for the ease of programming, we should make a global agreement on the axises. The terrain defines the world, it define's every measuring unit for the rest of the game.

I prefer X and Y for Width and Length, and Z for height.
Title: Re: Terrain Textures
Post by: Korot on September 07, 2009, 09:57:38 AM
I agree with you on that last sentence, as I've learned at maths that the Z-axis is the height axis and gmax also uses Z for hight.

Regards,
Korot
Title: Re: Terrain Textures
Post by: Nique on September 07, 2009, 10:01:52 AM
Quote from: Korot on September 07, 2009, 09:57:38 AM
I agree with you on that last sentence, as I've learned at maths that the Z-axis is the height axis and gmax also uses Z for hight.

Regards,
Korot

I added it to the design document
Title: Re: Terrain Textures
Post by: Jonathan on September 07, 2009, 10:57:04 AM
Is it possible to create the terrain textures programmtically?
So there are no repeats?
Each tile is different to all the other ones?
Title: Re: Terrain Textures
Post by: Korot on September 07, 2009, 11:09:51 AM
Sure on could, by making a random amount of pixels active. It would work, but it would also look rubbish. In all seriousness, it could be possible, provided that the function which determines which pixels to turn on and which to leave off, gets info about the hight of the terrain, amongst others. However, doing so for a very large map might take a lot of time, and when you then Terra-form the terrain, causing it to display another texture, it would only slow down the game even more.

Regards,
Korot
Title: Re: Terrain Textures
Post by: tomkeus on September 07, 2009, 11:11:36 AM
Quote from: Jonathan on September 07, 2009, 10:57:04 AM
Is it possible to create the terrain textures programmtically?
So there are no repeats?
Each tile is different to all the other ones?

Besides, users have to have a way to make their own textures without being fractal programming gurus. Say for example, someone wants to build desert region.
Title: Re: Terrain Textures
Post by: croxis on September 07, 2009, 12:23:53 PM
In simcity a greyscale bitmap was used for tile height.  We can do the same but also add a color bitmap and a small text file which coordinates the color with a texture image.
Title: Re: Terrain Textures
Post by: Nique on September 07, 2009, 02:31:36 PM
Quote from: croxis on September 07, 2009, 12:23:53 PM
In simcity a greyscale bitmap was used for tile height.  We can do the same but also add a color bitmap and a small text file which coordinates the color with a texture image.

I think that's okay
Title: Re: Terrain Textures
Post by: Shadow Assassin on September 08, 2009, 07:19:22 AM
Quote
Besides, users have to have a way to make their own textures without being fractal programming gurus. Say for example, someone wants to build desert region.

They don't need to be fractal programming gurus if a means to create procedural terrain textures quickly and easily is implemented into the program.

All the user would need to do would be to choose the colours by using a colour wheel or something similar OR they could import textures (say, a grass texture, another grass texture, a rock texture, scree, etc etc) and then the game will shade the colours/implement textures based on elevation... so for instance you could have purple beaches and orange mountains if you so desired.

It's just an idea, but maybe look at how texture creation was implemented in Spore to get some ideas about how you could put in textures procedurally.
Title: Re: Terrain Textures
Post by: tomkeus on September 08, 2009, 08:04:50 AM
Quote from: Shadow Assassin on September 08, 2009, 07:19:22 AM
It's just an idea, but maybe look at how texture creation was implemented in Spore to get some ideas about how you could put in textures procedurally.

Well, if anyone volunteers to do fractals, great. I personally do not plan to do much about graphics. Right know, I have hands full of the population-related simulations. Up until now I managed to get my fellow virtual citizens to have sex and get children.
Title: Re: Terrain Textures
Post by: Nique on September 08, 2009, 03:47:30 PM
the main problem is, that we have to keep in mind what 'region type' we want to use. Because when one city takes different textures than the other, the region (or world) will look very ugly from above.
Title: Re: Terrain Textures
Post by: croxis on September 08, 2009, 04:49:09 PM
So that information should be stored at the region level, not within individual cities.
Title: Re: Terrain Textures
Post by: Nique on September 09, 2009, 09:47:38 AM
Quote from: croxis on September 08, 2009, 04:49:09 PM
So that information should be stored at the region level, not within individual cities.

Yes, tha'ts another improvement from sc4 point of view ;)
Title: Re: Terrain Textures
Post by: JonM on September 10, 2009, 04:10:52 PM
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fdigital-stone.net%2Fimg%2FGrassTest01.jpg&hash=8a67e9c7e8f19e446f4236b17b7a4d9d38dda605) This should repeat well. But I think ultimately there needs to be like a random tile with other textures so it doesn't look awful.

Nique, I sent you a high quality png
Title: Re: Terrain Textures
Post by: Korot on September 11, 2009, 03:07:22 AM
Perhaps several textures for the same hight and gradient and that the game randomly decides which texture to place on that tile? The textures would have to be able to be used next to each other, but I think that this would allow for a certain amount of randomness.

Regards,
Korot
Title: Re: Terrain Textures
Post by: tomkeus on September 11, 2009, 03:46:21 AM
Quote from: Korot on September 11, 2009, 03:07:22 AM
Perhaps several textures for the same hight and gradient and that the game randomly decides which texture to place on that tile? The textures would have to be able to be used next to each other, but I think that this would allow for a certain amount of randomness.

Something like this?

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fi4.photobucket.com%2Falbums%2Fy127%2Ftomkeus%2Ftextures.jpg&hash=6aef6a8dfde0909224accb64aae8e04114bfa377)

Number of compatible textures is created. For each texture, there is a list of compatible textures for each side which are seamless continuation. So when one texture is laid down, for each side there is a number of choices for neighboring pattern. This would give great freedom to achieve realistic, non-repetitive and detailed looking ground.
Title: Re: Terrain Textures
Post by: Korot on September 11, 2009, 06:04:28 AM
Something like that indeed, though I see two problems: a: a huge number of needed textures, b: how are you going to battle hight differences?

Regards,
Korot
Title: Re: Terrain Textures
Post by: tomkeus on September 11, 2009, 06:22:22 AM
Quote from: Korot on September 11, 2009, 06:04:28 AM
Something like that indeed, though I see two problems: a: a huge number of needed textures

Define huge. I mean, I don't plan to work on the graphics, but as much as I understand graphics (so I could be wrong), I don't see how applying 10-15 textures on the terrain are going to be a problem. I'm not certain if I understand you well, but if you think that separate copy of texture must be held in memory for each tile, than that is not how things work. If you haven't already, read a little about multitexturing.

Quote from: Korot on September 11, 2009, 06:04:28 AM
b: how are you going to battle hight differences?

Can you be a little more specific, I don' understand what are you trying to say.


And I would also like to make I suggestion about graphics engine. Let's use something that already exists, for example Irrlicht (I prefer Irrlicht over Ogre because it is more lightweight and not feature packed). It has inbuilt terrain rendering and creation from height-maps and provides utilities needed to do 2D graphics and mix it with 3D.
Title: Re: Terrain Textures
Post by: Korot on September 11, 2009, 06:26:12 AM
Huge: Hundreds or more, and I mean textures to make, the storage space for them isn't my problem right now.

And by hight differences I mean that a tile at sea level should have another texture then one at 1 km in hight. Also, the gradient (hight differences within the tile) is important, since a tile that raises 10m is steeper and needs another texture then a completely flat one.

Regards,
Korot
Title: Re: Terrain Textures
Post by: tomkeus on September 11, 2009, 06:45:44 AM
Quote from: Korot on September 11, 2009, 06:26:12 AM
Huge: Hundreds or more, and I mean textures to make, the storage space for them isn't my problem right now.

You don't need hundreds of textures to make realistic non repetitive terrain. As I sad, 10-15 or even 20-25, but certainly not 100, will suffice.

Quote from: Korot on September 11, 2009, 06:26:12 AM
And by hight differences I mean that a tile at sea level should have another texture then one at 1 km in hight. Also, the gradient (hight differences within the tile) is important, since a tile that raises 10m is steeper and needs another texture then a completely flat one.

OK, I get it now. I think all of that, with a little of thought put into it, can be accomplished with a small number of textures. Besides, we're not trying to make competitor to Bryce. I want to remind you that it would be very smart to try to stick to the KISS principle (http://en.wikipedia.org/wiki/KISS_principle), since non of us is professional game designer and has 0 experience working on large scale projects.
Title: Re: Terrain Textures
Post by: JonM on September 13, 2009, 01:38:13 PM
Ya, I think getting just a basic decent looking ground is key, it may not have height variation and that's probably ok for now, we just need it to not look so repetitive. An old technique for that is to have the textures randomly tile, and each one is slightly different, but the edges are the same. But thats all we really need for now I would say.

Title: Re: Terrain Textures
Post by: tomkeus on September 13, 2009, 01:44:56 PM
Quote from: JonM on September 13, 2009, 01:38:13 PM
An old technique for that is to have the textures randomly tile, and each one is slightly different, but the edges are the same. But thats all we really need for now I would say.

We can achieve a lot even with that. Only thing needed is good choice of basic textures. For example, we could have 4 light textures, 4 darker ones and 4 more even darker. They have some edges that match. This way random generator can tile one area with darker, other with lighter ones and so on, giving great appearance both on close zoom, both on far zoom.
Title: Re: Terrain Textures
Post by: freedo50 on September 13, 2009, 03:15:20 PM
Why don't you guys try contacting someone like Ennedi or C.p. (/Cycledogg) about how SC4's terrain textures work? In my eyes, the SC4 system is more than good enough (with some minor exceptions which could probably be worked out at a later date).

Just my $0.02.

Fred