Hello,
I am using the troika-three-text and rendering it to a GBuffer.
This is what I am doing right now -
const mat = new GBufferMaterial()
const gbufferMaterial = createTextDerivedMaterial(mat)
myText.customGBufferMaterial = gbufferMaterial
customGBufferMaterial is then used similar to customDepthMaterial.
This works and the text is rendered to gbuffer.
The problem here is that the _prepareForRender function in Text is called multiple times a frame to update the 2 sets of uniforms in both the materials, which is not ideal.
So, Is there a way to create a custom depth/gbuffer material similar to how customDepthMaterial is created?
Or a simpler way could be to call createDerivedMaterial ourselves but that requires access to the options object that is passed in createDerivedMaterial when its first called for the text.
Another way is to set the isTroikaTextMaterial to false, and copy the uniforms by prefix, but it is set as read-only and non-configurable, so that's not possible.
Thanks for the library.
Hello,
I am using the troika-three-text and rendering it to a GBuffer.
This is what I am doing right now -
customGBufferMaterialis then used similar tocustomDepthMaterial.This works and the text is rendered to gbuffer.
The problem here is that the
_prepareForRenderfunction inTextis called multiple times a frame to update the 2 sets of uniforms in both the materials, which is not ideal.So, Is there a way to create a custom depth/gbuffer material similar to how customDepthMaterial is created?
Or a simpler way could be to call
createDerivedMaterialourselves but that requires access to theoptionsobject that is passed increateDerivedMaterialwhen its first called for the text.Another way is to set the
isTroikaTextMaterialto false, and copy the uniforms by prefix, but it is set as read-only and non-configurable, so that's not possible.Thanks for the library.