New Clouds In Game Scene
Implemented new raymarching shader in game scene
This commit is contained in:
parent
f15accda56
commit
cda321ba4a
27 changed files with 186 additions and 269 deletions
|
|
@ -58,22 +58,22 @@ public class MapView : MonoBehaviour
|
|||
|
||||
void SetZoom()
|
||||
{
|
||||
ZoneRenderer.ViewDistance = _viewDistance * _aspectRatio;
|
||||
//ZoneRenderer.ViewDistance = _viewDistance * _aspectRatio;
|
||||
Minimap.orthographicSize = MinimapGravity.orthographicSize = _viewDistance;
|
||||
_gravityRendererTransform.localScale = new Vector3(_viewDistance*_aspectRatio*2, _viewDistance*2, 1);
|
||||
}
|
||||
|
||||
public void BindInput(AetheriaInput.UIActions input)
|
||||
{
|
||||
_input = input;
|
||||
_input.ScrollWheel.performed += OnScroll;
|
||||
}
|
||||
// public void BindInput(AetheriaInput.UIActions input)
|
||||
// {
|
||||
// _input = input;
|
||||
// _input.ScrollWheel.performed += OnScroll;
|
||||
// }
|
||||
|
||||
private void OnScroll(InputAction.CallbackContext context)
|
||||
{
|
||||
_viewDistance *= (1 - context.ReadValue<Vector2>().y * ZoomSpeed);
|
||||
SetZoom();
|
||||
}
|
||||
// private void OnScroll(InputAction.CallbackContext context)
|
||||
// {
|
||||
// _viewDistance *= (1 - context.ReadValue<Vector2>().y * ZoomSpeed);
|
||||
// SetZoom();
|
||||
// }
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
|
@ -96,7 +96,7 @@ public class MapView : MonoBehaviour
|
|||
|
||||
private void OnDisable()
|
||||
{
|
||||
_input.ScrollWheel.performed -= OnScroll;
|
||||
// _input.ScrollWheel.performed -= OnScroll;
|
||||
|
||||
Main.gameObject.SetActive(true);
|
||||
_minimapGravityCopyTransform.enabled = true;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class VolumeSampling : MonoBehaviour
|
|||
//public int DownsampleBlurMask = 2;
|
||||
private Camera _camera;
|
||||
private RenderBuffer[] _mrt;
|
||||
private RenderTexture _blurMask;
|
||||
private Texture2D _blurMask;
|
||||
private Texture2D _disabledBlurMask;
|
||||
private float _flowScroll;
|
||||
|
||||
|
|
@ -40,15 +40,13 @@ public class VolumeSampling : MonoBehaviour
|
|||
//Debug.Log($"Supported MRT count: {SystemInfo.supportedRenderTargetCount}");
|
||||
_camera = GetComponent<Camera>();
|
||||
_mrt = new RenderBuffer[2];
|
||||
_blurMask = new RenderTexture(Screen.width, Screen.height, 0, GraphicsFormat.R8_UNorm);
|
||||
//_blurMask = new RenderTexture(Screen.width, Screen.height, 0, GraphicsFormat.R8_UNorm);
|
||||
_blurMask = Color.white.ToTexture();
|
||||
_disabledBlurMask = Color.black.ToTexture();
|
||||
}
|
||||
|
||||
private void OnPreRender()
|
||||
{
|
||||
// Shader needs this matrix to generate world space rays
|
||||
Shader.SetGlobalMatrix("_CamProj", (Camera.current.projectionMatrix * Camera.current.worldToCameraMatrix).inverse);
|
||||
Shader.SetGlobalMatrix("_CamInvProj", (Camera.current.projectionMatrix * Camera.current.worldToCameraMatrix).inverse);
|
||||
}
|
||||
|
||||
//[ImageEffectOpaque]
|
||||
|
|
@ -66,6 +64,9 @@ public class VolumeSampling : MonoBehaviour
|
|||
if(GridTransform != null)
|
||||
Shader.SetGlobalVector("_GridTransform", new Vector4(GridTransform.position.x,GridTransform.position.z,GridTransform.localScale.x));
|
||||
//
|
||||
// Shader needs this matrix to generate world space rays
|
||||
// Shader.SetGlobalMatrix("_CamProj", (Camera.current.projectionMatrix * Camera.current.worldToCameraMatrix).inverse);
|
||||
// Shader.SetGlobalMatrix("_CamInvProj", (Camera.current.projectionMatrix * Camera.current.worldToCameraMatrix).inverse);
|
||||
// _mrt[0] = destination.colorBuffer;
|
||||
// _mrt[1] = _blurMask.colorBuffer;
|
||||
//
|
||||
|
|
@ -87,7 +88,6 @@ public class VolumeSampling : MonoBehaviour
|
|||
Shader.SetGlobalTexture("_NebulaTint", NebulaTint);
|
||||
|
||||
Shader.SetGlobalFloat("_NebulaFillDensity", Settings.DefaultEnvironment.Nebula.FillDensity);
|
||||
Shader.SetGlobalFloat("_SafetyDistance", Settings.DefaultEnvironment.Nebula.FillDistance);
|
||||
Shader.SetGlobalFloat("_NebulaFloorDensity", Settings.DefaultEnvironment.Nebula.FloorDensity);
|
||||
Shader.SetGlobalFloat("_NebulaPatchDensity", Settings.DefaultEnvironment.Nebula.PatchDensity);
|
||||
Shader.SetGlobalFloat("_NebulaFloorOffset", Settings.DefaultEnvironment.Nebula.FloorOffset);
|
||||
|
|
|
|||
|
|
@ -439,12 +439,12 @@ public class ZoneRenderer : MonoBehaviour
|
|||
loot.ViewDirection = PerspectiveEntity.LookDirection;
|
||||
}
|
||||
|
||||
if (SlimeRenderer.SpawnPositions.Length != _suns.Length)
|
||||
SlimeRenderer.SpawnPositions = new Vector2[_suns.Length];
|
||||
for (var i = 0; i < _suns.Length; i++)
|
||||
{
|
||||
SlimeRenderer.SpawnPositions[i] = _suns[i].Body.transform.position.Flatland();
|
||||
}
|
||||
// if (SlimeRenderer.SpawnPositions.Length != _suns.Length)
|
||||
// SlimeRenderer.SpawnPositions = new Vector2[_suns.Length];
|
||||
// for (var i = 0; i < _suns.Length; i++)
|
||||
// {
|
||||
// SlimeRenderer.SpawnPositions[i] = _suns[i].Body.transform.position.Flatland();
|
||||
// }
|
||||
|
||||
foreach (var belt in Zone.AsteroidBelts)
|
||||
{
|
||||
|
|
@ -518,8 +518,8 @@ public class ZoneRenderer : MonoBehaviour
|
|||
var depthRange = Settings.PlanetSettings.ZoneDepth - startDepth + _maxDepth;
|
||||
// MinimapGravityQuad.material.SetFloat("_StartDepth", startDepth);
|
||||
// MinimapGravityQuad.material.SetFloat("_DepthRange", depthRange);
|
||||
FogMaterial.SetFloat("_GridOffset", Settings.PlanetSettings.ZoneBoundaryFog);
|
||||
FogMaterial.SetVector("_GridTransform", new Vector4(fogPos.x, fogPos.z, _viewDistance * 2));
|
||||
Shader.SetGlobalFloat("_GridOffset", Settings.PlanetSettings.ZoneBoundaryFog);
|
||||
Shader.SetGlobalVector("_GridTransform", new Vector4(fogPos.x, fogPos.z, _viewDistance * 2));
|
||||
// var gravPos = MinimapGravityQuad.transform.position;
|
||||
// gravPos.y = -Settings.PlanetSettings.ZoneDepth - _maxDepth;
|
||||
// MinimapGravityQuad.transform.position = gravPos;
|
||||
|
|
|
|||
Loading…
Reference in a new issue