# Ideas and suggestions needed for Improving p5.js WebGL mode in GSOC 2019

**URL:** <https://discourse.processing.org/t/ideas-and-suggestions-needed-for-improving-p5-js-webgl-mode-in-gsoc-2019/8865>\
**Category:** Summer of Code\
**Created:** [March 2, 2019, 8:34pm UTC](https://discourse.processing.org/t/ideas-and-suggestions-needed-for-improving-p5-js-webgl-mode-in-gsoc-2019/8865 "2019-03-02T20:34:51Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![sanketsingh24](https://avatars.discourse-cdn.com/v4/letter/s/ac8455/32.png) [@sanketsingh24](https://discourse.processing.org/u/sanketsingh24)\
**Post date:** [March 6, 2019, 2:41pm UTC](https://discourse.processing.org/t/ideas-and-suggestions-needed-for-improving-p5-js-webgl-mode-in-gsoc-2019/8865/2 "2019-03-06T14:41:52Z")

</div>

`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 -

1. The torch’s light has a color, depicted by the three RGB values `v1,v2,v3` or we can pass `p5.color` object.
2. The position of the torch, whereas `x,y,z` being the coordinates of the position, a `p5.vector` can also be used.
3. 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, and `p5.vector` can also be used here.
4. 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.
5. The strength of the torch, used here as `concentration`. The higher value of `concentration` 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.

---

_[View the full topic](https://discourse.processing.org/t/ideas-and-suggestions-needed-for-improving-p5-js-webgl-mode-in-gsoc-2019/8865)._
