Hi, I am trying to figure out how to "simply" setup the rendering in ogre-next to get the proper output for my meshes. Current rendering using another library which is closer to ogre 1.x than ogre-next supports the multipass rendering and a single material can contain multiple configurations (each with its own setup of mutlipass rendering if needed). Let's consider a single box with material like:
- configuration A renders mesh with a single pass (VS + PS)
- configuration B renders mesh with 2 passes:
- render triangles with shaded output (e.g. like HlmsPbs)
- render mesh using GS to convert triangles to lines
- render triangles with shaded output (e.g. like HlmsPbs)
- etc - for the sake of example it is enough 2 configurations
Let's have camera 1 which renders box with configuration A and camera 2 with the configuration B. According to viewtopic.php?t=96902 it is necessary to create 2 instances of Ogre::Item to support 2-pass rendering as required by the material. So by the first camera it is necessary to hide one of the instances and keep only second instance.
Is it really the proper way? It just sounds too complex compared to Ogre 1.x. Through the Hlms::preparePassHash it is possible to select desired shaders according to the camera/compositor for each instance of Ogre::Item/SubItem, but then it is necessary to handle also visibility of the objects. Let's consider that I would like to have a class "rendering style / render mode" which I can set to the window - this defines how the objects are rendered in the window (it can be like "shaded" output (let's say same as HlmsPbs), "shaded" with edges (HlmsPbs + my own Hlms to output edges from the mesh), shaded with "thick" edges (HlmsPbs + 2 passes (thin edges + thick edges), hidden lines, etc.) - if I insert new object to the scene, I have to check the maximum number of passes needed by any possible rendering and insert the Ogre::Item so many times as number of rendering passes are required. Then per camera and its render mode setup the visibility flags of the Ogre::Item instances, etc.
What will be more suitable in my case, is to have still single Ogre::Item (and its Ogre::SubItem instances) in the SceneManager and somewhere during populating RenderQueue allow to insert multiple instance (multipass) of the same Datablock but with different properties active to create shaders through Hlms. I didn't check deeper the implementation of SceneManager/RenderQueue whether such "dynamic" multipass rendering is feasible, but only thinking loud the ideas..