One dynamic cubemap used by multiple models
I want to have a dynamic cubemap that gets used by different materials assigned to several models. I have already created an .sdf that uses a cubemap and a visual plugin that updates that cubemap in real-time. However, if I tell a separate model to use the same cubemap and material, its cubemap does not get updated. It appears it is loading a separate copy of the cubemap into memory. Is there any way to have both models reference the same texture in video RAM?
Asked by mogumbo on 2018-12-13 19:45:51 UTC
Answers
Finally found a reasonable solution. For every material script that needs my dynamic cubemap, I add to that material a texture_unit with a specific name. I give that name to the visual plugin that is generating the cubemap. After cubemap generation, I search all materials in Ogre's MaterialManager and assign the cubemap to any Ogre TextureUnitState with the appropriate name.
Asked by mogumbo on 2019-01-03 15:11:50 UTC
Comments
I have made some progress, but still could use some help on this. I am currently trying to use the same dynamic cubemap within various Ogre materials assigned to my various .sdf models. I am currently rendering my dynamic cubemap in a visual plugin, but this appears to be the wrong solution. When the cubemap is first created all the materials have already been created, and this is the wrong order to do things in Ogre if I want my cubemap to be available to my material scripts.
Asked by mogumbo on 2019-01-02 19:09:30 UTC
I tried converting the visual plugin to a world plugin to see if the texture would be created before the materials. However, I can use ConnectPreRender to set up a connection but my callback is never called. Perhaps prerender callbacks don't work with world plugins?
System plugins appear to be the wrong choice because they only apply to gzclient and I want to do off-screen rendering with gzserver too.
Suggestions are welcomed.
Asked by mogumbo on 2019-01-02 19:13:15 UTC