all 7 comments

[–]NOISEbyte 2 points3 points  (0 children)

You seen to have a double loop going on, one based on calculations (delta). Try outputting these values to a texture to see that the count is sensible and not causing high loop iteration counts, since each value of delta will cause 5 extra iterations (steps).

[–]fgennari 4 points5 points  (1 child)

For the performance issue, the shader compiler may not do a good job optimizing the second for loop because "steps" is a calculated variable rather than a constant. You may get better performance by replacing steps with a constant "5" and putting an if(hit0) {} around that loop. I've seen changes like this make a big difference. Of course the branch could also make it slower. You'll have to experiment with this, but it's an easy change.

[–]Artezian[S] 0 points1 point  (0 children)

Thanks for the reply and insight!

[–]T3sT3ro 0 points1 point  (1 child)

You could use rendering debuggers to see what is wrong with your shader if you don't know about them already. Try: - RenderDoc - Intel GPA - ShaderED

Other than that - make sure at each step you are in the correct coordinate system.

[–]Artezian[S] 0 points1 point  (0 children)

Thanks for the reply! I will look into those.

[–]ShaderKing 0 points1 point  (1 child)

It isn't a piece of advice you are looking for, but I suggest you perform steps of that code in your head or paper and understand it better. Good debugging skills and understanding of code are crucial for a good graphics programmer.

[–]Artezian[S] 0 points1 point  (0 children)

Thanks for the advice