spotLight(v1, v2, v3, x, y, z, nx, ny, nz, angle, concentration)
-
We can understand this by taking the example of the torch. It is essentially an extension of pointlight()
while also considering the opening of the torch, the direction of the torch, and torch’s strength.
Arguments -
- The torch’s light has a color, depicted by the three RGB values
v1,v2,v3
or we can passp5.color
object. - The position of the torch, whereas
x,y,z
being the coordinates of the position, ap5.vector
can also be used. - The direction of the light emitted by the torch, with
nx, ny, nz
being the coefficient for a normalized vector describing the direction of the light, andp5.vector
can also be used here. - The width of the opening of the torch, which basically resembles a cone, here is measured by the solid angle
angle
. It will be a number. - The strength of the torch, used here as
concentration
. The higher value ofconcentration
will let you concentrate the light in the middle more.
Also, I am thinking of making the angle and concentration arguments as optional, and setting them to some default value when not supplied by the user.
Advantages and Motivation-
- The spotlight is very useful in creating a lot of lighting effects, and can be heavily used by the community when introduced.
- Although, it is not a fundamental lighting method used in WebGL, It is still very different from the other existing lighting methods present in p5.
Implementation-
Currently, I don’t think any previous methods defined in p5.src needs to be changed, but the light shader and phong shader will have to be changed to incorporate the solid angle and concentration.