Quantcast
Channel: Questions in topic: "hlsl"
Viewing all articles
Browse latest Browse all 206

Unity5 shaders and loop unrolling

$
0
0
Hi So Im doing volume rendering in Unity5 and I have a simple ray casting shader, Im able to put the number of loops to ~400 but it takes 10-20 minutes to compile as the shader unrolls the loop. It also times out when trying to increase the max loop count even when specifying [unroll(500)] before the for loop. Having searched around I havent found a way to prevent this and wondered if there is a way to prevent the shader unrolling. Theres not much to show in the shader, Just something like below a small for loop in the fragment shader that gets a value from a 3D texture which is then used to colour the pixel for(int i = 0 ; i < 50; i++) { float index = tex3D(_Volume,tempPos).a //do something with this to get the pixel colour at the current location } Any help or insight would be greatly appreciated thanks.

Viewing all articles
Browse latest Browse all 206

Trending Articles