1.0.0 • Published 7 years ago
regl-atmosphere-skybox v1.0.0
regl-atmosphere-envmap
Easily generate an environment map, or skybox, of Earth atmosphere given a 3D vector representing the direction of the sun.
Install
npm install regl-atmosphere-envmapUsage
const createAtmosphereRenderer = require("regl-atmosphere-envmap");
const renderAtmosphere = createAtmosphereRenderer(regl);
const envMap = renderAtmosphere(opts);createAtmosphereRenderer takes a regl context as a parameter, and returns the function renderAtmosphere.
renderAtmosphere takes an opts parameter and returns a regl framebufferCube object that can be immediately used as
a samplerCube in your shaders, or passed back into the renderAtmosphere function to update it.
The opts parameter is an object with the following members:
- sunDirection: the vector that points from the origin to the sun, 3D vector, default 0, 0.25, -1.0
- resolution: the resolution of each square face of the environment cubemap if
cubeFBOis not provided, int, default 1024 - cubeFBO: the regl
framebufferCubeobject that will be returned, defaultregl.framebufferCube(opts.resolution)
1.0.0
7 years ago