https://github.com/leon/labs-sharp-pano
POF for converting equirectangular images to cube faces
https://github.com/leon/labs-sharp-pano
Last synced: 7 months ago
JSON representation
POF for converting equirectangular images to cube faces
- Host: GitHub
- URL: https://github.com/leon/labs-sharp-pano
- Owner: leon
- Created: 2020-11-04T06:33:21.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-04T07:18:56.000Z (over 5 years ago)
- Last Synced: 2024-12-28T00:43:26.691Z (over 1 year ago)
- Language: TypeScript
- Size: 21.7 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Proof of Concept
using sharp to convert from an equirectangular image to 6 cube faces compatible with three.js

# Run
Will take the jpg specified in `index.ts main() imageName` and opening the image as a raw byte buffer then
project cube face onto unit sphere by converting cartesian to spherical coordinates and then using different
copy functions, copy the pixels from the source image into a cube face.
We then do this six times, once for each cube face.
the result will be present in the `out` dir.
```bash
yarn install
yarn start
```
# Help
In the `renderFace.ts` file we have a `copyPixel` function which uses either linear, bicubic, lanczos algorithms
to copy the pixels from the source to the destination.
These are javascript implementations which mean that they are very sluggish.
I have done some reading about libvips and the mapim function it has.
But my knowledge of how I would convert renderFace to use this is limited.
Has anyone seen a equirectangular to cubemap implementation in sharp?
The thing I'm looking for should copy a pixel from a raw array into another raw array using lanczos,
since that gives me the best looking outcome.
Could someone point me in the right direction?