665b2d5484f4f

665b2d5485f78
1 Guest is here.
 

Topic: System Shock's assets importer for Unity
Page: « 1 [2]
Read 6933 times  

665b2d5486d5c
Generate a quad, move it out along the normal of the face by a small amount, and apply the text to the quad instead of the wall.  Or, if the text is a separate gameobject, move it out along its own normal since it should already be the same as the wall's normal.

Yes that is the general idea. But in this case it is more complicated.
I use TextGenerator to create the text mesh.
All the instance information (text content, color, location, orientation etc.) comes from the data files. Everything needs to be automated (no hand editing or fixing). And I dont want to manually create patch files to adjust the positions.
System Shocks renderer doesn't seem to have real z-buffer (or doesn't us spanlets or such rendering techniques) and all decals and texts are rendered after walls (per tile). Even if they are behind a wall! And in most cases texts and decals are floating in front or behind a wall.
I used mesh projecting to fix the decals (and that projector does exactly what you described about normals), but I can't use the same technique with texts.
I hope that explanation makes some sense.

Set to true color to disable compression.

Yep, that is the way to get rid of all compression artifacts. I enabled compression just for this release (as can be seen from my latest github commit).

Thanks for your feedback!
« Last Edit: 01. December 2015, 16:23:22 by Gawain »
Acknowledged by: JosiahJack
665b2d5486ea7
Here's preview video for those who don't want to download the playable version.

https://www.youtube.com/watch?v=5YejxnPEoo8
« Last Edit: 02. January 2016, 12:50:28 by Gawain »

665b2d54870b8dertseha

665b2d5487106
Awesome, thank you for the video!
I see you also already have the 3D models (cameras, ...) imported as well - I just finished the documentation and Wavefront export of those, but you are already beyond that - wow.
665b2d5487274
Thanks!

Models are mostly working. I think I have problems with some of the models that have polygons with more than three vertices.
The way I'm triangulating them is wrong. I will have to take some screenshots sometime to compare.
You can find the importer code here.

I may rewrite it to use the binary tree traversing as you documented. Would be nice to read it correctly even though the binary tree is there just to optimize the rendering I think.

665b2d54875c5dertseha

665b2d5487615
Models are mostly working. I think I have problems with some of the models that have polygons with more than three vertices.
The way I'm triangulating them is wrong. I will have to take some screenshots sometime to compare.
When writing the exporter I figured the coordinate system is a different one.
I imported the files in Blender and fiddled with the values until the models were shown upright and with proper texture orientations. See this Blender screenshot.
My best reference model was the phone (the first one in the file) - Because here the texture must be in line with the handle.

This is my finding: When converting to Wavefront files (.obj), readable by Blender, all the vertex coordinates had to be inverted and the U/V coordinates had to be deducted from 1.0 (newU/V = 1.0 - fileU/V) . It might of course also be an issue with the orientation of the axes in the different tools - I see you are loading the vertices with only an inverted Y axis for Unity.

I believe the binary format used in SS is one of the 3D modelling tool that was used; The command identifier are not sequential and the vertex information of the binary tree anchors appear not to be in use.

If you find a model that does not show up correctly with your code, please tell me, then I will cross-check with the export tool from InkyBlackness and see whether the same error happens there.
665b2d548780d
I checked the models. It seems some triangles are inverted because of my triangulation. Others are just using wrong vertices. It is possible that faces are not backface culled so inverted normals doesn't matter.

Last image is bottom of cyberguard. It has inverted faces and wrong indices.
First two are of cyberspace decoy. First image is from inside and second from outside. Same problems as above.

665b2d548792fdertseha

665b2d54879a9
heh, do you have chunk IDs as well? :) To create a map of object names to resource ID is still on my future list, so right now I'd have to manually walk through all models before finding the objects.
665b2d5487bfe
heh, do you have chunk IDs as well? :) To create a map of object names to resource ID is still on my future list, so right now I'd have to manually walk through all models before finding the objects.

0x092C (2348)
0x093E (2366)

665b2d548812bdertseha

665b2d548817e
Thank you. I see what you mean.
For the decoy, the problem is not as extreme. Blender imports: Inside and Outside.

The cyberguard though has two holes, one very big.

Here's the Wavefront export of the cyberguard:
093E_000.obj
Code: [Select]
mtllib 093E_000.mtl
v 0.144531 -0.210938 0.210938
v 0.066406 0.148438 0.167969
v 0.070312 -0.234375 0.246094
v 0.074219 -0.304688 0.148438
v 0.152344 0.253906 -0.000000
v -0.230469 -0.136719 0.109375
v 0.042969 -0.046875 0.261719
v 0.160156 -0.011719 0.250000
v 0.003906 -0.007812 0.277344
v 0.195312 0.042969 0.234375
v 0.164062 -0.195312 0.191406
v 0.113281 -0.253906 0.179688
v -0.042969 -0.246094 -0.035156
v -0.144531 -0.207031 0.210938
v -0.070312 0.148438 0.167969
v -0.171875 0.253906 -0.000000
v -0.058594 -0.304688 0.148438
v -0.000000 0.304688 -0.000000
v 0.234375 -0.136719 0.109375
v -0.265625 0.128906 -0.000000
v 0.265625 0.128906 -0.000000
v 0.074219 -0.093750 0.265625
v -0.000000 -0.214844 0.273438
v -0.156250 -0.011719 0.246094
v 0.007812 -0.242188 0.261719
v -0.062500 -0.238281 0.250000
v -0.000000 0.132812 0.226562
v -0.199219 0.042969 0.234375
v -0.046875 -0.046875 0.257812
v -0.074219 -0.089844 0.261719
v -0.132812 -0.074219 0.257812
v 0.132812 -0.070312 0.257812
v 0.144531 -0.210938 -0.210938
v -0.144531 -0.207031 -0.210938
v 0.066406 0.148438 -0.167969
v -0.070312 0.148438 -0.167969
v 0.070312 -0.234375 -0.246094
v 0.074219 -0.304688 -0.148438
v -0.058594 -0.304688 -0.148438
v -0.230469 -0.148438 -0.109375
v 0.234375 -0.148438 -0.109375
v 0.074219 -0.093750 -0.265625
v 0.042969 -0.046875 -0.261719
v -0.000000 -0.214844 -0.273438
v 0.160156 -0.011719 -0.250000
v -0.156250 -0.011719 -0.246094
v 0.007812 -0.242188 -0.261719
v -0.062500 -0.238281 -0.250000
v -0.000000 0.132812 -0.226562
v 0.003906 -0.007812 -0.277344
v 0.195312 0.039062 -0.234375
v -0.199219 0.042969 -0.234375
v -0.046875 -0.046875 -0.257812
v -0.074219 -0.089844 -0.261719
v -0.132812 -0.074219 -0.257812
v 0.132812 -0.070312 -0.257812
v -0.035156 -0.085938 0.261719
v -0.066406 -0.101562 0.261719
v -0.093750 -0.210938 0.230469
v -0.101562 -0.222656 0.230469
v 0.160156 -0.156250 0.203125
v -0.160156 -0.195312 0.191406
v -0.113281 -0.242188 0.187500
v -0.062500 -0.230469 -0.031250
v 0.027344 -0.304688 -0.042969
v 0.007812 -0.289062 -0.039062
v 0.066406 -0.105469 -0.265625
v 0.035156 -0.085938 -0.265625
v -0.160156 -0.195312 -0.191406
v 0.085938 -0.214844 -0.238281
v 0.093750 -0.226562 -0.234375
v 0.164062 -0.199219 -0.191406
v 0.113281 -0.253906 -0.179688
v -0.039062 -0.242188 -0.050781
v -0.156250 -0.011719 -0.242188
v -0.074219 0.011719 0.261719
v 0.093750 0.015625 0.257812
v -0.070312 0.011719 -0.261719
v 0.089844 0.011719 -0.257812
v -0.011719 0.132812 0.218750
vn 0.005142 0.499939 -0.000000
usemtl mat_col_02_shade0
f 4 38 65 17
vn 0.002762 -0.112167 -0.487228
usemtl mat_col_02_shade2
f 4 17 4
vn -0.361954 0.344910 -0.000000
usemtl mat_col_02_shade1
f 4 4 38
vn -0.000046 0.499969 -0.002319
usemtl mat_col_02_shade0
f 65 38 39 17
vn -0.335648 -0.370148 0.017853
usemtl mat_col_02_shade3
f 6 40 39
vn -0.490555 0.096512 -0.004135
usemtl mat_col_03_shade1
f 40 6 28
vn 0.232651 -0.281143 0.341751
usemtl mat_col_00_shade2
f 28 6 39
vn 0.348404 0.358582 -0.001663
usemtl mat_col_02_shade0
f 39 6 17
vn -0.351822 -0.348938 0.066711
usemtl mat_col_02_shade3
f 62 6 17 63
vn -0.318527 -0.359009 -0.140121
f 6 64 13 66 65 17
vn 0.000336 -0.417450 0.275162
f 64 6 39
vn -0.394852 -0.078690 0.296448
usemtl mat_col_03_shade2
f 24 6 62
vn -0.316040 -0.177872 0.344177
usemtl mat_col_02_shade2
f 28 6 24
vn 0.274734 0.353577 -0.222427
usemtl mat_col_00_shade1
f 40 28 39
vn -0.236603 -0.285080 0.335739
usemtl mat_col_00_shade2
f 38 19 10
vn 0.399719 -0.086884 0.287460
usemtl mat_col_03_shade1
f 19 8 61
vn -0.318527 -0.359009 -0.140121
usemtl mat_col_02_shade3
f 38 65 66
vn 0.364502 -0.137238 0.313477
usemtl mat_col_02_shade2
f 10 8 19
vn 0.349274 -0.357391 0.016113
f 38 41 19
vn 0.487137 0.112350 -0.005966
usemtl mat_col_03_shade1
f 10 19 41
vn -0.286453 0.344131 -0.222458
usemtl mat_col_00_shade1
f 38 10 41
vn -0.489349 -0.102539 0.000397
usemtl mat_col_03_shade2
f 10 51 41
vn 0.356354 -0.336670 -0.098160
usemtl mat_col_02_shade2
f 41 38 73 72
vn 0.396118 -0.087585 -0.292221
usemtl mat_col_03_shade2
f 41 72 45
vn 0.477356 0.002182 -0.148651
usemtl mat_col_03_shade1
f 51 21 41
vn -0.318527 -0.359009 -0.140121
usemtl mat_col_02_shade3
f 74 38 66 13
vn -0.385635 0.318207 -0.001450
usemtl mat_col_03_shade1
f 10 21 51
vn 0.491959 -0.089157 0.000015
usemtl mat_col_03_shade2
f 40 52 28
vn -0.318527 -0.359009 -0.140121
usemtl mat_col_02_shade3
f 64 74 13
vn -0.391266 -0.079285 -0.301010
usemtl mat_col_03_shade2
f 69 40 75 46
vn -0.479980 -0.004288 -0.139923
f 40 20 52
vn 0.393677 0.308197 -0.000137
usemtl mat_col_03_shade0
f 52 20 28
vn -0.024323 0.281708 0.412323
usemtl mat_col_01_shade0
f 9 15 76
vn 0.024994 0.283020 0.411392
f 2 9 77
vn -0.024323 0.281708 -0.412338
usemtl mat_col_01_shade1
f 36 50 78
vn 0.028503 0.281921 -0.411926
f 50 35 79
vn 0.125549 0.376114 -0.304550
usemtl mat_col_03_shade1
f 18 5 35
vn -0.156479 0.375687 -0.290436
usemtl mat_col_02_shade1
f 36 18 49
vn -0.154160 0.378159 0.288437
usemtl mat_col_02_shade0
f 18 15 80
vn -0.112183 0.378799 0.306412
usemtl mat_col_03_shade0
f 15 18 16
vn -0.113525 0.376251 -0.309052
usemtl mat_col_03_shade1
f 16 18 36
vn 0.159927 0.375214 -0.289139
usemtl mat_col_02_shade1
f 18 35 49
vn 0.127426 0.378632 0.300613
usemtl mat_col_03_shade0
f 2 5 18
vn 0.157623 0.377686 0.287170
usemtl mat_col_02_shade0
f 27 2 18
vn -0.154160 0.378159 0.288437
f 27 18 80
vn 0.293076 0.147369 -0.377304
usemtl mat_col_01_shade1
f 49 35 50
vn 0.291092 0.258942 -0.313339
usemtl mat_col_03_shade1
f 5 21 35
vn 0.224258 0.390350 -0.217468
usemtl mat_col_02_shade0
f 35 21 51
vn 0.028503 0.281921 -0.411926
usemtl mat_col_01_shade1
f 35 51 79
vn -0.295670 0.131165 -0.381256
f 36 49 50
vn -0.304825 0.222092 -0.328217
usemtl mat_col_03_shade1
f 20 16 36
vn -0.223373 0.393005 -0.213593
usemtl mat_col_02_shade1
f 20 36 52
vn -0.024323 0.281708 -0.412338
usemtl mat_col_01_shade1
f 52 36 78
vn 0.293076 0.147369 0.377289
f 9 2 27
vn 0.289230 0.265259 0.309753
usemtl mat_col_03_shade0
f 2 21 5
vn 0.222168 0.393341 0.214218
usemtl mat_col_02_shade0
f 10 21 2
vn 0.024994 0.283020 0.411392
usemtl mat_col_01_shade0
f 10 2 77
vn -0.295670 0.131165 0.381241
usemtl mat_col_01_shade1
f 9 27 80 15
vn -0.304001 0.225830 0.326416
usemtl mat_col_03_shade1
f 15 16 20
vn -0.223480 0.393036 0.213425
usemtl mat_col_02_shade0
f 28 15 20
vn -0.024323 0.281708 0.412323
usemtl mat_col_01_shade0
f 15 28 76
vn 0.359253 -0.136627 -0.319763
usemtl mat_col_02_shade2
f 41 45 51
vn 0.083954 -0.149460 -0.469681
usemtl mat_col_03_shade2
f 50 45 43
vn 0.203842 0.066162 -0.451721
usemtl mat_col_02_shade2
f 70 33 71
vn 0.356354 -0.336670 -0.098160
f 73 33 72
vn 0.202499 -0.010193 -0.457016
usemtl mat_col_01_shade2
f 50 43 68
vn 0.207092 -0.081955 -0.447632
usemtl mat_col_02_shade2
f 67 42 33 70
vn 0.396118 -0.087585 -0.292221
usemtl mat_col_03_shade2
f 72 33 45
vn 0.343140 -0.095764 -0.350800
usemtl mat_col_02_shade2
f 56 45 33
vn 0.097336 -0.156891 -0.464645
f 33 42 56
vn 0.024918 0.054718 -0.496353
usemtl mat_col_06_shade2
f 56 42 43
vn 0.027512 0.063385 -0.495178
f 43 45 56
vn 0.005020 0.042511 -0.498154
usemtl mat_col_03_shade2
f 43 42 67 68
vn -0.311951 -0.173187 -0.350250
usemtl mat_col_02_shade2
f 46 75 40 52
vn -0.105377 0.025436 -0.488083
f 52 78 50 46
vn -0.205200 0.040741 -0.454117
f 44 48 34
vn -0.098801 -0.135895 -0.470917
usemtl mat_col_03_shade2
f 53 46 50
vn 0.203842 0.066162 -0.451721
usemtl mat_col_02_shade2
f 71 37 44 70
vn 0.005020 0.042511 -0.498154
usemtl mat_col_03_shade2
f 67 44 68
vn -0.196564 -0.007233 -0.459671
usemtl mat_col_01_shade2
f 53 50 44
vn -0.085632 -0.156067 -0.467224
usemtl mat_col_02_shade2
f 55 54 34
vn -0.208679 -0.075897 -0.447968
f 34 54 44
vn -0.381821 -0.080780 -0.312515
f 34 46 55
vn -0.033386 0.073395 -0.493439
usemtl mat_col_06_shade2
f 53 55 46
vn -0.028442 0.057220 -0.495880
f 55 53 54
vn -0.013260 0.047272 -0.497574
usemtl mat_col_03_shade2
f 44 54 53
vn -0.391266 -0.079285 -0.301010
f 34 69 46 46
vn 0.202499 -0.010193 -0.457016
usemtl mat_col_01_shade2
f 68 44 50
vn 0.207092 -0.081955 -0.447632
usemtl mat_col_02_shade2
f 44 67 70
vn 0.477036 -0.101028 0.110458
usemtl mat_col_03_shade2
f 10 41 21
vn 0.000336 -0.417450 0.275162
usemtl mat_col_02_shade3
f 39 38 74 64
vn -0.478699 -0.100693 0.103424
usemtl mat_col_03_shade2
f 20 40 28
vn -0.105377 0.025436 0.488068
usemtl mat_col_02_shade1
f 24 9 76 28
vn -0.098801 -0.135895 0.470901
usemtl mat_col_03_shade2
f 9 24 29
vn -0.205200 0.040741 0.454102
usemtl mat_col_02_shade1
f 59 14 60
vn -0.351822 -0.348938 0.066711
usemtl mat_col_02_shade3
f 63 14 62
vn -0.196564 -0.007233 0.459656
usemtl mat_col_01_shade1
f 9 29 57
vn -0.208679 -0.075897 0.447952
usemtl mat_col_02_shade2
f 58 30 14 59
vn -0.394852 -0.078690 0.296448
usemtl mat_col_03_shade2
f 62 14 24
vn -0.381821 -0.080780 0.312500
usemtl mat_col_02_shade2
f 31 24 14
vn -0.085632 -0.156067 0.467209
f 14 30 31
vn -0.033386 0.073395 0.493423
usemtl mat_col_06_shade1
f 24 31 29
vn -0.028442 0.057220 0.495865
f 30 29 31
vn -0.013260 0.047272 0.497559
usemtl mat_col_03_shade1
f 57 29 30 58
vn 0.253220 -0.415604 0.114594
usemtl mat_col_02_shade3
f 19 19 17 65 38
vn -0.361954 0.344910 -0.000000
usemtl mat_col_02_shade1
f 4 19 19 38
vn 0.366272 -0.331268 0.077957
usemtl mat_col_02_shade2
f 12 4 4 19 11
vn 0.399719 -0.086884 0.287460
usemtl mat_col_03_shade1
f 11 19 61
vn 0.002762 -0.112167 -0.487228
usemtl mat_col_02_shade2
f 17 19 19 4
vn 0.203842 0.066162 0.451706
usemtl mat_col_02_shade1
f 23 3 1
vn 0.083954 -0.149460 0.469666
usemtl mat_col_03_shade2
f 7 8 9
vn 0.366272 -0.331268 0.077957
usemtl mat_col_02_shade2
f 11 1 12
vn 0.097336 -0.156891 0.464630
f 32 22 1
vn -0.205200 0.040741 0.454102
usemtl mat_col_02_shade1
f 60 26 23 59
vn -0.013260 0.047272 0.497559
usemtl mat_col_03_shade1
f 58 23 57
vn 0.202499 -0.010193 0.457001
usemtl mat_col_01_shade1
f 23 7 9
vn 0.005020 0.042511 0.498138
usemtl mat_col_03_shade1
f 23 22 7
vn 0.207092 -0.081955 0.447617
usemtl mat_col_02_shade1
f 1 22 23
vn 0.343140 -0.095764 0.350784
f 1 8 32
vn 0.024918 0.054718 0.496338
usemtl mat_col_06_shade1
f 7 22 32
vn 0.027512 0.063385 0.495163
f 32 8 7
vn 0.399719 -0.086884 0.287460
usemtl mat_col_03_shade1
f 61 8 1 11
vn -0.196564 -0.007233 0.459656
usemtl mat_col_01_shade1
f 23 9 57
vn -0.208679 -0.075897 0.447952
usemtl mat_col_02_shade2
f 23 58 59
vn -0.252319 -0.366669 0.227737
usemtl mat_col_03_shade3
f 26 60 14 63 17
vn 0.242889 -0.352753 0.257965
usemtl mat_col_03_shade2
f 3 4 4 12 1
vn -0.096817 -0.236130 0.429932
usemtl mat_col_05_shade2
f 26 25 23
vn 0.127426 -0.200333 0.440002
f 23 25 3
vn -0.074463 -0.415588 0.267792
usemtl mat_col_01_shade3
f 25 26 17
vn -0.006470 -0.437744 0.241501
f 25 17 4
vn 0.113663 -0.393524 0.286682
usemtl mat_col_01_shade2
f 4 3 25
vn 0.093460 0.086548 0.483475
usemtl mat_col_02_shade1
f 10 77 9 8
vn -0.253204 -0.363144 -0.232376
usemtl mat_col_03_shade3
f 39 34 48
vn 0.242889 -0.352753 -0.257980
f 71 33 73 38 37
vn -0.096817 -0.236130 -0.429947
usemtl mat_col_05_shade2
f 44 47 48
vn 0.127426 -0.200333 -0.440018
f 37 47 44
vn -0.075333 -0.411835 -0.273315
usemtl mat_col_01_shade3
f 39 48 47
vn -0.000244 -0.436234 -0.244293
f 38 39 47
vn 0.113663 -0.393524 -0.286697
f 47 37 38
vn 0.093430 0.090286 -0.482803
usemtl mat_col_02_shade1
f 45 50 79 51
vn -0.342712 -0.352036 -0.092743
usemtl mat_col_02_shade3
f 69 34 39 40

093E_000.mtl
Code: [Select]
newmtl mat_col_02_shade0
Ka 1.000000 1.000000 1.000000
Kd 1.000000 1.000000 1.000000
d 0.000000
newmtl mat_col_02_shade2
Ka 1.000000 1.000000 1.000000
Kd 1.000000 1.000000 1.000000
d 0.666667
newmtl mat_col_02_shade1
Ka 1.000000 1.000000 1.000000
Kd 1.000000 1.000000 1.000000
d 0.333333
newmtl mat_col_02_shade3
Ka 1.000000 1.000000 1.000000
Kd 1.000000 1.000000 1.000000
d 1.000000
newmtl mat_col_03_shade1
Ka 1.000000 0.560784 0.000000
Kd 1.000000 0.560784 0.000000
d 0.333333
newmtl mat_col_00_shade2
Ka 0.000000 0.000000 0.000000
Kd 0.000000 0.000000 0.000000
d 0.666667
newmtl mat_col_03_shade2
Ka 1.000000 0.560784 0.000000
Kd 1.000000 0.560784 0.000000
d 0.666667
newmtl mat_col_00_shade1
Ka 0.000000 0.000000 0.000000
Kd 0.000000 0.000000 0.000000
d 0.333333
newmtl mat_col_03_shade0
Ka 1.000000 0.560784 0.000000
Kd 1.000000 0.560784 0.000000
d 0.000000
newmtl mat_col_01_shade0
Ka 0.000000 0.000000 0.027451
Kd 0.000000 0.000000 0.027451
d 0.000000
newmtl mat_col_01_shade1
Ka 0.000000 0.000000 0.027451
Kd 0.000000 0.000000 0.027451
d 0.333333
newmtl mat_col_01_shade2
Ka 0.000000 0.000000 0.027451
Kd 0.000000 0.000000 0.027451
d 0.666667
newmtl mat_col_06_shade2
Ka 0.937255 0.247059 0.000000
Kd 0.937255 0.247059 0.000000
d 0.666667
newmtl mat_col_06_shade1
Ka 0.937255 0.247059 0.000000
Kd 0.937255 0.247059 0.000000
d 0.333333
newmtl mat_col_03_shade3
Ka 1.000000 0.560784 0.000000
Kd 1.000000 0.560784 0.000000
d 1.000000
newmtl mat_col_05_shade2
Ka 1.000000 0.560784 0.000000
Kd 1.000000 0.560784 0.000000
d 0.666667
newmtl mat_col_01_shade3
Ka 0.000000 0.000000 0.027451
Kd 0.000000 0.000000 0.027451
d 1.000000

(I realize the colors are wrong, as well as I still have to figure out what the shade value is for in shaded faces.)
1 Guest is here.
The forum you selected does not exist. Don't even try.
Contact SMF 2.0.19 | SMF © 2016, Simple Machines | Terms and Policies
FEEP
665b2d548b38d