Game Development Community

Dynamically painting terrain texture?

by Norv Brooks · in Technical Issues · 08/17/2006 (5:36 pm) · 8 replies

Is it possible to paint terrain textures on the fly? What I want to accomplish is that after a wildfire (represented by fire particle emitters) pass through an area, I want the terrain to look burned. I have a feeling that the answer to my question is NO.

I've tried playing around with Decals and Debris, but have not had any success so far.

Thanks,
Norv

#1
08/17/2006 (6:26 pm)
This might help you with some minor changes

You can ask too, maybe if enough people show interest they might release it or sell it, either way I think it would be able to fix a lot of decal issues.

http://www.garagegames.com/mg/forums/result.thread.php?qt=48852
#2
08/18/2006 (7:39 am)
Ron - that URL takes me to the Torque Lighting Kit for TGE. Is that what you are referencing? I'm not sure I see the connection to decals.
Norv
#3
08/18/2006 (7:48 am)
Sorry Norv, but that was where the link was. Here is the other site that you should be able to see. Checkotu the paintball videos. With such a thing you could appliy decals to the ground that will properly conform to the terrain and can be done as many times as you would like.

bleedingedgeindie.blogspot.com/2006/07/gi10h-extreme-kork-paintball.html

It says it works on DTS objects but the applications are truly limitless for decal use.
#4
08/18/2006 (8:21 am)
Using TLK you can apply decal that will conform to ground.
#5
08/18/2006 (10:58 am)
The answer to your question is absolutely yes. Bit Shifter had dynamic terrain textures where "viruses" would creep over the terrain and you would have to deploy and protect little guys that would heal the infected areas of terrain. I'm not sure if there was any information out there on how they did this, but it is entirely possible, as it has been done.
#6
08/18/2006 (12:52 pm)
Hi Norv. I am the one who did the coding for Bit Shifter that did that particular terrain "trick".

The trick takes advantage of how the Terrain works.

A terrain is a 256x256 area, each "pixel" of which can be a texture or a combination of textures from the terrain texture set. This allows a texture to be built up by blending textures, etc.

In addition to this there is a "detail" texture that is a greyscale image that is blended into the terrain in an area around the viewer. This provides microdetail to look like there are small rocks & pebbles maybe on the ground, etc. It turns out that, though this texture is greyscale...it doesn't have to be. It makes no sense to use a colored detail texture, but the same technique can be used to blend a COLORED image onto the terrain.

Bit Shifter acheived it's red virus patches on the ground using a similar technique.

There were several parts to this becasue the game is a client/server architecture and so cilent's needed to be updated to changes to the Terrain.

1) I copied the code used for detail textures, adding a new VIRUS texture.

2) Where the rendering code makes a pass to add detail texture right after that there is another pass to add virus texture.

3) I created a 256x256 array of float values on the server called a "virus map" to store where virus should be shown.

4) I created client/server code to update a similar array on the client

5) Instead of proximity to the viewer (how detail texture decides how much detail to blend in) I use this virus map on the client to determine how much virus texture to blend in.

That is pretty much the 10,000 foot view of how it works.

You could certainly use a similar technique to overlay "burnt ground" texture.

Here are some details left out of the above 10,000 foot view:

a) I had to find a way to transmit the initial state of the map without putting TOO much data into one update packet. I used an RLE compression scheme.

b) similarly when the server told the client about changes to the virus map it only transmitted what had CHANGED.
#7
08/18/2006 (1:49 pm)
Paul - thanks for your quick response. I understood most of what you said. I'm going to have to look at the code with your response on the side and hopefully I'll be able to grasp the rest of what you said.

Once again thanks.
Norv
#8
08/19/2006 (8:30 am)
Norv,

I got your email askingn for more help. Unfortunately I don't have the time to explain it all. But here is what we can do: I see from your profile your a TGE SDK owner. So you have access to the SDK owner's private forum. GO start a topic in there about "dynamic terrain textures" or something and email me the link. In that private space I can post the files I used in Bit Shifter to make this sort of thing happen. Even though I will not be free to really explain it all other people are sure to also look at the files and help you out. It may even grow into a resource! I shared this code before with Robert Brower and he used it to make the Dynamic Terrain Deformation resource or whatever it was called. He was able to reuse quite a bit of what I did (client / server communication of which terrain location, etc) even though the purpose was very different (deforming the height of the terrain).

Start that private forum topic and email me a link.