After I compile my hlsl in Niagara module, I get error: ShaderCompileWorker failed with out-of-memory (00M) exception. Why it can happen? I didn’t allocate memory in the module, it is because compilation process itself will allocate memoty? Or compilation succeeded, but at the first time the new Niagara System runs, it crash due to the new module?
It is my simulation stage
BlurDepth.It is
Bilateral Filtering module input.It is
Bilateral Filtering module output.It is
Bilateral Filtering module custom hlsl.
OutDepth = 0
#if GPU_SIMULATION
const int2 IndexOffsets[8]=
{
int2(-1,0),
int2(1,0),
int2(0,-1),
int2(0,1),
int2(-1,-1),
int2(-1,1),
int2(1,-1),
int2(1,1)
};
int2 NumCells;
Grid2D.GetNumCells(NumCells.x, NumCells.y);
float weightSum = 0;
float depthSum = 0;
float CurrDepth;
Grid2D.GetFloatValue<Attribute="Depth">(IndexX, IndexY, CurrDepth);
int2 Index=int2(IndexX,IndexY);
if(CurrDepth > 0)
{
for (int xxx = 0; xxx < 8; ++xxx)
{
const int2 IndexToUse = Index + IndexOffsets[xxx];
if (IndexToUse.x >= 0 && IndexToUse.y >=0 && IndexToUse.x < NumCells.x && IndexToUse.y < NumCells.y)
{
float UVFactor = i * i + j * j;
UVFactor = (-UVFactor) / (2 * UVSigma * UVSigma);
float UVWeight = 1/(UVSigma * UVSigma * 2 * PI) * exp(UVFactor);
float NeighborDepth;
Grid2D.GetFloatValue<Attribute="Depth”>(IndexToUse.x, IndexToUse.y, NeighborDepth);
float DepthDistance = NeighborDepth - CurrDepth;
float DepthFactor = DepthDistance * DepthDistance;
DepthFactor = (-DepthFactor) / (2 * DepthSigma * DepthSigma);
float DepthWeight = (1 / (2 * PI * DepthSigma)) * exp(DepthFactor);
weightSum += UVWeight * DepthWeight;
depthSum += NeighborDepth * UVWeight * DepthWeight;
}
}
}
if(weightSum > 0){
OutDepth = depthSum / weightSum;
}
#endif
Furthermore, if you want to know what does the module do:
Set Iteration Source as Data Interface , and drag RenderGrid2D to Data Interface , then in the module, if you set namespace of a value in map out as STACKCONTEXT , the value will be stored into Data Interface automatically.
The module does Bilateral Filtering on depth map stored in Grid 2D.



