I m trying to add shadows to my Pointlight Shader…
the Shader already works fine for a custom number of pointlights, and now I have written code in my monogame project that renders for every Pointlight 6 Shadow-maps (for every axis direction one), and inserted them in an Texture2D Array, size 6 * n (n = max number of pointlights)
in the past few hours I already read the same thing somewhere else and tryed to find out how that works, though I couldn t find documentation regarding what most of the Texture2D or RenderTarget2D functions do, online…
I tryed something like
_shadows.SetData(_shadowMaps);
with _shadows being Texture2D and _shadowMaps beign Texture2D[]
though that wouldn t work, told me off, because Texture2D is nullable…
also tryed putting every shadowMap texture in an own Level of a single seperate shadow map, also with SetData, though ran into the problem that the Level of that texture was initialized with 1, and I couldn t find out how to change that^^
I probably don t quite understand how the Texture2D functions are meant, though for some reason, they seem to have no explaination/ definition anywhere online… at least I couldn t find anything^^
so how can I make a single texture contain the array?
The Texture2D constructor has an overload that takes an ArraySize parameter to specify how big the internal texture array should be. Texture2D.SetData has an overload that takes an array index.