| 314 | } |
| 315 | |
| 316 | void GetLayerValue(int32 layer, float& atmosphereR, Float4& dhdh) |
| 317 | { |
| 318 | float r = layer / Math::Max<float>(InscatterAltitudeSampleNum - 1.0f, 1.0f); |
| 319 | r = r * r; |
| 320 | r = Math::Sqrt(RadiusGround * RadiusGround + r * (RadiusAtmosphere * RadiusAtmosphere - RadiusGround * RadiusGround)) + (layer == 0 ? 0.01f : (layer == InscatterAltitudeSampleNum - 1 ? -0.001f : 0.0f)); |
| 321 | const float dMin = RadiusAtmosphere - r; |
| 322 | const float dMax = Math::Sqrt(r * r - RadiusGround * RadiusGround) + Math::Sqrt(RadiusAtmosphere * RadiusAtmosphere - RadiusGround * RadiusGround); |
| 323 | const float dMinP = r - RadiusGround; |
| 324 | const float dMaxP = Math::Sqrt(r * r - RadiusGround * RadiusGround); |
| 325 | atmosphereR = r; |
| 326 | dhdh = Float4(dMin, dMax, dMinP, dMaxP); |
| 327 | } |
| 328 | |
| 329 | void AtmospherePreComputeImpl::Render(RenderTask* task, GPUContext* context) |
| 330 | { |