Switching Renderers

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Switching Renderers

      So, I was wondering if I was correct about the following strategy when switching DirectX to OpenGL and viceversa renderers.

      When switching between this two "renderers" we need to change how the coordinates behave, i.e. UV coordinates, Normal directions, etc.

      My plan is to recalculate everytime the user wants to switch between "renderers". But then I started thinking about this whole process and how long and impractical it seems. So, the other strategy I could think of is saving the data for each renderer.....which doesn't soun practical either.

      What are you guys' opinion on solving this issue?

      PS. Don't be afraid to elaborate......
      Intel i7 3930k
      8GB Mushkin LP @ 2133 mhz
      GTX 680
      Asus Rampage IV Extreme
      Corsair 650w
    • The only difference in coordinate systems that you need to worry about is the Z direction (handedness), I suggest you do everything for one coordinate system and simply negate the Z for translations for the the other system. Maybe its not as simple as that but thats where I would start.

      You can also change the winding order and other settings from the defaults (at least in OpenGL), which would be much more practical then recalculating your actual data.
      PC - Custom Built
      CPU: 3rd Gen. Intel i7 3770 3.4Ghz
      GPU: ATI Radeon HD 7959 3GB
      RAM: 16GB

      Laptop - Alienware M17x
      CPU: 3rd Gen. Intel i7 - Ivy Bridge
      GPU: NVIDIA GeForce GTX 660M - 2GB GDDR5
      RAM: 8GB Dual Channel DDR3 @ 1600mhz

      The post was edited 1 time, last by mholley519 ().

    • How about for the normals though? I calculate my own normals and the cross product would give different results.

      EDIT:
      I guess I could just flip them by negating them, but then again that will also require some calculation!!
      Intel i7 3930k
      8GB Mushkin LP @ 2133 mhz
      GTX 680
      Asus Rampage IV Extreme
      Corsair 650w

      The post was edited 1 time, last by hondero ().

    • You mean for lighting? I don't honestly see why it would make any difference, depending on how you generate your normals, if you are generating them at run time, have it so that you go backwards in winding order otherwise the cross product would be backwards, however if you are using normals loaded from a map I don't see why it would be different, maybe Im wrong.
      PC - Custom Built
      CPU: 3rd Gen. Intel i7 3770 3.4Ghz
      GPU: ATI Radeon HD 7959 3GB
      RAM: 16GB

      Laptop - Alienware M17x
      CPU: 3rd Gen. Intel i7 - Ivy Bridge
      GPU: NVIDIA GeForce GTX 660M - 2GB GDDR5
      RAM: 8GB Dual Channel DDR3 @ 1600mhz
    • Switching renderers, or rendering quality, during the game typically requires invalidating and reloading every visible object. You'll probably store objects in a format that loads quickly in the most likely renderer setting, and does any conversion during the load for renderer configurations that require something different.

      Is is also possible to "pre-bake" objects with a directly loadable format for DirectX or OpenGL, which trades off a larger build or download size for a faster load.
      Mr.Mike
      Author, Programmer, Brewer, Patriot
    • Why do you want to switch renderers? The answer to that question will likely determine the strategy you use. For example, I believe we baked all the assets in The Sims Medieval for DirectX vs OpenGL because we only used OpenGL for the mac version.

      -Rez
    • I guess switching renderers at run-time will give the user the ability to use different APIs to render the game scenes and see which one performs the best. Or maybe I will just create that ability for the programmer(me) to debug the application with different APIs.

      I've also noticed games that you can go into advanced settings and switch between OpenGL and DirectX. I believe Crysis lets you do this.
      Intel i7 3930k
      8GB Mushkin LP @ 2133 mhz
      GTX 680
      Asus Rampage IV Extreme
      Corsair 650w
    • The vast majority of gamers don't know nor do they care what renderer is used. What's your goal with this? Are you just playing around with graphics and switching around renderers to teach yourself about graphics programming? Or, are you trying to make a real project and finish a game? Either answer is totally valid, but my advice changes based on your goal.

      If you're trying to teach yourself graphics programming, I'd reload the all the objects and fix them up on load. This will do more to teach you about handedness and how to swap between them. It will also force you to write robust code to reload the renderer at runtime.

      If your goal is to complete a game, I think you shouldn't do this at all and just choose one to use, which will allow you to actually concentrate your game.

      -Rez
    • Rez, my goal is...both! I guess I will prioritize on "learning" about both APIs but I also want to finish the game.

      I guess when I'm done creating the game itself I can concentrate more on the "switching renderers" part.
      Intel i7 3930k
      8GB Mushkin LP @ 2133 mhz
      GTX 680
      Asus Rampage IV Extreme
      Corsair 650w

      The post was edited 1 time, last by hondero ().

    • Fair enough. :) My point is that if you try to do everything, you will end up finishing nothing. You should concentrate on finishing your game. For the next project, choose one or two new technologies you want to add, such as switching renderers. The most common mistake I see in aspiring game developers is a lack of finished projects, usually due to trying to finish too much.

      -Rez