diff --git a/Editor/config.ini b/Editor/config.ini index fcbe7ab01..db7591a73 100644 --- a/Editor/config.ini +++ b/Editor/config.ini @@ -1,7 +1,7 @@ enabled 1 x 0 y 0 -w 3840 -h 2160 +w 1920 +h 1080 fullscreen 0 borderless 1 \ No newline at end of file diff --git a/WickedEngine/oceanSurfaceGS.hlsl b/WickedEngine/oceanSurfaceGS.hlsl index 1a47e5835..251da8a22 100644 --- a/WickedEngine/oceanSurfaceGS.hlsl +++ b/WickedEngine/oceanSurfaceGS.hlsl @@ -17,6 +17,17 @@ static const float3 QUAD[] = { float3(1, 1, 0), }; +#define infinite g_xFrame_MainCamera_ZFarP +float3 intersectPlane(in float3 source, in float3 dir, in float3 normal, float height) +{ + // Compute the distance between the source and the surface, following a ray, then return the intersection + // http://www.cs.rpi.edu/~cutler/classes/advancedgraphics/S09/lectures/11_ray_tracing.pdf + float distance = (-height - dot(normal, source)) / dot(normal, dir); + if (distance < 0.0) + return source + dir * distance; + else + return -(float3(source.x, height, source.z) + float3(dir.x, height, dir.z) * infinite); +} [maxvertexcount(4)] void main( @@ -47,25 +58,17 @@ void main( float4 r = mul(float4(Out[i].pos.xy, 0, 1), g_xFrame_MainCamera_InvVP); r.xyz /= r.w; - float3 d = normalize(r.xyz - o.xyz); + float3 d = normalize(o.xyz, r.xyz); float3 planeOrigin = float3(0, 0, 0); float3 planeNormal = float3(0, 1, 0); - float planeDot = dot(planeNormal, d); - - if (planeDot > 0) - { - return; - } - - float t = dot(planeNormal, (planeOrigin - o.xyz) / planeDot); - float3 worldPos = o.xyz + d.xyz * t; + float3 worldPos = intersectPlane(o, d, planeNormal, planeOrigin.y); float2 uv = worldPos.xz * xOceanTexMulAdd.xy + xOceanTexMulAdd.zw; float3 displacement = g_texDisplacement.SampleLevel(sampler_point_wrap, uv, 0).xyz; - worldPos.xyz += displacement.xyz; + worldPos.xzy += displacement.xyz; Out[i].pos = mul(float4(worldPos, 1), g_xFrame_MainCamera_VP); Out[i].pos2D = Out[i].pos; diff --git a/models/Emitter/asd.wimf b/models/Emitter/asd.wimf deleted file mode 100644 index 653bc68f3..000000000 Binary files a/models/Emitter/asd.wimf and /dev/null differ diff --git a/models/Emitter/ert.wimf b/models/Emitter/ert.wimf deleted file mode 100644 index 216856147..000000000 Binary files a/models/Emitter/ert.wimf and /dev/null differ diff --git a/models/Sample/sparks.wimf b/models/Sample/sparks.wimf deleted file mode 100644 index 9ad8ce937..000000000 Binary files a/models/Sample/sparks.wimf and /dev/null differ