GPUOpen-LibrariesAndSDKs/RadeonProRenderSDK

[Question] Rendering a scene with a 3D skybox

Derpius opened this issue · 0 comments

Context

  • I'm rendering Source engine BSPs which (usually) have a 3D skybox
  • These are implemented as:
    • Geometry stored in the same manner as the main world, with no distinction
    • A number of faces with a SKY flag set surrounding the main world
      • usually forming a cube without its bottom face, but can be more complex
    • A "sky camera" which defines the origin of the skybox coordinate space
  • At runtime, the game renders the player's view transformed to the skybox to a render target, which is then rendered to the sky faces in screen space
  • A somewhat technical definition of BSPs themselves for extra context:

Problems

  • Rays that hit sky surfaces need to be transformed to the skybox coordinate space (via the sky camera's transform and a scale factor)
  • If using the HybridPro plugin, the raster pass would (by my understanding) need to render the skybox perspective to an RT as the Source implementation does
    • Performing this render seems trivial, but compositing the RT into the view less so
    • It could be as easy as rendering the player's real view over the top of the previous RT, if we can count sky faces as misses or as alpha 0 (without rendering what's behind)
  • It's not possible to just remove the sky faces from the mesh, as the 3D skybox is usually placed directly above the main world
    • This causes the skybox vertices to be visible from the player's perspective
  • It's also not possible to accurately remove the 3D skybox vertices themselves, as they're indistinguishable from other geometry
  • If any of the ProRender plugins use bidirectional path tracing, then light rays for directional/ibl/etc lighting would need to start within the sky faces

Acceptable solution

If all of the above is not possible to solve with ProRender, the following would be enough to get a reasonable effect:

  • Count all rays that hit sky faces as misses
  • Discard all sky face fragments for the hybrid raster pass

This would prevent any erroneous rendering of the 3D skybox and would allow rendering the 3D skybox using the same method as Source (compositing two separate renders).

The only issue with this is that elements of the skybox wont affect the lighting of the main world (i.e. a tall building in the skybox wont cast a shadow outside of the skybox)

Questions

  • Is the full solution possible with ProRender, and if so, how?
  • Is the acceptable solution possible with ProRender, and if so, how?
  • If none of this is possible, could it be added?