Guest User

UE4 Tutorial - Ultra Instinct Part 1: Aura HLSL

a guest
Aug 2nd, 2018
1,704
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. // Code Start
  2. static const float PI = 3.14159265359f;
  3. int CDIndex = 13;
  4.  
  5. Steps = clamp(floor(Steps), 1, 128);
  6. RadialSteps = clamp(floor(RadialSteps), 1, 128);
  7.  
  8. float StepSize = Radius/Steps; // Step size needed to get from the center to edge of the shape
  9. float RadialStepSize = (PI*2)/RadialSteps; // Step size needed to get around the object
  10.  
  11. float Result = 0.0f;
  12.  
  13. for (int i = 1; i <= Steps; i++){
  14.  
  15. float CurrentStep = i * StepSize;
  16.  
  17. for(int j = 1; j < RadialSteps; j++) {
  18. float Angle = j* RadialStepSize;
  19. float2 Coord = float2(cos(Angle), sin(Angle)) * CurrentStep + UV;
  20.  
  21. float Sample = SceneTextureLookup(ViewportUVToSceneTextureUV(Coord, CDIndex), CDIndex, false);
  22.  
  23. Result += (MaxDistance - clamp(Sample, 0, MaxDistance)) / MaxDistance;
  24.  
  25. }
  26. }
  27. return float1 (Result / (RadialSteps * Steps));
  28. // Code End
Advertisement
Add Comment
Please, Sign In to add comment