You plug an OSL map into the "Filter Map" or "Projector Map" slot of your light.

Dappled Light Generator by ArchvizTools is a highly efficient script designed to automate the creation of realistic "gobo" or dappled light effects in 3ds Max. Compatible with versions from 2018 through 2024+

Use the Chaos Cosmos browser to search for "Gobo" or "Trees". Select a high-quality tree model. Place it outside your window to cast natural shadows.