Render to Terrain Texture
by Taras Podoroga · in Torque 3D Professional · 05/25/2013 (2:35 pm) · 4 replies
What i want:
Once every couple of seconds i want to render polygons on terrain base texture.
What i have:
I used this RTT resource www.garagegames.com/community/resources/view/22204. It has object that registers a texture with particular name, renders to it, and then you can use that texture name to create materials. And it works great. I create terrain material and set diffuseMap to my RTT texture. Then i import a terrain assigning it this material. And it works, but the terrain doesnt animate while the RTT texture does. I wonder how can i "update" terrain texture. I know its possible, because if i go to world editor and start painting on terrain it updates terrain texture from RTT texture. So there is some code already implemented to do it. I just dont understand terrain internals good enough to find it.
So im hoping somebody who knows terrain system inside out can tell me what function to call, or set which flag to tell terrain to update its base texture.
Once every couple of seconds i want to render polygons on terrain base texture.
What i have:
I used this RTT resource www.garagegames.com/community/resources/view/22204. It has object that registers a texture with particular name, renders to it, and then you can use that texture name to create materials. And it works great. I create terrain material and set diffuseMap to my RTT texture. Then i import a terrain assigning it this material. And it works, but the terrain doesnt animate while the RTT texture does. I wonder how can i "update" terrain texture. I know its possible, because if i go to world editor and start painting on terrain it updates terrain texture from RTT texture. So there is some code already implemented to do it. I just dont understand terrain internals good enough to find it.
So im hoping somebody who knows terrain system inside out can tell me what function to call, or set which flag to tell terrain to update its base texture.
#2
If i undestand how decals work correctly, they create a mesh which copies the mesh they are projected on. So if I cover whole terrain with decals they will generate huge amount of geometry which will slow everything down. Besides i dont know how to create decal which will project only on terrain, not on everything.
Still if anybody knows ho to do render real time animated texture to terrain, please share.
05/26/2013 (9:54 am)
The thing is, i dont really need real time animation, though it would be cool. What i want is the ability to project some information on terrain to assist me with level design.So when i do some editing, polygons on terrain would update to reflect those changes.If i undestand how decals work correctly, they create a mesh which copies the mesh they are projected on. So if I cover whole terrain with decals they will generate huge amount of geometry which will slow everything down. Besides i dont know how to create decal which will project only on terrain, not on everything.
Still if anybody knows ho to do render real time animated texture to terrain, please share.
#3
I did go in and test this with a terrain texture. You are right in that it does not update on the terrain. I can it updating in the material preview, but not on the actual terrain. You will have to look at the terrain editor code to find out how it actually works to create the tool you want.
Funny thing is that in edit mode it will update the terrain for a split second so you can see the waveform, but after you leave the editor it goes black again. So it is doing something funny with the material that other objects to not do. If you do figure this out please post the changes. I would be really nice to be able to dynamically update terrain textures too.
Thanks, for checking out the resource.
05/27/2013 (12:23 am)
Hey Taras,I did go in and test this with a terrain texture. You are right in that it does not update on the terrain. I can it updating in the material preview, but not on the actual terrain. You will have to look at the terrain editor code to find out how it actually works to create the tool you want.
Funny thing is that in edit mode it will update the terrain for a split second so you can see the waveform, but after you leave the editor it goes black again. So it is doing something funny with the material that other objects to not do. If you do figure this out please post the changes. I would be really nice to be able to dynamically update terrain textures too.
Thanks, for checking out the resource.
#4
05/27/2013 (12:33 am)
I just played a bit and when editing the terrain materials by using a brush will update the RTT texture onto the terrain, however it is not going to be what you are looking for I think.
Torque Owner Lukas Joergensen
WinterLeaf Entertainment
There could be some performance reasons as to why this isn't possible OOTB, can anyone clarify if this is the case?
I can see how it could be useful tho, a little bit of animation on the terrain texture could be cool, but alternatively you can use decals, just spawn them where you want your polygons to be.