static void SetupAtmosphere(MyEffectVoxels shader, MyRenderVoxelCellBackground element) { shader.SetHasAtmosphere(element.HasAtmosphere); if (element.HasAtmosphere) { float depthScale = 0.2f; shader.SetInnerRadius(element.PlanetRadius); shader.SetOutherRadius(element.AtmosphereRadius); float scaleAtmosphere = 1.0f / (element.AtmosphereRadius - element.PlanetRadius); shader.SetScaleAtmosphere(scaleAtmosphere); shader.SetScaleAtmosphereOverScaleDepth(scaleAtmosphere / depthScale); Vector3 cameraToCenter = element.GetRelativeCameraPos(MyRenderCamera.Position); shader.SetRelativeCameraPos(cameraToCenter); shader.SetLightPos(-MySunGlare.GetSunDirection()); shader.SetIsInside(element.IsInside(MyRenderCamera.Position)); shader.SetScaleDepth(depthScale); shader.SetPositonToLeftBottomOffset(element.PositiontoLeftBottomOffset); shader.SetWavelength(element.AtmosphereWavelengths); } }