How to change page material directly

Xavyiy

06-12-2007 21:32:45

Hi,

I need change terrain material, but very fast(on each frame) because I want to set "depth" material for render a depth map to be used in water...

I've tryied with mRendereableManager->getRenderable()->setMapMaterial but anything happens :S, any ideas?

thanks.

hotgloupi

08-12-2007 07:28:19

I think it not so hard :

1) you should get material page names (something like mSceneMgr->getOptions("MaterialPageName", ...), You'll find that on the forum and/or in source files)

2) you should rewrite terrain material to have a great shader that can take in account your depth map and some custom parameters

3) Instead of "changing the material" on each frame, you can pass some shaders parameters like a depth map, and other things you need

But in this way, you have a "global" material, and maybe your changes on the terrain are local, so you may search on "projective decal" or something like that :)
Good luck!

(plz let us know if it works or not, and explain globally your feature result;))

Xavyiy

08-12-2007 17:35:29

Finally I've used a second technique with "Depth" scheme, I think it's the easier way to do this.
It works perfectly!