Horde3D
http://horde3d.org/forums/

Change part of texture of terrain
http://horde3d.org/forums/viewtopic.php?f=2&t=1853
Page 1 of 1

Author:  DnDiene [ 09.01.2013, 13:18 ]
Post subject:  Change part of texture of terrain

I want a large, flat terrain that is devided in 1x1 tiles. I want to be able to change the color of the tiles at runtime, so for example, I want the tiles to be red when they are near an enemy, and blue when they are near a player. How do I do this in horde3d?

I eventually want to be able to show at least 250x250 tiles on screen. Do I create 62k scenenodes for it? I'm quite new to horde3d and game rendering in general. I still find things like shaders, textures, materials and rendering pipelines hard to understand.

Thanks!

Author:  Roland [ 14.01.2013, 19:34 ]
Post subject:  Re: Change part of texture of terrain

DnDiene wrote:
I eventually want to be able to show at least 250x250 tiles on screen. Do I create 62k scenenodes for it? I'm quite new to horde3d and game rendering in general. I still find things like shaders, textures, materials and rendering pipelines hard to understand.

Hi.
I guess there are a lot of clever ways this could be achieved.
For example, if it is just a debug thing, have you considered drawing the tiles around your characters using plain OpenGL calls?

My Horde3D based suggestion would be to use a dynamic texture:
  • create an properly uv-mapped plane and import into your scene, 250x250 meters in size.
  • create a 250*250 pixels texture within your application using h3dCreateTexture.
  • set the new texture to the "albedoMap" sampler in the plane's material.
  • add Filter = None; in the model.shader file to the albedoMap-sampler definition to get "sharp boarders".
  • change the texture in your app depending on your characters' position.

Doing it like this, you almost don't have to worry about the pipeline or shaders at all. And you'll learn using custom textures and how to apply them to an object's material using the Horde3D API.
You'll lose texture filtering for all your albedoMaps, which easily avoidable by creating an new, simple shader for the plane.

Regarding the texture setup, this should be all you need to do (add H3DResFlags::TexDynamic when setting up the texture):
http://www.horde3d.org/wiki/index.php5? ... _a_texture
Just keep the default "albedoMap" sampler name for now, if you want to avoid messing with shaders.

Hope it helps. Cheers

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/