[1.9] New Instance Manager custom colors

Problems building or running the engine, queries about how to use features etc.
Post Reply
WalterRed
Gnoblar
Posts: 9
Joined: Tue Aug 30, 2016 7:26 pm

[1.9] New Instance Manager custom colors

Post by WalterRed »

Hello,

I'm working on implementing instancing for my project and have gotten a basic understanding of how all the pieces fit together. Right now I have VTF instancing working with the robot.mesh and robot texture. I'm reading the wiki on the shaders portion as that is still a bit foggy for me but I'm wondering if there is a way to programmatically supply a custom color and pass that over to the instancing material/shader on the fly. What I want to achieve is the ability supply a color from lets say Windows color wheel and apply it to my instanced entities on a per InstancedManager basis. basically draw entities -> select color wheel-> pick color-> entities are now drawn that color.

Any thoughts or ideas on the matter would be greatly appreciated.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [1.9] New Instance Manager custom colors

Post by dark_sylinc »

HWBasic has support for per-instance custom params via InstancedEntity::setCustomParam. The parameter is passed to the vertex shader as an extra TEXCOORD(s); and you must have called at startup InstanceManager::setNumCustomParams to communicate your intention that you want per-instance parameters, and how many.

Please note that only the HWBasic implementation supports custom params.
WalterRed
Gnoblar
Posts: 9
Joined: Tue Aug 30, 2016 7:26 pm

Re: [1.9] New Instance Manager custom colors

Post by WalterRed »

Thanks dark_sylinc for the reply,

That sounds like a perfect solution to my problem. If there wasn't a setCustomParams option I was planning on creating small textures of various colors and using that in the material file. I'm glad I do not need to go that route.
Post Reply