Permalink
Browse files

Update Unity project to 2018.2.13, Burst to 0.2.4 and Mathematics to …

…0.0.12.

Mid-2018 MBP (i9 2.9 GHz): 36.5 Mray/s
  • Loading branch information...
aras-p committed Oct 28, 2018
1 parent 45d3f81 commit 467573c9a993055055762553722f5e0350482ec8
Showing with 52 additions and 17 deletions.
  1. +5 −5 Unity/Assets/Maths.cs
  2. +6 −6 Unity/Assets/Test.cs
  3. +40 −5 Unity/Packages/manifest.json
  4. +1 −1 Unity/ProjectSettings/ProjectVersion.txt
View
@@ -19,7 +19,7 @@ public static bool Refract(float3 v, float3 n, float nint, out float3 outRefract
return false;
}
public static float PI => 3.1415926f;
public static float kPI => 3.1415926f;
public static float Schlick(float cosine, float ri)
{
@@ -49,7 +49,7 @@ public static float3 RandomInUnitDisk(ref uint state)
do
{
p = 2.0f * new float3(RandomFloat01(ref state), RandomFloat01(ref state), 0) - new float3(1, 1, 0);
} while (lengthSquared(p) >= 1.0);
} while (lengthsq(p) >= 1.0);
return p;
}
@@ -59,14 +59,14 @@ public static float3 RandomInUnitSphere(ref uint state)
do
{
p = 2.0f * new float3(RandomFloat01(ref state), RandomFloat01(ref state), RandomFloat01(ref state)) - new float3(1, 1, 1);
} while (lengthSquared(p) >= 1.0);
} while (lengthsq(p) >= 1.0);
return p;
}
public static float3 RandomUnitVector(ref uint state)
{
float z = RandomFloat01(ref state) * 2.0f - 1.0f;
float a = RandomFloat01(ref state) * 2.0f * PI;
float a = RandomFloat01(ref state) * 2.0f * kPI;
float r = sqrt(1.0f - z * z);
float x, y;
sincos(a, out x, out y);
@@ -199,7 +199,7 @@ struct Camera
public Camera(float3 lookFrom, float3 lookAt, float3 vup, float vfov, float aspect, float aperture, float focusDist)
{
lensRadius = aperture / 2;
float theta = vfov * MathUtil.PI / 180;
float theta = vfov * MathUtil.kPI / 180;
float halfHeight = tan(theta / 2);
float halfWidth = aspect * halfHeight;
origin = lookFrom;
View
@@ -117,12 +117,12 @@ static bool Scatter(Material mat, Ray r_in, Hit rec, out float3 attenuation, out
float3 sw = normalize(scenter - rec.pos);
float3 su = normalize(cross(abs(sw.x) > 0.01f ? new float3(0, 1, 0) : new float3(1, 0, 0), sw));
float3 sv = cross(sw, su);
// sample sphere by solid angle
float cosAMax = sqrt(max(0.0f, 1.0f - sqRradius / lengthSquared(rec.pos - scenter)));
// sample sphere by solid anglePI
float cosAMax = sqrt(max(0.0f, 1.0f - sqRradius / lengthsq(rec.pos - scenter)));
float eps1 = RandomFloat01(ref randState), eps2 = RandomFloat01(ref randState);
float cosA = 1.0f - eps1 + eps1 * cosAMax;
float sinA = sqrt(1.0f - cosA * cosA);
float phi = 2 * PI * eps2;
float phi = 2 * kPI * eps2;
float3 l = su * cos(phi) * sinA + sv * sin(phi) * sinA + sw * cosA;
l = normalize(l);
@@ -132,11 +132,11 @@ static bool Scatter(Material mat, Ray r_in, Hit rec, out float3 attenuation, out
++inoutRayCount;
if (HitWorld(new Ray(rec.pos, l), kMinT, kMaxT, ref lightHit, ref hitID, ref spheres) && hitID == i)
{
float omega = 2 * PI * (1 - cosAMax);
float omega = 2 * kPI * (1 - cosAMax);
float3 rdir = r_in.dir;
float3 nl = dot(rec.normal, rdir) < 0 ? rec.normal : -rec.normal;
outLightE += (mat.albedo * materials[i].emissive) * (max(0.0f, dot(l, nl)) * omega / PI);
outLightE += (mat.albedo * materials[i].emissive) * (max(0.0f, dot(l, nl)) * omega / kPI);
}
}
#endif
@@ -228,7 +228,7 @@ static float3 Trace(Ray r, int depth, ref int inoutRayCount, ref SpheresSoA sphe
}
}
[ComputeJobOptimization]
[Unity.Burst.BurstCompileAttribute]
struct TraceRowJob : IJobParallelFor
{
public int screenWidth, screenHeight, frameCount;
@@ -1,7 +1,42 @@
{
"dependencies": {
"com.unity.burst": "0.2.3",
"com.unity.mathematics": "0.0.7"
},
"registry": "https://staging-packages.unity.com"
"dependencies": {
"com.unity.ads": "2.0.8",
"com.unity.analytics": "2.0.16",
"com.unity.burst": "0.2.4-preview.34",
"com.unity.mathematics": "0.0.12-preview.19",
"com.unity.package-manager-ui": "1.9.11",
"com.unity.purchasing": "2.0.3",
"com.unity.textmeshpro": "1.2.4",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.assetbundle": "1.0.0",
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.cloth": "1.0.0",
"com.unity.modules.director": "1.0.0",
"com.unity.modules.imageconversion": "1.0.0",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.particlesystem": "1.0.0",
"com.unity.modules.physics": "1.0.0",
"com.unity.modules.physics2d": "1.0.0",
"com.unity.modules.screencapture": "1.0.0",
"com.unity.modules.terrain": "1.0.0",
"com.unity.modules.terrainphysics": "1.0.0",
"com.unity.modules.tilemap": "1.0.0",
"com.unity.modules.ui": "1.0.0",
"com.unity.modules.uielements": "1.0.0",
"com.unity.modules.umbra": "1.0.0",
"com.unity.modules.unityanalytics": "1.0.0",
"com.unity.modules.unitywebrequest": "1.0.0",
"com.unity.modules.unitywebrequestassetbundle": "1.0.0",
"com.unity.modules.unitywebrequestaudio": "1.0.0",
"com.unity.modules.unitywebrequesttexture": "1.0.0",
"com.unity.modules.unitywebrequestwww": "1.0.0",
"com.unity.modules.vehicles": "1.0.0",
"com.unity.modules.video": "1.0.0",
"com.unity.modules.vr": "1.0.0",
"com.unity.modules.wind": "1.0.0",
"com.unity.modules.xr": "1.0.0"
},
"registry": "https://staging-packages.unity.com"
}
@@ -1 +1 @@
m_EditorVersion: 2018.1.0b12
m_EditorVersion: 2018.2.13f1

0 comments on commit 467573c

Please sign in to comment.