---
title: "perspectiveFromFieldOfView | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Function perspectiveFromFieldOfView

-   perspectiveFromFieldOfView(out: [mat4](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.mat4/), fov: any, near: number, far: number): [mat4](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.mat4/)[](#perspectivefromfieldofview)
    
    Generates a perspective projection matrix with the given field of view. This is primarily useful for generating projection matrices to be used with the still experiemental WebVR API.
    
    #### Parameters
    
    -   out: [mat4](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.mat4/)
        
        mat4 frustum matrix will be written into
        
    -   fov: any
        
        Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees
        
    -   near: number
        
        Near bound of the frustum
        
    -   far: number
        
        Far bound of the frustum
        
    
    #### Returns [mat4](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.mat4/)
    
    out
