DMeville

Untitled

Jun 26th, 2019
666
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. inline float SampleDensity(float3 pos, float scale, float phase)
  2. {
  3. float bias = 10000;
  4. float3 texScale = _VolumeTex_ST.xyx / bias / scale;
  5. float3 texOffset = (_TexOffset + _ScrollOffset) * phase * texScale;
  6. float3 texPos = pos * texScale + texOffset;
  7.  
  8. //radial mask
  9.  
  10. //needs...
  11. //float4 _RadiusOffset;
  12. //float _RadiusMaskHeight;
  13. //at the top of this class.
  14.  
  15. //and those properties to be exposed in MassiveCloudsMaterial.shader
  16. //_RadiusOffset("RadiusOffset", Vector) = (0,0,0,0)
  17. //_RadiusMaskHeight("RadiusMaskHeight", Float) = 0
  18.  
  19. float2 posxz = (float2(pos.x, pos.z));
  20. float2 radiusOffset = (float2(_RadiusOffset.x, _RadiusOffset.y));
  21. float distFromCenter = distance(((posxz / (pos.y * _RadiusMaskHeight)) + radiusOffset), float2(0, 0));
  22. float saturated = saturate((distFromCenter + _RadiusOffset.z) * _RadiusOffset.w);
  23. float3 densityRadialMask = (saturated).xxx;
  24. //end radial mask. Multiply density by this!
  25.  
  26. return tex3Dlod(_VolumeTex, float4(texPos.xyz, 0)).a * densityRadialMask; // *(1.0 - densityRadialMask);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment