godotengine / godotengine/godot-docs
Add documentation on customizing existing light models in light shader
- Dominant language
- reStructuredText
- Stars
- 5.7k
- Forks
- 3.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 25
Description
**Your Godot version:**
Godot 4.5
**Issue description:**
I needed to customize the light shaders for a 3D project. Namely, doing custom banded toon shading (the built-in toon shader has one band and it's smoothed when I wanted hard edge), specular tweaks, and hard-edge shadows. The current documentation on the `light()` function in shaders is very minimal, and only gives an example for replicating diffuse lambert:
```glsl
void light() {
DIFFUSE_LIGHT += clamp(dot(NORMAL, LIGHT), 0.0, 1.0) * ATTENUATION * LIGHT_COLOR / PI;
}
```
It does not provide any examples for specular light, so I ended up referring to [this recreation of the standard lighting shader from Godot 4.1](https://github.com/RustyRoboticsBV/GodotStandardLightShader), grabbing the specular calculation code, and customizing it for myself.
It would be nice if the documentation had more lighting examples for those looking to customize the light model. At the very least it should have an example for specular.
**URL to the documentation page (if already existing):**
https://docs.godotengine.org/en/stable/tutorials/shaders/shader_reference/spatial_shader.html#light-built-ins
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the spatial shader documentation page linked in the issue, especially the light() function section and its existing diffuse Lambert example. Review the current light built-ins and add clear examples for customizing existing light models, including specular lighting; done means the page explains these use cases with working shader examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- godot
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100