Skip to content

Commit 1b6c9e2

Browse files
Updated main to Version 1.2.2
2 parents c9091df + c289ed0 commit 1b6c9e2

12 files changed

Lines changed: 457 additions & 171 deletions

Converter/Sequence_Converter.py

Lines changed: 204 additions & 79 deletions
Large diffs are not rendered by default.

Converter/Sequence_Converter_UI.py

Lines changed: 156 additions & 73 deletions
Large diffs are not rendered by default.

Converter/Sequence_Metadata.py

Lines changed: 61 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ class MetaData():
1919
ASTC = False
2020
hasUVs = False
2121
hasNormals = False
22+
useCompression = False
2223
maxVertexCount = 0
2324
maxIndiceCount = 0
24-
boundsCenter = [0,0,0]
25-
boundsSize = [1,1,1]
25+
boundsMin = [float('inf'),float('inf'),float('inf')]
26+
boundsMax = [float('-inf'),float('-inf'),float('-inf')]
2627
textureWidth = 0
2728
textureHeight = 0
2829
textureSizeDDS = 0
@@ -32,21 +33,33 @@ class MetaData():
3233
indiceCounts = []
3334

3435
#Ensure that this class can be called from multiple threads
35-
metaDataLock = Lock()
36+
metaDataLock = Lock()
3637

3738
def get_as_dict(self):
39+
40+
boundsCenter, boundsSize = self.get_metadata_bounds()
3841

3942
asDict = {
43+
"sequenceVersion" : "1.2.2",
4044
"geometryType" : int(self.geometryType),
4145
"textureMode" : int(self.textureMode),
4246
"DDS" : self.DDS,
4347
"ASTC" : self.ASTC,
4448
"hasUVs" : self.hasUVs,
4549
"hasNormals" : self.hasNormals,
50+
"useCompression" : self.useCompression,
4651
"maxVertexCount": self.maxVertexCount,
4752
"maxIndiceCount" : self.maxIndiceCount,
48-
"boundsCenter" : self.boundsCenter,
49-
"boundsSize" : self.boundsSize,
53+
"boundsCenter" : { # Export bounds as dicts for easier JSON parsing to Vector3 in Unity
54+
"x" : boundsCenter[0],
55+
"y" : boundsCenter[1],
56+
"z" : boundsCenter[2]
57+
},
58+
"boundsSize" : {
59+
"x" : boundsSize[0],
60+
"y" : boundsSize[1],
61+
"z" : boundsSize[2]
62+
},
5063
"textureWidth" : self.textureWidth,
5164
"textureHeight" : self.textureHeight,
5265
"textureSizeDDS" : self.textureSizeDDS,
@@ -57,39 +70,71 @@ def get_as_dict(self):
5770
}
5871

5972
return asDict
60-
61-
def set_metadata_Model(self, vertexCount, indiceCount, headerSize, bounds, geometryType, hasUV, hasNormals, listIndex):
62-
73+
74+
def set_metadata_Model(self, vertexCount, indiceCount, headerSize, geometryType, hasUV, hasNormals, useCompressions, listIndex):
75+
6376
self.metaDataLock.acquire()
6477

6578
self.geometryType = geometryType
6679
self.hasUVs = hasUV
6780
self.hasNormals = hasNormals
81+
self.useCompression = useCompressions
6882

6983
if(vertexCount > self.maxVertexCount):
7084
self.maxVertexCount = vertexCount
7185

7286
if(indiceCount > self.maxIndiceCount):
7387
self.maxIndiceCount = indiceCount
7488

75-
self.boundsCenter = bounds.center().tolist()
76-
self.boundsSize = [bounds.dim_x(), bounds.dim_y(), bounds.dim_z()]
77-
78-
# Flip bounds x axis, as we also flip the model's x axis to match Unity's coordinate system
79-
self.boundsCenter[0] *= -1 # Min X
80-
8189
self.headerSizes[listIndex] = headerSize
8290
self.verticeCounts[listIndex] = vertexCount
8391
self.indiceCounts[listIndex] = indiceCount
8492

8593
self.metaDataLock.release()
8694

95+
def extend_bounds(self, newBoundsMin, newBoundsMax):
96+
97+
self.metaDataLock.acquire()
98+
99+
self.boundsMin = [
100+
min(self.boundsMin[0], newBoundsMin[0]),
101+
min(self.boundsMin[1], newBoundsMin[1]),
102+
min(self.boundsMin[2], newBoundsMin[2]),
103+
]
104+
self.boundsMax = [
105+
max(self.boundsMax[0], newBoundsMax[0]),
106+
max(self.boundsMax[1], newBoundsMax[1]),
107+
max(self.boundsMax[2], newBoundsMax[2]),
108+
]
109+
110+
self.metaDataLock.release()
111+
112+
def get_metadata_bounds(self):
113+
114+
boundsCenter = [
115+
(self.boundsMax[0] + self.boundsMin[0]) / 2,
116+
(self.boundsMax[1] + self.boundsMin[1]) / 2,
117+
(self.boundsMax[2] + self.boundsMin[2]) / 2,
118+
]
119+
120+
boundsSize = [
121+
self.boundsMax[0] - self.boundsMin[0],
122+
self.boundsMax[1] - self.boundsMin[1],
123+
self.boundsMax[2] - self.boundsMin[2],
124+
]
125+
126+
# Flip bounds x axis, as we also flip the model's x axis to match Unity's coordinate system
127+
boundsCenter[0] *= -1
128+
129+
return boundsCenter, boundsSize
130+
131+
87132
def set_metadata_texture(self, DDS, ASTC, width, height, sizeDDS, sizeASTC, textureMode):
88133

89134
self.metaDataLock.acquire()
90135

91136
if(height > self.textureHeight):
92-
self.textureHeight = height
137+
self.textureHeight = height
93138

94139
if(width > self.textureWidth):
95140
self.textureWidth = width
@@ -113,6 +158,6 @@ def write_metaData(self, outputDir):
113158
outputPath = outputDir + "/sequence.json"
114159
content = self.get_as_dict()
115160
with open(outputPath, 'w') as f:
116-
json.dump(content, f)
161+
json.dump(content, f)
117162

118163
self.metaDataLock.release()

Geometry_Sequence_Player_Package

docs/content/docs/about/changelog.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ weight: 420
1313
toc: true
1414
---
1515

16+
### Version 1.2.2
17+
18+
This version contains several new features, contributed by [Anwar Lu](https://github.com/MrGcGamer):
19+
20+
- **Converter Tool MacOS support:** The converter tool now supports MacOS as well (texture compression is not yet supported)
21+
- **Sequence Compression:** Sequences can now be compressed to around half their size!
22+
23+
Fixes:
24+
25+
- [Issue #9](https://github.com/BuildingVolumes/Unity_Geometry_Sequence_Player/issues/11)
26+
- Several small bug fixes and additions
27+
1628
### Version 1.2.1
1729

1830
This version contains a small improvement for the rendering bounds of Sequences. The bounds were not correctly calculated in previous version, leading to the sequence not being correctly culled from the camera view.

docs/content/docs/about/license-credits.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,14 @@ The Unity Asset Store version of the package is licensed under the [Unity Standa
2727

2828
## Credits
2929

30-
- This website was created with the **[Doks](https://getdoks.org/)** theme made by **[Thulite](https://thulite.io/)**
30+
- The compression feature and MacOS support for the converter were made by [Anwar Lu](https://www.linkedin.com/in/anwar-lu/) - Thanks!
3131

3232
- The sequences in the showreel, from the landing page and on Github, were created by:
3333

3434
- ["A Windy Day2 by Loic Norgeot](https://sketchfab.com/3d-models/a-windy-day-fb78f4cc938144e6902dd5cff354d525)
3535

3636
- ["Galactic Incident2 by Loic Norgeot](https://sketchfab.com/3d-models/galactic-incident-397b266af9604b9fbf0a4e5446cf864b)
37+
38+
- This website was created with the **[Doks](https://getdoks.org/)** theme made by **[Thulite](https://thulite.io/)**
39+
40+
- The converter tool is made possible by [PyMeshLab](https://github.com/cnr-isti-vclab/PyMeshLab), [DearPyGUI](https://github.com/hoffstadt/DearPyGui), [ASTCEncoder](https://github.com/ARM-software/astc-encoder) and [TexConv](https://github.com/microsoft/DirectXTex/wiki/texconv)

docs/content/docs/tutorials/materials/index.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ Go to the **Geometry Sequence Stream** component that can be found on the same G
3737

3838
If you have a mesh sequence with textures, you can also control to which texture slot the texture will be applied. By default, textures will always be applied to the Main/Albedo/Diffuse slot, which is defined in the shader as _\_MainTexture_. But you can also apply the texture to any other slot. Either you select one or more predefined slots in the **Apply to texture slots** variable, or you enter the name of the texture slot into the **Custom texture slots** list. This has to be the name of the texture slot as found in the **shader**, not the material! Shader texture slot variables are often prefixed with an _Underscore.
3939

40+
### Mesh normals
41+
42+
By default, mesh normals won't be saved in the sequence, as it increases the sequence size and is not necessary in most cases. Unity will generate
43+
new normals during playback. However, if you need precise normals (for example for hard-surface meshes), you can also keep the original normals, by activating the "Save Normals" option in the sequence converter before converting your sequence.
44+
4045
## Pointcloud sequences
4146

4247
Changing the appearance of the pointcloud works very differently compared to meshes, as pointclouds require special shaders for rendering correctly. If you don't assign a custom pointcloud material, there are some predefined settings you can use to easily and quickly the appearance. These settings can be found under the **Geometry Sequence Stream** component and include the **Point Size** as well as the **Point Emission Strength**.
@@ -74,3 +79,11 @@ If you don't set a custom material, a default pointcloud material will be loaded
7479
`Packages > Geometry Sequence Player > Runtime > Shader > Resources`
7580

7681
You'll see three different sets of shaders, _Legacy_, _Shadergraph_ and _Polyspatial_. Clone one of the shaders appropriate for your chosen render path. Then, create a material that uses your freshly cloned shader and apply it under **Custom Material**. For quick iteration, we recommend to disable the **Instantiate Shader** option. If you're a little bit familiar with Shaderlab/Shadergraph, you should be able to get an idea of how the shaders work, by taking a look at the commented code/graph.
82+
83+
### Pointcloud normals
84+
85+
![Pointcloud normals example](pointcloud_normals.jpg)
86+
87+
In comparison to meshes, pointcloud sequences usually don't contain any normals. If you want your pointcloud sequence to receive lighting and shadows inside Unity, you need to generate normals. The sequence converter comes with a build-in functionality to estimate pointcloud normals and save them in the sequence.
88+
89+
[More info](/Unity_Geometry_Sequence_Player/docs/tutorials/preparing-your-sequences/#using-the-converter/)
207 KB
Loading
1.09 KB
Loading
916 Bytes
Loading

0 commit comments

Comments
 (0)