Friday, June 16, 2017

OpenTK Example - FBO / Render Target TV

Available on Github

This is a small example of how to use a framebuffer object (sometimes the output is called a render target, although that's more of a DirectX term) in OpenTK. There's a second camera in the scene with its position indicated by the arrow. What that camera sees is put into a texture and then displayed on a model of a TV.



This is also significant because it allows us to get the depth information of the scene. This allows us to create shadows later by easily determining if there is an object closer to the light (which would have a camera "seeing" from its direction above or in the scene), and darkening parts where that is true.

Controls:

  • WASDQE - Move main camera
  • UHJK - Move texture camera
  • C - Switch between color view and depth view
  • V - Toggle TV static shader on/off

2 comments:

  1. Hi !

    I'm learning opentk in c#m do you have good document for this.

    Thanks !

    ReplyDelete
  2. You actually make it appear really easy along with your presentation however I to find this
    topic to be actually one thing that I feel I would never understand.
    It kind of feels too complex and very vast for me. I am taking a look forward in your subsequent submit,
    I will try to get the cling of it!

    ReplyDelete