Home | Tutorials | Wiki | Issues
Ask Your Question
1

One dynamic cubemap used by multiple models

asked 2018-12-13 18:45:51 -0500

mogumbo gravatar image

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?

edit retag flag offensive close merge delete

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.

mogumbo gravatar imagemogumbo ( 2019-01-02 18:09:30 -0500 )edit

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.

mogumbo gravatar imagemogumbo ( 2019-01-02 18:13:15 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-01-03 14:11:50 -0500

mogumbo gravatar image

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.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-12-13 18:45:51 -0500

Seen: 149 times

Last updated: Jan 03