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

Render 3D scene to cube map #162

Open
bhouston opened this issue Jul 16, 2020 · 0 comments
Open

Render 3D scene to cube map #162

bhouston opened this issue Jul 16, 2020 · 0 comments

Comments

@bhouston
Copy link
Owner

var ENV_CUBE_LOOK_DIR = [
    new Vec3(1.0, 0.0, 0.0),
    new Vec3(-1.0, 0.0, 0.0),
    new Vec3(0.0, 1.0, 0.0),
    new Vec3(0.0, -1.0, 0.0),
    new Vec3(0.0, 0.0, 1.0),
    new Vec3(0.0, 0.0, -1.0)
];

var ENV_CUBE_LOOK_UP = [
    new Vec3(0.0, -1.0, 0.0),
    new Vec3(0.0, -1.0, 0.0),
    new Vec3(0.0, 0.0, 1.0),
    new Vec3(0.0, 0.0, -1.0),
    new Vec3(0.0, -1.0, 0.0),
    new Vec3(0.0, -1.0, 0.0)
];

 var view = mat4.lookAt(camera.pos, camera.pos + ENV_CUBE_LOOK_DIR[side], ENV_CUBE_LOOK_UP[side]);
 var CUBE_PROJECTION = mat4.perspective(Math.PI/2, aspect, near, far);

source: https://stackoverflow.com/questions/34639572/render-to-cubemap-tutorial-in-webgl

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

1 participant