diff --git a/Assets/sunset_box/sunset_box.unity b/Assets/sunset_box/sunset_box.unity index 0ee6a98..ed78a25 100644 --- a/Assets/sunset_box/sunset_box.unity +++ b/Assets/sunset_box/sunset_box.unity @@ -567,7 +567,7 @@ PrefabInstance: - target: {fileID: -8679921383154817045, guid: 5009e49fafd33ed0e980b53b1f9e954d, type: 3} propertyPath: m_LocalPosition.z - value: 0 + value: -0.232 objectReference: {fileID: 0} - target: {fileID: -8679921383154817045, guid: 5009e49fafd33ed0e980b53b1f9e954d, type: 3} diff --git a/Assets/sunset_box/sunset_env_dynamic.shader b/Assets/sunset_box/sunset_env_dynamic.shader index 9547b18..01cb792 100644 --- a/Assets/sunset_box/sunset_env_dynamic.shader +++ b/Assets/sunset_box/sunset_env_dynamic.shader @@ -123,10 +123,11 @@ float3 dir = real_dir; float real_y = asin(dir.y); if (real_y < 0.0) { // distort to look like water reflection - float3 camera_local_pos = i.cam_pos + mul(unity_WorldToObject, float4(0, 0, 0, 1)); + float3 object_pos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)); + float3 camera_local_pos = i.cam_pos - object_pos; float3 surface_pos = float3 ( camera_local_pos.x - camera_local_pos.y / (real_dir.y / real_dir.x), - 0.0, + 0, camera_local_pos.z - camera_local_pos.y / (real_dir.y / real_dir.z) ); float3 water_normal = get_water_normal(surface_pos.xz);