pex-gl / pex-context

Modern WebGL state wrapper for PEX: allocate GPU resources (textures, buffers), setup state pipelines and passes, and combine them into commands.
http://pex-gl.github.io/pex-context/
MIT License
160 stars 12 forks source link

Cubemap orientation #50

Closed vorg closed 5 years ago

vorg commented 6 years ago

In three.js

Dynamic cube maps need to have flip uniforms (flipEnvMap / tFlip) set to 1, static cube maps to -1 (default). https://github.com/mrdoob/three.js/commit/addb3a12a9ec7bae78a9e2dcdc979215942f8883

Can we somehow render dynamic ones to the same layout as static ones to avoid this flipping?

vorg commented 5 years ago

Added example https://github.com/pex-gl/pex-context/blob/master/examples/render-to-cubemap.js

Long story short cubemap textures loaded from files need flipY set to false when uploading to gpu and be flipped on the X axis when rendering.

screenshot 2018-09-27 at 12 47 16