Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Rendering a scene with a 3D skybox #73

Open
Derpius opened this issue Aug 26, 2023 · 0 comments
Open

[Question] Rendering a scene with a 3D skybox #73

Derpius opened this issue Aug 26, 2023 · 0 comments

Comments

@Derpius
Copy link

Derpius commented Aug 26, 2023

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?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant