Having fun with shadows

It appears that something is missing since we have light and reflection but no shadows. Shadow in LibGDX is still evolving. The way of using shadows might change in the next version. However, we will simply put a shadow here just to make the scene look more complete:

DirectionalShadowLight shadowLight; ModelBatch shadowBatch; @Override public void create() { . . . environment = new Environment(); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, .4f, .4f, .4f, 1f)); environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f)); shadowLight = new DirectionalShadowLight(1024, 1024, 60, 60, 1f, 300); shadowLight.set(0.8f, 0.8f, 0.8f, -1f, -.8f, -.2f); environment.add(shadowLight); environment.shadowMap ...

Get Learning LibGDX Game Development - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.