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

From 1.37, GLTF shader paths are relative, even when starting with a slash #5844

Closed
xtassin opened this issue Sep 25, 2017 · 7 comments
Closed

Comments

@xtassin
Copy link
Contributor

xtassin commented Sep 25, 2017

Hi,

I used to specify custom shaders in my GLTF files in this manner:

"uri": "/shaders/mappedReflectiveFS.glsl"

This should load the file from the root of the web host (http://domain.com/shaders/mappedReflectiveFS.glsl)

Instead, and starting with Cesium 1.37, the shaders are loaded relative to the GLTF's directory even if the uri starts with a slash.

Regards,

Xavier.

@mramato
Copy link
Contributor

mramato commented Sep 26, 2017

Thanks for the report @xtassin, this definitely sounds like a clear cut bug. @lilleyse or @emackey any ideas?

@emackey
Copy link
Contributor

emackey commented Sep 26, 2017

Definitely sounds like a bug. There's been some discussion of root-relative paths on the official glTF repo lately, but nothing that should prevent this from working.

@xtassin
Copy link
Contributor Author

xtassin commented Nov 21, 2017

Sorry to bump this but can we expect a fix in upcoming releases or is this something I should be looking into myself?

Thanks.

@mramato
Copy link
Contributor

mramato commented Nov 21, 2017

@xtassin we would love to get this fix in, but no one has had a chance to look at it yet. It should be pretty straight forward so I think it would make a great first pull request if you have the time or desire to tackle it yourself.

If not, thanks for bringing it to our attention anyway and I marked this a priority so we don't forget about it.

@emackey
Copy link
Contributor

emackey commented Nov 21, 2017

Actually I recently opened a PR to add file support to joinUrls in #5989, and while I was in there I noticed that joinUrls always concats them, taking care to get the slashes right, but not cancelling out any base path if the 2nd URL is a root-relative URL. It looked like intended behavior, as .. is not supported there, and the unit tests very specifically test for that behavior. Maybe it used to be different? Or maybe glTF in Cesium didn't used to depend on this?

If someone has time to run git bisect on this, to nail down exactly what changed to cause the break, that would be a great for understanding this. I'm a little swamped with non-glTF stuff at the moment sadly.

@xtassin
Copy link
Contributor Author

xtassin commented Dec 2, 2017

All usage of uri.resolve have been replaced by joinUrls in model.js (and possibly in other places) during "Misc changes and helpers from 3d-tiles #5249"

The fix could be to handle root relative url in joinUrls but I am not sure of your view on that.

@lilleyse
Copy link
Contributor

I checked that this has since been fixed after the resource loading overhaul. Paths starting with a slash should now point to the server root directory.

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

No branches or pull requests

4 participants