ofMaterial with custom normal mapping and displacement


I am working on lighting and usually write my own shaders to handle light calculations, vertex and other calculations. Was hoping to leverage the power of ofMaterial, ie. OF setting all of the light uniforms and utilizing the light functions, ie pointLight.
Looking at these two shader files,

Seems like you can set some postFragment code and uniforms.
What is the best practice for utilizing ofMaterial and using custom shader operations, ie calculating a normal from a texture?
Thank you!

When I try the following it still uses the shader from ofMaterial


But when I write a make ofMaterial getShader() function virtual, I can get it to work using

class CustomMaterial : public ofMaterial {
const ofShader & getShader(int textureTarget, bool geometryHasColor, ofGLProgrammableRenderer & renderer) const override {
     return *shaderPtr;
shared_ptr<ofShader> shaderPtr;

Then I know that the bound shader is from the material

shader->setUniformTexture("mapDiffuse", texturePacks[texturePackIndex]->textureDiffuseMap, 0 );