Hello,
I’m working on an Interior Mapping shader, and need to use several Cubemaps to avoid repetitiveness.
Sampling 4 cubemaps then giving their output a different weight before adding them does work.
However I would like to avoid sampling 4 times when I only end up using one of them.
I made a custom node for that, but Shadergraph throw the following errors :
, Fragment Program: Internal error communicating with the shader compiler process
and
Internal error communicating with the shader compiler process.
void PickChosenCubemap_float
(
//In
UnityTextureCube A,
UnityTextureCube B,
UnityTextureCube C,
UnityTextureCube D,
float Value,
//Out
out UnityTextureCube Chosen
)
{
//Default
Chosen = A;
//Pick only one cubemap to continue the calculations
if(Value > 0.75f)
{
Chosen = D;
}
else if(Value > 0.5f)
{
Chosen = C;
}
else if(Value > 0.25f)
{
Chosen = B;
}
}
Is this an actual bug, or something expected with HLSL code ? And if so, what’s the proper way to do it ?
I know conditional behavior is tricky for GPU compilers, but this code doesn’t really seems extravagant.
I’ve tested it both with HDRP/Shadergraph 10.3.2 and 10.4