How to set the position of light

Hi, I am reading chapter 7 which shows how to work with light basically. But I found no code to set or init the light. I can’t produce the light in my own test code. Are there such functions to set the position of light? Thanks!

Hi @jeff2020 and welcome to the forums!

Lighting is done in the fragment shader code. Have you read chapter 5 which is all about lighting?

Lighting.swift is where the lights for the chapter 7 app are defined. They are passed to the fragment shader, which calculates how each fragment should be shaded.

Have you downloaded the sample code from the chapters and looked at that to see how your code differs?

I found the definition of Light. Thank you very much :slight_smile:
And I am downloading sample code now…