Lighting

Lighting in the Kakara Engine.

The default shaders for the Kakara Engine allow for basic lighting effects to be done. It is important to note that this lighting system is very basic with only basic shadows. There is no ray casting at all, so no reflections.

There are 3 types of lighting in the Engine: Point Lights, Spot Lights, and Directional Lights.

Point Lights

Point Lights are lights the originate from a point and spread out in all directions. These are the most basic kinds of light that you can use in your game. The PointLight class allows us to create Point Lights and add them into a scene.

PointLight pointLight = new PointLight(LightColor.RED, new Vector3(0, 0, -5), 1);

The PointLight constructor takes in 3 parameters: The color of the light, the position of the light, and the intensity of the light. The color of the light is pretty self-explanatory. The LightColor class allows you to define the color of lights either using its RGB constructor or a premade color. In the example above we used the premade color Red. The intensity parameter is how intense the light is and is defined by a float value ranging from 0 to 1. 0 means that there is no light and 1 means that the light is fully bright.

Point Lights are added the same way everything else is, though the add method in the scene.

add(pointLight);

Running that will get you the following image:

Spot Lights

Last updated