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

Alternate GroundProjectedSkybox #27422

Closed
elalish opened this issue Dec 22, 2023 · 4 comments · Fixed by #27448
Closed

Alternate GroundProjectedSkybox #27422

elalish opened this issue Dec 22, 2023 · 4 comments · Fixed by #27448
Milestone

Comments

@elalish
Copy link
Contributor

elalish commented Dec 22, 2023

Description

I recently tried to use GroundProjectedSkybox in <model-viewer> and utterly failed. I'm not sure I can list all the problems I found, but here are a few:

  1. There is a radius parameter, but the object also seems to need to be scaled (possibly to this same radius, possibly independent?).
  2. If the parameters have units, then I'm dubious of the math - the example uses a height of 15 (presumably meters, since it's loading a glTF car) and I personally doubt anyone put their camera that high, unless it was a drone.
  3. When I tried to apply it to other scenes, I could find no combination of parameters that gave a sensical result, and no system of parenting that allowed a model to appear fixed on the ground. I'm not actually sure it's possible, because I noticed that even in the example, the ground appears to slip under the wheels as the camera zooms, and it doesn't enable pan at all:
Screen.Recording.2023-12-22.at.18.30.49.mov

Note the sand ripple under the front tire.

I could find no clear way to fix it, so I just wrote my own. It's dramatically simpler (no custom shaders), and pretty much the only drawback is that it's slower to dynamically update the parameters, though I see no problem with this in practice since the three.js example is pretty much the only place I would imagine actually doing that on a per-frame basis.

Mine also has the advantage of making a smooth curve from the flat ground to the sky sphere:
image

It's not much code, but curious if anyone would like to see it upstreamed, and if so, in what form? @mrdoob @WestLangley @bhouston

Reproduction steps

  1. Attempt to pan around a model with a GroundProjectedSkybox.

Code

See my alternative here

Live example

Current: https://threejs.org/examples/?q=ground#webgl_materials_envmaps_groundprojected
Mine: https://modelviewer.dev/examples/lightingandenv/#groundedSkybox and https://modelviewer.dev/examples/augmentedreality/#ar

Screenshots

No response

Version

r159

Device

No response

Browser

No response

OS

No response

@mrdoob
Copy link
Owner

mrdoob commented Dec 22, 2023

I would vote for just replacing it with the new code.
The fact that it doesn't require custom shaders makes it easier to maintain and also render with WebGPURenderer.

@mrdoob mrdoob added this to the r161 milestone Dec 22, 2023
@bhouston
Copy link
Contributor

beautiful!

@hybridherbst
Copy link
Contributor

hybridherbst commented Dec 22, 2023

Thanks so much!
I assume your version also doesn't have the visible seam from the original?

It is possible to adjust/use the current one nicely (and hide the swimming somewhat):
https://engine.needle.tools/samples/ground-projection

@elalish
Copy link
Contributor Author

elalish commented Dec 23, 2023

Sure, I can replace this if you want - do you still want it called GroundProjectedSkybox or my GroundedSkybox or something else? Any other changes you want from this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants