ReferenceMaterial nodesShading
Point Light 2D
A point light over a bumpy surface: give it a normal and where the light is (uv).
ƒPoint Light 2D
Normal001Diffuse
UV00Specular
Light Position0.30.3
Light Height0.3
Shininess32
Inputs
| Pin | Type | Starts at | Notes |
|---|---|---|---|
Normalnormal | vec3 | (0, 0, 1) | – |
UVuv | vec2 | 0 | – |
Light PositionlightAt | vec2 | (0.3, 0.3) | – |
Light Heightheight | float | 0.3 | – |
Shininessshininess | float | 32 | – |
Outputs
| Pin | Type |
|---|---|
Diffusediffuse | float |
Specularspecular | float |
The code it becomes
What Studio writes for the graph below: a few lines of the material's shader, worked out for every pixel.
void mainImage(out vec4 fragColor, in vec2 fragCoord){ vec2 n1_uv = (vec2(fragCoord.x / iResolution.x, 1.0 - fragCoord.y / iResolution.y) * vec2(1.0, 1.0)); vec2 n1_centred = (vec2(fragCoord.x - 0.5 * iResolution.x, 0.5 * iResolution.y - fragCoord.y) / iResolution.y); vec2 n1_square = (vec2(fragCoord.x, iResolution.y - fragCoord.y) / iResolution.y); float n2_diffuse = max(dot(normalize(vec3(0.0, 0.0, 1.0)), normalize(vec3((vec2(0.3, 0.3) - n1_uv) * vec2(iResolution.x / iResolution.y, 1.0), 0.3))), 0.0); float n2_specular = pow(max(dot(normalize(vec3(0.0, 0.0, 1.0)), normalize(normalize(vec3((vec2(0.3, 0.3) - n1_uv) * vec2(iResolution.x / iResolution.y, 1.0), 0.3)) + vec3(0.0, 0.0, 1.0))), 0.0), max(32.0, 1.0)); fragColor = vec4(vec3(n2_diffuse), 1.0);}In a graph
●UV
U Tiling1
V Tiling1Centred
Square UV
ƒPoint Light 2D
Normal001Diffuse
UVSpecular
Light Position0.30.3
Light Height0.3
Shininess32
◎Material OutputEnds here
Colour
Alpha1
Texture coordinates into the node, and the node into the material, as Studio draws them.
Related
Notes from the community
Written by creators and checked by the docs' editors. Not part of Motion's official reference.