Creating my own shadow map

Godot Version

“Godot Engine v4.2.2.stable.official”

Question

Hello! I am a student and I would like to create my own shadow map. This is meant to be a learning exercise to accomplish something similar to this, but using GDExtension: LearnOpenGL - Shadow Mapping

The problem that I have is that I cannot figure out the right way to create the shadow map. I have tried to use a SubViewport and second camera, then calling get_texture() on the SubViewport and sending that as a texture to the shader. This does not work properly, but I think it is likely something that I am missing.

This is my first time posting to a forum, so please let me know if there is anything that I’ve missed etiquette-wise. I will be doing more troubleshooting on this tomorrow. Thank you for your time!