# Lighting

Lighting is an important and non trivial part of creating shaders.

### Built in

The library comes with some built in implementations of materials.

#### Lambert

The Lambert material implementation is highly efficient as it only calculated the light at each vertex. It can take a diffuse color and returns an RgbaNode.

```ts
import { lambertMaterial, RgbaNode, rgb } from "@hology/core/shader-nodes"

const color: RgbaNode = lambertMaterial(rgb(0x00ff00))
```

#### Standard

The standard material is based on a physically based rendering approach and looks just like [THREE.MeshStandardMaterial](https://threejs.org/docs/#api/en/materials/MeshStandardMaterial) except it that it does not have features like metalness or refraction.

```ts
import { standardMaterial, RgbaNode, rgb } from "@hology/core/shader-nodes"

const color: RgbaNode = standardMaterial({ 
    color: rgb(0x00ff00), 
    emissive: rgb(0x9f7070), 
    emissiveIntensity: float(0),
    roughness: float(1)
})
```

### Creating your own

Light and shadow information is passed in by ThreeJS based on what exists in the scene and you can access them with uniforms. Check out the / for what predefined uniforms exist and for how to create new ones if some you need are missing.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hology.app/zh-tw/shaders/typescript-shaders/lighting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
