Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

Passing an array of Texture2D to a HLSL shader

$
0
0

@TheNightglow wrote:

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 my Shader I added:

texture ShadowMaps[MaxLightNum*6];
SamplerState ShadowMapSampler
{
MinFilter = point;
MagFilter = point;
MipFilter = point;
AddressU = Wrap;
AddressV = Wrap;
};

...

float4 color = ShadowMaps[0].Sample(ShadowMapSampler, pos);

and monogame content pipeline is fine with that when I build the shader, so I assume an array of textures is allowed in monogame...

though when I try to pass the Texture2D array to the Shader by using:

Shadows = Global.shader.Parameters["ShadowMaps"];

....

Shadows.SetValue(shadowMaps);
(with _shadowMaps being my Texture2D array)

it underlines _shadowMaps red and says cant convert Texture2D[] to bool ?

what am I doing wrong?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles