Shader accessing multiple cameras?

Discussion in 'Game Development (Technical)' started by jefferytitan, Nov 25, 2016.

  1. jefferytitan

    Original Member

    Joined:
    Apr 22, 2006
    Messages:
    364
    Likes Received:
    1
    Hi all,

    I'm wondering if/how it's possible for a full-screen shader to access the buffer from a different camera. I'm trying to adapt a ray tracing shader for my needs, and the output of one camera doesn't contain enough info. In general is this possible? Do you have to round-trip the texture to the CPU, or can you do it all on the GPU?

    I'm working with Unity 5, but any general answers about whether it's possible are still appreciated.

    Cheers,
    JT
     
  2. LongRunGames

    LongRunGames New Member

    Joined:
    Jul 5, 2016
    Messages:
    17
    Likes Received:
    1
    I'm assuming your working with OpenGL as part of unity so that's what I'm gonna describe, you can render the scene twice from two different camera views, each to a different offscreen fbo, each fbo would contain the rendered colour buffer and depth buffer for each camera view, which could be passed to a shader as a 2D texture.
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer