Multiple "textures" on one scene

Hiho Java2D folks.

I want to create some smooth landscapes in Java, and I found some cool techniques for terrain rendering called procedural texturing. The idea behind this is simple. Just paint an image which represents all the “textures” you want to draw. I adapted this for Java2D and got some nice results.

The “map” image: http://kieselsteini.de/BILDER/bla.png
The resulting map: http://kieselsteini.de/BILDER/result.jpg

As you see, everything which was blue is now water etc, etc, so every color of the RGB Map is “mapped” to one “texture”.

This works wonderful, even if the map is much smaller as the resulting rendered image. But I’ve one big problem. This way I could only display 3 different textures at once. How can I increase this? Any suggestions?

Geetings,
steini

Looks good, similar technique as texture splatting I guess.

Personally I think you’ll be best making a custom tool to paint your landscapes and writing to your own file format. As you’ve found (ab)using image files for your map data isn’t going to scale very well due to their limited structure. A basic painting tool would be pretty easy to knock up in Swing.

You can represent many values with an RGB image… just adjust the intensity. ie. include dark red, black, white, etc. any number of colours.

Or am i missing something here…

Juddman,

From what I see, the R00, 0G0 and 00B are the pure textures, and the mix of both are used to smooth the texture transition.

Hence, he can’t use other colors since any color RG0 will blend the dirt and grass textures.

kieselsteini,

As Orangy Tang said, you can use your own file format that uses more than three values, passing from RGB to ABCDEFG.

[quote]Juddman,

From what I see, the R00, 0G0 and 00B are the pure textures, and the mix of both are used to smooth the texture transition.

Hence, he can’t use other colors since any color RG0 will blend the dirt and grass textures.

kieselsteini,

As Orangy Tang said, you can use your own file format that uses more than three values, passing from RGB to ABCDEFG.

[/quote]
my side I would recommend to not change your technics, using a common paint tool as photoshop or other will be a lot more powerfull then creating your own one.

[s]one way can be to use a 4 channel map/image => ARGB

RGB => texture id (grass/water/etc)
A => texture strenght…[/s]

EDIT: hum you dont have to do anything more ? just use RGB => texture ID (grass/water/etc…) and use bilinear coefficient to compute how much is the texture and surrounding texture strenght

Use an image format that supports layers, and use 1 layer to store each texture mask.
It’s a much neater fit than misusing the images color channels as masks.
You would then be able to demo the result of your changes directly in the paint program, rather than having to run it through your code to see the result of your edits.

As for a popular & standardized file format that supports layers… you’ve got me. I’m sure google could help.

Fireworks supports layers and its native format is PNG, although that may be done with metadata trickery

http://lists.xcf.berkeley.edu/lists/gimp-user/2006-July/008287.html