beta
cables is under heavy development.
There might be one or another bug, please let us know about it!
cables Documentation      How To Use            Working with files            Keyboard Shortcuts            User Interface Walkthrough      Beginner Tutorial            Beginner 1: Drawing A Circle            Beginner 2: Transformations            Beginner 3: Color            More Transformations      intermediate            Image Compositions            Post-Processing 3D Scenes      communication            cables API            Communication with an Arduino via Serial            Communicating with Arduino over MQTT      Exporting And Embedding            How to serve files externally and fix CORS headers            Embedding Patches            External triggers / functions            Embedding Patches            Previewing / uploading exported cables patches      coding ops            Creating Attachments            General op/Port Callbacks            Ports                  Dynamic Ports                  Array Ports                  Boolean ports                  Integer Number Ports                  Object Ports                  String ports                  Trigger Ports                  Floating Point Number Ports            GUI/UI attributes            Hello Op - Part 1            Libraries            Developing Ops            Guidelines            Object Ports            Writing Shaders            Web Audio Op Development      HTML and CSS in cables      Lighting            Lights            Shadows      FAQ            Embedding                  How to remove grey rectangles on touch (mobile)?                  Why doesn't the DownloadTexture op work on iOS?                  How to disable page scrolling on mobile?                  Transparent Canvas            Features and Support                  Will there be support for (animated) GIFs?            General questions            Licences and payment                  What licence do i need to use cables?                  Will I have to pay for it in the future?                  How is my work licenced when using cables?            Does cables support midi and OSC?            Shadertoy            Technical questions            UI / Editor            WebGL1 and WebGL2

Lights

In this section of the documentation, we will explore how the system works and how to use it efficiently. We will also look into common problems that can occur with adding shadows to a scene. Please keep in mind that the operators are subject to change in the future. We will try to keep the documentation as up to date as possible but if you find outdated parts or explanations that don't hold true anymore, do not hesitate to contact us on Discord.

Introduction

The following ops are able to cast lights:

The following materials are able to receive light:

Basic Setup

basiclightsetup

In the screenshot above you see the minimum amount of operators needed to get shadows on the screen. The patch for the screenshot is availible here. In this example, a Directional Light is used. You can use any of the above mentioned operators to add lighting to a scene.

Multiple Lights

To use multiple lights, simply add them to your patch BEFORE your material(s).

Check out this patch to see a simple multi-light setup in action.

Light settings

The most important parameters for lights are Color, Position and Intensity.

With these 3 parameters, you can already generate an infinite amount of looks.

If you are using the Phong Material, another interesting parameter is the Specular Color.
The Phong Material features specular reflections, whose color you can control by changing the specular color of the lights. Please note that the Ambient Light doesn't feature a Specular Color parameter. Please refer to the documentation of the ops for a more detailed overview.

A note on Ambient Lighting

The color of the ambient light gets added on top of all the other colors, there are no lighting calculations involved. Subtle amounts do wonders.


help cables get better and edit this file on github