Menu â–¾ â–´

#32 Support for Vulkan NDC.

open
nobody
2018-03-18
2018-03-12
Anonymous
No

Originally created by: cheako

https://matthewwellings.com/blog/the-new-vulkan-coordinate-system/

define GLM_DEPTH_ZERO_TO_ONE

define GLM_FORCE_LEFT_HANDED

Discussion

  • Anonymous

    Anonymous - 2018-03-12

    Originally posted by: recp

    It would be great to have that feature!

    Actually it is in TODOs but since I'm not working on Vulkan yet, I can't test it. Currently I'm working on a render engine (http://github.com/recp/gk) which is based on OpenGL. In the future I'll implement Vulkan API, I can't work on it until that time.

    If anyone want to implement it before me, it would be appreciated. Otherwise I will postpone this until I implemented Vulkan in my render engine.

     
  • Anonymous

    Anonymous - 2018-03-18

    Originally posted by: cheako

    From my research this should adjust OpenGL NDC to Vulkan NDC.

      mat4 oglproj;
      glm_perspective_default((float)extent.width / (float)extent.height, oglproj);
      /* This is for Vulkan, cglm is for OpenGL. */
      glm_mat4_mul((mat4){{1.0f, 0.0f, 0.0f, 0.0f},
                          {0.0f, -1.0f, 0.0f, 0.0f},
                          {0.0f, 0.0f, 0.5f, 0.5f},
                          {0.0f, 0.0f, 0.0f, 1.0f}},
                   oglproj, projection);
    
     
  • Anonymous

    Anonymous - 2018-03-18

    Originally posted by: recp

    Excellent! But in the future we should provide OPTION macro as your first proposal like glm e.g. GLM_DEPTH_ZERO_TO_ONE, GLM_FORCE_LEFT_HANDED

    My main concern is this requires extra CPU cycles and memory :-S also makes codes more complex, I don't think someone would want to extra matrix multiplication

    Actually I don't need to Vulkan to implement ZER_TO_ONE check this answer:
    https://stackoverflow.com/a/21841924/2676533

    Traditional OpenGL behavior is:
    glClipControl (GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE);

    Direct3D behavior can be achieved through:
    glClipControl (GL_UPPER_LEFT, GL_ZERO_TO_ONE); // Y-axis is inverted in D3D

    I may try to change my render engine's NDC by glClipControl to implement Vulkan NDC later. Hope glClipControl is doing what I'm thinking.

    Since there are a lot of things to do in importer, renderer and cglm... I can't give a deadline for NDC configurations :( but I'll start working on it. I created a branch called ndc, maybe we should start implement Vulkan NDC asap. I will push Vulkan NDC related stuff to this branch. If you or/and others want to help to implementation (by codes, by comments, by reviews, especially testing it...), it would boost the process.

     

Log in to post a comment.

MongoDB Logo MongoDB