Skip to content

Commit 3f34414

Browse files
committed
Refactoring.
1 parent 612e6b3 commit 3f34414

File tree

8 files changed

+409
-333
lines changed

8 files changed

+409
-333
lines changed

UnityProject/Assets/ProBuilder Data.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!114 &11400000
4+
MonoBehaviour:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInstance: {fileID: 0}
8+
m_PrefabAsset: {fileID: 0}
9+
m_GameObject: {fileID: 0}
10+
m_Enabled: 1
11+
m_EditorHideFlags: 0
12+
m_Script: {fileID: 11500000, guid: dda436a9c8bbd4d109478acf25cd48d8, type: 3}
13+
m_Name: Default Color Palette
14+
m_EditorClassIdentifier:
15+
m_Colors:
16+
- {r: 0, g: 0.122, b: 0.247, a: 1}
17+
- {r: 0, g: 0.455, b: 0.851, a: 1}
18+
- {r: 0.498, g: 0.859, b: 1, a: 1}
19+
- {r: 0.224, g: 0.8, b: 0.8, a: 1}
20+
- {r: 0.239, g: 0.6, b: 0.439, a: 1}
21+
- {r: 0.18, g: 0.8, b: 0.251, a: 1}
22+
- {r: 0.004, g: 1, b: 0.439, a: 1}
23+
- {r: 1, g: 0.863, b: 0, a: 1}
24+
- {r: 1, g: 0.522, b: 0.106, a: 1}
25+
- {r: 1, g: 0.255, b: 0.212, a: 1}
26+
- {r: 0.522, g: 0.078, b: 0.294, a: 1}
27+
- {r: 0.941, g: 0.071, b: 0.745, a: 1}
28+
- {r: 0.694, g: 0.051, b: 0.788, a: 1}
29+
- {r: 0.067, g: 0.067, b: 0.067, a: 1}
30+
- {r: 0.667, g: 0.667, b: 0.667, a: 1}
31+
- {r: 0.867, g: 0.867, b: 0.867, a: 1}

UnityProject/Assets/ProBuilder Data/Default Color Palette.asset.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnityProject/Assets/Scenes/DemoScene.unity

Lines changed: 324 additions & 316 deletions
Large diffs are not rendered by default.

UnityProject/Assets/Scripts/Random.hlsl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
#ifndef RANDOM
22
#define RANDOM
33

4-
float2 Pixel;
4+
float2 pixel;
55

66
// Set from RayTracing.cs ////////
7-
float _Seed;
7+
float _seed;
88
/////////////////////////////////
99

1010
// One-liner to get pseudorandom numbers given some seed from the mains .cs file.
1111
float rand()
1212
{
13-
float result = frac(sin(_Seed / 100.0f * dot(Pixel, float2(12.9898f, 78.233f))) * 43758.5453f);
14-
_Seed += 1.0f;
13+
float result = frac(sin(_seed / 100.0f * dot(pixel, float2(12.9898f, 78.233f))) * 43758.5453f);
14+
_seed += 1.0f;
1515
return result;
1616
}
1717

UnityProject/Assets/Scripts/RayTracing.compute

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
// These are set from RayMarcher.cs /////////
10-
Texture2D<float4> _source;
10+
//Texture2D<float4> _source;
1111
RWTexture2D<float4> _target;
1212
float4x4 _cameraToWorldProj;
1313
float4x4 _cameraInverseProj;
@@ -49,6 +49,7 @@ RayCollision TraceRays(Ray ray)
4949
//GroundPlaneRayIntersection(ray, Collision);
5050

5151
uint numSpheres, stride;
52+
5253
/*
5354
_SphereBuffer.GetDimensions(numSpheres, stride);
5455

@@ -160,17 +161,17 @@ float3 ShadeRay(inout Ray ray, RayCollision collision)
160161
[numthreads(8,8,1)]
161162
void CSMain (uint3 id : SV_DispatchThreadID)
162163
{
163-
_target[id.xy] = _source[id.xy];
164-
Pixel = id.xy;
164+
//_target[id.xy] = _source[id.xy];
165+
pixel = id.xy;
165166

166167
uint width,height;
167168
_target.GetDimensions(width, height);
168169

169-
float marchDistance = 0;
170-
int numMarchSteps = 0;
170+
//float marchDistance = 0;
171+
//int numMarchSteps = 0;
171172

172173
//Convert from coordinates [-width,width] and [-heigth,height] to [-1,1] and [-1,1].
173-
float2 uv = (id.xy + _pixelOffset) / float2(width,height) * 2 - 1;
174+
float2 uv = (id.xy + _pixelOffset) / float2(width, height) * 2 - 1;
174175

175176
// Create the camera ray for that specific pixel.
176177
Ray cameraRay = CreateCameraRay(uv);
@@ -192,5 +193,5 @@ void CSMain (uint3 id : SV_DispatchThreadID)
192193
break;
193194
}
194195

195-
_target[id.xy] = float4(pixelColor,1);
196+
_target[id.xy] = float4(pixelColor, 1);
196197
}

UnityProject/Assets/Scripts/RayTracing.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ void Awake()
5252
movementSpeed = 0.1f;
5353
rotationSpeed = 60f;
5454
//camera = Camera.current;
55-
5655
}
5756

5857

@@ -99,7 +98,7 @@ void OnRenderImage(RenderTexture source, RenderTexture destination)
9998

10099
rayTracer.SetFloat("_seed", UnityEngine.Random.value);
101100

102-
rayTracer.SetTexture(0, "_source", source);
101+
//rayTracer.SetTexture(0, "_source", source);
103102
rayTracer.SetTexture(0, "_target", target);
104103
rayTracer.SetTexture(0, "_skyBoxTexture", skyBoxTexture);
105104

@@ -120,6 +119,7 @@ void OnRenderImage(RenderTexture source, RenderTexture destination)
120119
Graphics.Blit(target, converged, addMaterial);
121120
Graphics.Blit(converged, destination);
122121

122+
123123
sampleNumber++;
124124

125125
ReleaseBuffer();

UnityProject/ProjectSettings/Packages/com.unity.probuilder/Settings.json

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
"key": "log.path",
1919
"value": "{\"m_Value\":\"ProBuilderLog.txt\"}"
2020
},
21+
{
22+
"type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
23+
"key": "VertexColorPalette.previousColorPalette",
24+
"value": "{\"m_Value\":\"Assets/ProBuilder Data/Default Color Palette.asset\"}"
25+
},
2126
{
2227
"type": "UnityEngine.ProBuilder.SemVer, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
2328
"key": "about.identifier",
@@ -76,17 +81,17 @@
7681
{
7782
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
7883
"key": "smoothing.showPreview",
79-
"value": "{\"m_Value\":false}"
84+
"value": "{\"m_Value\":true}"
8085
},
8186
{
8287
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
8388
"key": "smoothing.showNormals",
84-
"value": "{\"m_Value\":false}"
89+
"value": "{\"m_Value\":true}"
8590
},
8691
{
8792
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
8893
"key": "smoothing.showSettings",
89-
"value": "{\"m_Value\":false}"
94+
"value": "{\"m_Value\":true}"
9095
},
9196
{
9297
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
@@ -103,6 +108,11 @@
103108
"key": "meshImporter.smoothing",
104109
"value": "{\"m_Value\":true}"
105110
},
111+
{
112+
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
113+
"key": "smoothing.previewDither",
114+
"value": "{\"m_Value\":false}"
115+
},
106116
{
107117
"type": "UnityEngine.ProBuilder.SelectionModifierBehavior, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
108118
"key": "editor.rectSelectModifier",
@@ -116,7 +126,7 @@
116126
{
117127
"type": "UnityEngine.ProBuilder.SelectMode, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
118128
"key": "editor.selectMode",
119-
"value": "{\"m_Value\":1}"
129+
"value": "{\"m_Value\":8}"
120130
},
121131
{
122132
"type": "UnityEngine.ProBuilder.PivotLocation, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
@@ -152,6 +162,16 @@
152162
"type": "System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
153163
"key": "meshImporter.smoothingAngle",
154164
"value": "{\"m_Value\":1.0}"
165+
},
166+
{
167+
"type": "System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
168+
"key": "smoothing.NormalsSize",
169+
"value": "{\"m_Value\":1.0}"
170+
},
171+
{
172+
"type": "System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
173+
"key": "smoothing.PreviewOpacity",
174+
"value": "{\"m_Value\":1.0}"
155175
}
156176
]
157177
}

0 commit comments

Comments
 (0)