The only thing I can think of is that something in your custom node expression is giving the HLSL compliler a very hard time allocating registers trying to unroll that loop, and the compiler is taking a very long time to complete. I guess in Task Manager you will be able to see a ShaderCompileWorker,exe process sitting there taking 100% of one CPU core? If you turn on the Command Line column view in Task Manager you can see the temporary folder name where you can find the exact shader it’s trying to compile.
Both the function definition:
MaterialFloat CustomExpression0(FMaterialPixelParameters Parameters,MaterialFloat3 from,MaterialFloat3 direction,MaterialFloat StepLength,MaterialFloat3 position,MaterialFloat rows,MaterialFloat columns,MaterialFloat width,MaterialFloat length,MaterialFloat height,MaterialFloat step,MaterialFloat MaximumRaySteps,Texture2D Tex, sampler TexSampler )
{
float totalValue = 0.0;int steps;for (steps=0; steps < MaximumRaySteps; steps++) {float3 p = (((from + (step * direction* StepLength))-position));if(abs(p.x)>width/2)return float2(0,0);if(abs(p.y)>length/2)return float2(0,0);if(abs(p.z)>height/2)return float2(0,0);int slice = ((p.z/height)*(rows*columns))+(rows*columns/2);float2 cornerpos = float2(((slice%columns)/columns), floor(slice/columns)/rows);float2 coord = cornerpos + float2(((p.x/width)+0.5)/columns,((p.y/length)+0.5)/rows);float4 value = tex2D(TexSampler, coord);totalValue += value.r;if (totalValue < 0.0) break;}return totalValue;
}
and the call:
MaterialFloat Local9 = CustomExpression0(Parameters,View.ViewOrigin.xyz,Local5,2.00000000,Primitive.ActorWorldPosition,6.00000000,5.00000000,60.00000000,72.00000000,30.00000000,Local8,72.00000000,Material.Texture2D_0,Material.Texture2D_0Sampler );
look good to me… Could you try a simpler example?