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

Fit texture coordinates to rectangle/trapezoid geometry #4164

Open
lilleyse opened this issue Aug 1, 2016 · 16 comments
Open

Fit texture coordinates to rectangle/trapezoid geometry #4164

lilleyse opened this issue Aug 1, 2016 · 16 comments

Comments

@lilleyse
Copy link
Contributor

lilleyse commented Aug 1, 2016

It would be useful to support stretching a texture along a rectangle/trapezoid geometry, or perhaps even support explicit texture coordinates. The effect would look like the second image:

screen_shot_2016_07_25_at_11_22_39_pm

cesium_good

@rumicuna created a demo for testing this:

https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Hello%20World.html&label=Showcases&gist=079b7bbc6c2c16bdaf23c57fe0a7f2c4

@hpinkos
Copy link
Contributor

hpinkos commented Aug 1, 2016

We also need this to support KML latLonQuads

@pjcozzi
Copy link
Contributor

pjcozzi commented Aug 1, 2016

We have done this in some of our other projects; see http://help.agi.com/AGIComponentsJava/html/BlogTrapezoidalTextureProjectionWithOpenGL.htm

@hpinkos
Copy link
Contributor

hpinkos commented Dec 7, 2016

I took the very first steps of this in https://github.com/AnalyticalGraphicsInc/cesium/tree/trapezoid but this requires GroundPrimitive to support other appearances than just PerInstanceColorAppearance

@pjcozzi
Copy link
Contributor

pjcozzi commented Dec 7, 2016

Specifically, this requires texturing ground primitive. @bagnell has most of the work done in this branch: https://github.com/AnalyticalGraphicsInc/cesium/compare/ground-primitive-tex-coords

@hpinkos
Copy link
Contributor

hpinkos commented Feb 15, 2017

This came up again on the forum: https://groups.google.com/d/msg/cesium-dev/x3sYLgIr8Mc/wH2tdn_hCwAJ

@lilleyse
Copy link
Contributor Author

lilleyse commented Jan 7, 2020

@lilleyse
Copy link
Contributor Author

lilleyse commented Jan 7, 2020

Talked about this offline with @likangning93. This will require specific changes to GroundPrimitive.

Some early thoughts:

There may be a uv -> uv mapping that could accomplish this, you'd probably need to start by mapping the corners of the trapezoid into the ground primitive uv space. Perhaps you could pass the 4 corners in groundPrimitiveUvSpace as uniforms or constants in the shader, then do a barycentric operation using the fragment's groundPrimitiveUvSpace coordinate.

It might be possible to do a proof-of-concept using a custom shader material.

@hpinkos
Copy link
Contributor

hpinkos commented Jan 7, 2020

@likangning93 @lilleyse read http://help.agi.com/AGIComponentsJava/html/BlogTrapezoidalTextureProjectionWithOpenGL.htm if you haven't already

@tmshv
Copy link

tmshv commented Aug 24, 2020

Hi guys! Any progress with this issue? Or maybe someone has a samples of code at least?

@wq8806
Copy link

wq8806 commented Apr 16, 2021

Any progress with this issue?

@jony89
Copy link
Contributor

jony89 commented Aug 8, 2021

4 years later. Please - Any progress with this issue?

@rumicuna
Copy link

rumicuna commented Aug 20, 2021

I updated the sandcastle demo to reproduce it with the latest Cesium (link below).
On the bright side, there has been an awesome improvement since I posted this, the video is now overlaid on the 3D terrain! Nice!
Having this capability would mean we would be able to ovelay live drone video on the terrain (that is not directly pointing down and is not north up).

https://sandcastle.cesium.com/index.html#c=tVb7b9s2EP5XiAxDbMDRw5LlR5xgaZoG6Zo1aLK0W10UtHSWiFKkSlJ2tMH/+46S/Ara7ZdVfpA83nd3PH48ynXJfSZXmixZApJQkRCW0xSIgSdTKiBSkELyKpViJlzX/sidknMO+YSUSxJLqRJNaGkkSUGAogYSouUWz3CSr2iliZDKZKQsultD74EIQHXEzoFQNGq7GgwxGbTW0bhc1OM2DFSZ1Gh8vJ7XI37z5+PIJ/UME9oATVpgjsaZSOsYtyHOcDlLqnDZsAJFzjCQFbkEzcrceaxlndlRXI8vpTCUIW521CN/zwTBtSmFEsyDzZqabICxArT9XiqePDQqnW5vJtbd0507zPIVJg+EQaeJjEvbdVIwrfRFdZN0jg2COajjHbLNZ3LXZuGsDd1BDDMMtEOTpFOHRzBVGmWotQ3tkiqDPSoCZ6Fk/hJSBaA7w3GPBPjzPc+zoVqwoDkg8HiTb/zqUi1oDMe9jflmZkJaf/bJGGZWxVl1KN4PR/9XPBeYtKrz8RBtnxPf7zsDPxpHwdjve77n28CHziDqB6ORHw2jyBsEve8CQ9QIET8KvLAFRmhkFAR+fxwNvg8MvHEwDkdBFPajFhhgCENvNAjHYf9fkGEfbXvheBQNhi3Sj/xROA6iKBr6h7hP3WeGloD5eXolVU7NLmt28zlS8VJyqS6KAqiiIgbn8erdw9WHz6/evru9eNgZWvfIboCGQDHK0do+CxuF9Y6lDauQgPEXSK4suSok2zP61ar3WC1iqg0Hy70HKfmcqlsQZecjEmBmZsaikEmPdW15aExYEtk5pANwiHF+UYrY0qPTJS2uQe75c1rKOdtVnB2s4rTBrW2zrh0cRnBT17T/O4K9mlE7uG2nsDAUuH9VZ2tsZuqqipFkxhQT1w2deeHMuUx1IY0Ty9w9CYOT7PXruzy6HrmPv1565jr58764cS/ax5O/u+Pst9sP19HXN2nsaj/yPPeRYXVK4ef+i5TxBBLbkdw2C6RGZVuFB7puwTaFsgistdjv+F2nEOkmIfZDeZHRCfGcwUbWEGOb3Zn41D096h1Ntak4nG8I9gvLCyzwpFS84ziugbzgmA7tzkskEi5R64ZgjfpPbYXbLxWbMjHBq0BLXho43U3OpTES75zhoHjaEyuWZriB3p5oxRKTTUjQ9w40M2hU/dG+fN10pu5mNe04YUvCkrNv3AEk5lRrnFmUnN+zv2B2dD51Uf/8OZRLmuDF8xbPMqeVVcv88zeN0HGcqYvDbyNNc5b2LLcazS3d6DQJxIByzJSVYNfecZj3qhlxKYumFyuptcRkMdEKcEFKcl2Ptps41bJUMRCtYpywVNXI1bi93ZCkRTnnLHZ3J/+e4j7DS2qoO2fpid1s/BOi+tzG56xgnqNDUxWANusFuI3sh7rNi/C511r0Y53K5XOnX0sWf8HTD3uu/0DPZK7wtQsPQCLBvhsZvGSL+gTZd51pLBM4ry1M3bpPoKl0zoaw9WRr8h8

@ggetz
Copy link
Contributor

ggetz commented Oct 10, 2022

Reported on the forum in https://community.cesium.com/t/how-to-project-textures-correctly/20592.

@ysp
Copy link

ysp commented Jul 25, 2024

Hi! Any progress with this issue?

@ggetz
Copy link
Contributor

ggetz commented Jul 25, 2024

@ysp There hasn't been any activity on this item recently.

If you'd like to add more information about your use case, that may help us prioritize. If you are interesting in contributing, please let us know and we'd be happy to discuss implementation or review a PR. Thanks!

@Zuzon
Copy link

Zuzon commented Oct 6, 2024

updated sandcastle demo:
https://sandcastle.cesium.com/index.html#c=tVZ7b9s2EP8qhIchMuDoYcnyI06wNE2DdM0aNF7arS4KWjpLQilSJSk72uDvvqMkv4J2+2eVHyTv7nd3vDse5TjkIRVrRVZZDIJQHpMspwkQDU+6lEAEJ4VgVSL4nDuO+ZF7KRYM8gkpVyQSQsaK0FILkgAHSTXERIkdPkMmW9NKES6kTklZdHeK3gPhgOKIXQChqNRMFWiiU2i1o3KxrNetGygyqdH4uD23R7zmz8OVR2pOxpUGGrfAHJVnPKl93Lk4x+2sqMRtwxokOUdH1uQKVFbm9mNNs+adqF5fCa5phrh5p0f+nnOCe5MSKZMtYNas7aUU+XshWdwSrG5vzjfds70xjPE1hg64RpOxiEoztRPQLfVFdRtbJxrBDOTJHtlGM75vY3DeOm4jJtMZKJvGsVU7RzBQCmkotXPwikqNM8r92seXkEgAZQ3HPeLjz3Nd17hqwJzmgMCTbbTxq0q5pBGc9LbqG86EtPbMk2YYVxml1TH50B31X/5cYtAq6+Mx2jynnte3B144Dv2x13c91zOOD+1B2PdHIy8chqE78HvfBQYoESB+5LtBCwxRycj3vf44HHwf6LtjfxyM/DDohy3QRxeG7mgQjIP+vyCDPup2g/EoHAxbpBd6o2Dsh2E49I5xn7rPFK0A4/P0Ssic6n3UTPIZFuKVYEJeFgVQSXkE9uP1u9n1h8+v3r67u5ztFW16ZL9ARSAzylDbYRU2AptdlT5gA4io0gxMQc2EYAsq74CX1kfM6lzPtalELI/Hul3MmrI0lWF4mGNgECF/WfLI5NzqkhbXIA9q2G7ryN65dn7k2lmD25hhUxs49uC2blP/twcHbaA2cNeysOcVmJTK2imb67pRoiep1sXEcQJ7UdgLJhJVCG1HIndOA/80ff36Pg9vRs7jr1euvon/fChuncv2ccXvzjj97e7DTfj1TRI5ygtd13nMsOEk8HP/RZKxGGIzEcwMS8x3ZUaJp7QewQyFNAhsnzi3vK5d8GQbEPOhrEjphLj2YEtrsr2L7px/altN01SWrJoJ61m0umedXmeqdMXgYltXv2R5gV2dlJJZtu1oyAuGAVPOooy+AAZBqUZxI/5T29gOO8S2O0yw/yvBSg1ne+ZCaC3wohkOiqcDssySFFPsHpDWWazTCfH77pFkCo2oNzqkb5rJ1Nnupl3H2Ypk8fk3Gj+JGFUKOcuSsYfsL5h3LqYOyl88hzJBY7xt3uIRZrQyYql38aYh2rY9dXD5baRuTtuB5laiuZobmSaA6FCOkTIUnJqLDeNeNSsmRNHMIimUEhisjLcE3JAUTNWrXRKnSpQyAqJkhAxTzAqruQlBXcZFuWBZ5Ox7wwPFPMNLqqmzyJJTk2z847z63Ppnr2GRo0FdFYA66w04De2Hms2L4LnVmvRjjYrVc6Nfyyz6gv0BDkz/gZbJQuK7Fh6AWIB5IdJ4txb1CTIvONNIxHBRa5g69ZxA0wvtbcHWzFblPw

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

10 participants