This project is read-only.

how to implement render to target in Hieroglyph?

Apr 28, 2015 at 2:50 PM
hi Jason,

Would you outline the steps to create a "mini map" on the screen using render to target technique as described here ?

Apr 29, 2015 at 11:56 PM
For this, I think it would be possible to do this in two different ways. If the items in your mini-map are the same items in your regular scene graph, then I would create a custom view type for a mini-map. Then each object that should be rendered into the mini-map would supply a material that contains a RenderEffect for that view type (and any objects without such a RenderEffect would automatically not render into it).

Next you should create a scene object to represent the mini-map itself. This would be a screen aligned quad, and in the material for that object, you have to create and add the SceneRenderTask to the material. This will let the renderer 'queue' the mini-map's SceneRenderTask prior to the rendering of the main camera's scene render task. The render target can then be used in the main rendering pass as a shaded resource. This is a similar thing to how the Kinect samples have a scene render task for updating the shaded resources to be used in the main scene rendering.

Does this give you a partially clear view of how to implement the feature? If this sounds reasonable to you, then I can expand on the technique and provide some additional examples.
Apr 30, 2015 at 8:51 PM
yes, the Kinect example is helpful.
To make it more tangible, lets take the immediate rendering sample as the starting point. It already has a scene setup with a camera (lets call it main camera). I would like to show a mini map of the scene from another camera (lets call it second camera), would you please provide some bullet points on how to extend the sample? Thanks
May 13, 2015 at 5:55 PM
Sure, I will start at a high level and we can drill down in more detail as needed. Here are the main bullet points:
  • Create an actor to represent your mini-map (either an instance of the Actor class, or you can specialize it with a custom Actor subclass)
  • Add the actor to the scene.
  • Modify the VIEWTYPE enumeration to include a new entry called MINIMAP.
  • Create a new SceneRenderTask specialization that will be used for rendering the minimap. This can be largely similar to ViewPerspective, but just change the VIEWTYPE used during rendering to be MINIMAP.
  • Configure the minimap actor's material to have RenderEffect for the VT_PERSPECTIVE VIEWTYPE, but not to have a RenderEffect for the MINIMAP view type.
  • Create an instance of your new SceneRenderTask and add it to the mini-map actor's material entry for the VT_PERSPECTIVE view type.
  • Implement your custom rendering in the new SceneRenderTask, and configure your scene elements' materials to render accordingly into a MINIMAP view type.
Let's get started with this, and I can answer any questions as they come up.