# glsl-look-at

> Generate a 3D lookAt matrix in GLSL

Latest version **1.0.0** (published 2015-03-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install glsl-look-at
pnpm add glsl-look-at
yarn add glsl-look-at
bun add glsl-look-at
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-03-25 |
| First published | 2015-03-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 29 |
| Author | Hugh Kennedy |
| Maintainers | hughsk |
| Keywords | ecosystem:stackgl |

## Links

- npm: https://www.npmjs.com/package/glsl-look-at
- Repository: https://github.com/stackgl/glsl-look-at
- Issues: https://github.com/stackgl/glsl-look-at/issues
- npm.io page: https://npm.io/package/glsl-look-at

## Recent versions

- 1.0.0 (latest) — 2015-03-25

## README

# glsl-look-at

[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)

Generates a 3D lookAt matrix in GLSL.

## Usage

[![NPM](https://nodei.co/npm/glsl-look-at.png)](https://nodei.co/npm/glsl-look-at/)

### `mat3 lookAt(vec3 origin, vec3 target, float roll)`

Creates a `mat3` matrix you can use to transform coordinates
to look towards a given point, where:

* `origin` is the position of the camera.
* `target` is the position to look towards.
* `roll` is the roll rotation of the camera.

``` glsl
#pragma glslify: lookAt = require('glsl-look-at')

uniform vec2 iResolution;

void main() {
  // Required bootstrap for a Shadertoy-style
  // raytracing scene:
  vec2 p  = (2.0*gl_FragCoord.xy-iResolution.xy)/iResolution.y;
  vec2 ro = vec3(3.5*sin(0.0),3.0,3.5*cos(0.0));
  vec2 ta = vec3(0.0,0.0,0.0);

  // ...

  mat3 camMat = lookAt(ro, ta, 0.0);
  vec3 rd = normalize(camMat * vec3(p, 2.0));

  // ...
}
```

## Contributing

See [stackgl/contributing](https://github.com/stackgl/contributing) for details.

## License

MIT. See [LICENSE.md](http://github.com/stackgl/glsl-look-at/blob/master/LICENSE.md) for details.

---
_Source: https://npm.io/package/glsl-look-at · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
