XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Sun May 28, 2017 11:50 am

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 120 posts ]  Go to page 1, 2, 3, 4, 5 ... 8  Next
Author Message
 Post subject: ArtStation files
PostPosted: Sun Aug 02, 2015 12:58 pm 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Mon Sep 26, 2011 12:51 pm
Posts: 334
Has thanked: 12 times
Have thanks: 114 times
So I've been taking a look at this model:

https://www.artstation.com/artwork/the-dwarf-mortar

You can donwload it and you will end up with a .mview file.

Been doing some digging on that file and it actually is more like an unzipped, un-encrypted storage for textures, models , thumbnail and some json files.

Structure:
String1 String2 zero chuncklength chunklength chunck

In code :
Code:
var file = @"d:\downloads\dwarf\dwarfstand.mview";

            using (BinaryReader br = new BinaryReader(File.Open(file, FileMode.Open)))
            {
                while (br.BaseStream.Position < br.BaseStream.Length)
                {
                    var str1 = br.ReadStringZeroEnded();
                    var str2 = br.ReadStringZeroEnded();
                    var zero = br.ReadUInt32();
                    var len = br.ReadUInt32();
                    var len2 = br.ReadUInt32(); // len and len2 are always the same length :/

                    br.SkipBytes((int)len);

                    Console.Write(str1 + " : " );
                    Console.WriteLine(str2);
                    Console.WriteLine(len);

                }
                br.Close();
            }


This will return you

Code:
thumbnail.jpg : image/jpeg
17178
sky.dat : image/derp
1150164
mesh0.dat : model/mset
164
mesh1.dat : model/mset
432
mesh2.dat : model/mset
164
mesh3.dat : model/mset
236176
mesh4.dat : model/mset
103672
mesh5.dat : model/mset
233672
mesh6.dat : model/mset
364
mat0_c.jpg : image/jpeg
2085
mat0_r.jpg : image/jpeg
632
mat0_n.jpg : image/jpeg
635
mat0_a.jpg : image/jpeg
631
mat0_g.jpg : image/jpeg
630
mat0_s.jpg : image/jpeg
1297
mat1_c.jpg : image/jpeg
334021
mat1_n.jpg : image/jpeg
635
mat2_c.jpg : image/jpeg
396716
mat3_c.jpg : image/jpeg
353699
mat4_c.jpg : image/jpeg
29182
mat4_a.jpg : image/jpeg
24719
mat5_c.jpg : image/jpeg
7901
mat5_a.jpg : image/jpeg
631
mat5_s.jpg : image/jpeg
9317
mat6_c.jpg : image/jpeg
7119
mat6_a.jpg : image/jpeg
630
scene.json.sig : application/json
930
scene.json : application/json
6590


and when you write out the chuncks to disc, you will actuall get all these files

like the example below :)

since the json files hold the data for the vertices and indices, lets see what I can do with that!

( sorry for the xpost on the webgl topic, thought this would be more interesting to have its own)

T.


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.


_________________
My Game Dev Blog
My Starcraft II Mod files and scripts


Last edited by TaylorMouse on Fri Aug 07, 2015 10:06 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: ArtStation .mview files
PostPosted: Sun Aug 02, 2015 1:43 pm 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Mon Sep 26, 2011 12:51 pm
Posts: 334
Has thanked: 12 times
Have thanks: 114 times
And after looking at the json file, witch is really easy to read :)

here is the result:


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.


_________________
My Game Dev Blog
My Starcraft II Mod files and scripts


Top
 Profile  
 
 Post subject: Re: ArtStation .mview files
PostPosted: Sun Aug 02, 2015 1:47 pm 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Mon Sep 26, 2011 12:51 pm
Posts: 334
Has thanked: 12 times
Have thanks: 114 times
And here is the little maxscript I used to generate that nice model :)

Code:
/*
    Art Station dat Files

*/

file = @"D:\Downloads\Dwarf\mesh3.dat"

theName = "ease2" --> from the jSon File

stream = fopen file "rb"


/* INDICES */
indices = 16632 --> from the jSon file

faces = #()

for i = 1 to indices do
(
    a = ( readshort stream ) + 1
    b = ( readshort stream ) + 1
    c = ( readshort stream ) + 1

    append faces [a,b,c]

)

/* VERTICES */
vertexCount = 4262 --> from the jSon file

vertices = #()
uvs = #()
normals = #()
vColor = #()
mesh
for v= 1 to vertexCount do
(
    x = readfloat stream
    y = readfloat stream
    z = readfloat stream
    u = readfloat stream
    v = readfloat stream
    nx = readfloat stream
    ny = readfloat stream
    r = (readbyte stream) as integer
    g = (readbyte stream) as integer
    b = (readbyte stream) as integer
    a = (readbyte stream) as integer

    append vertices [x,-z,y]
    append uvs [u,v,0.0]
    append normals [nx, ny, 1.0]
    append vColor [r,g,b,a]

)
theMesh = mesh vertices:vertices vnorms:normals name:theName tverts:uvs faces:faces
theMesh.WireColor = Color (random 0 128) (random 0 255) (random 0 128)
buildTVFaces theMesh false
for i = 1 to faces.count do
( setTVFace theMesh i faces[i] )

update theMesh

fclose stream


btw: this is probably the fastest reverse engineering thing that I ever did ( all in less than 2 hours!! )

T.

_________________
My Game Dev Blog
My Starcraft II Mod files and scripts


Top
 Profile  
 
 Post subject: Re: ArtStation .mview files
PostPosted: Mon Aug 03, 2015 6:53 pm 
Offline
advanced

Joined: Fri Sep 03, 2010 8:45 am
Posts: 42
Has thanked: 13 times
Have thanks: 8 times
Big Thanx .Nice


Last edited by medwed on Fri Dec 18, 2015 3:27 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: ArtStation .mview files
PostPosted: Tue Aug 04, 2015 11:03 am 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Mon Sep 26, 2011 12:51 pm
Posts: 334
Has thanked: 12 times
Have thanks: 114 times
for those interested in the extension methods used above:

Code:
        /// <summary>
        /// Read a string that has an ending \0 character
        /// </summary>
        /// <param name="br">Binary Reader Extension Method</param>
        /// <returns></returns>
        public static string ReadStringZeroEnded(this BinaryReader br)
        {
            try
            {
                string ret = "";
                char c;
                while ((c = br.ReadChar()) != '\0')
                {
                    ret += c.ToString();
                }
                return ret;
            }
            catch (Exception)
            {
            }
            return String.Empty;
        }


Code:
        public static void SkipBytes(this BinaryReader br, int nbrOfBytes)
        {
            br.BaseStream.Seek(nbrOfBytes, SeekOrigin.Current);
        }

_________________
My Game Dev Blog
My Starcraft II Mod files and scripts


Top
 Profile  
 
 Post subject: Re: ArtStation .mview files
PostPosted: Tue Aug 04, 2015 11:31 am 
Offline
advanced

Joined: Fri Sep 03, 2010 8:45 am
Posts: 42
Has thanked: 13 times
Have thanks: 8 times
How to go about it ? Thanks


Top
 Profile  
 
 Post subject: Re: ArtStation .mview files
PostPosted: Tue Aug 04, 2015 12:31 pm 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Mon Sep 26, 2011 12:51 pm
Posts: 334
Has thanked: 12 times
Have thanks: 114 times
Alright here is how it works, it is NOT automated!!

* Getting the file and extracting its content:
1. Donwload the file in attachment
2. Open the url with the model from ArtStation, do NOT press the play button yet!
3. In Chrome, bring up the Developer tools ( F12)
4. In the dev tools select Network, make sure it is empty ( if not click the next to the record button )
5. Press the Play button to load up the 3D model
6. Lots of stuff will pop up in the dev tool, mostly png files and some Unique identifiers that look like textures, ignore all but the <somefilename>.mview
- it is possible it has a ?<someNumber> behind it, but you can ignore that.
7. double click that file, wait a few seconds, and the file will download.
8. drop the file onto the mviewUnpack.exe, if this does not work, open a command prompt and enter it manually, example: mviewUnpack.exe <filename>.mview
9. this will unpack all the textures and files you need.

* getting the file in max
(since I did all this in the nick of time, I have no automated process for this, but this is how it works)
1. open the json file in a text editor ( if you open this in Visual Studio you can press Control K +D to auto format it )
2. Look for "Meshes"
3. Note the Name, IndexCount, vertexCount and the name of the dat file.

ex:
Code:
"meshes": [
    {
      "name": "Head_L_Head_L_retop",
      "indexCount": 1536,
      "indexTypeSize": 2,
      "wireCount": 2584,
      "vertexCount": 414,
      "cullBackFaces": 1,
      "castShadows": 1,
      "minBound": [ -0.420129, 7.77742, -0.799188 ],
      "maxBound": [ 0.420129, 9.60209, 0.448399 ],
      "subMeshes": [
        {
          "material": "Head",
          "firstIndex": 0,
          "indexCount": 1536,
          "firstWireIndex": 0,
          "wireIndexCount": 2584
        }
      ],
      "file": "mesh0.dat"
    },


4. Open MAX ( any version will do, tested from 2011 )
5. Copy the max script from my previous post into the max Script Editor
6. Change the name of the mesh, indexcount, vertexcount and the name of the dat file
7. Run ( Control + E )
8. do this for all the other meshes in the jSon file
9. DONE

If anyone wants to make this automated, well the second part that is, be my guest :p


Note:
[*] the json file also contains a ref to the material ( in the example it is called "Head" )
[*] search the json file for this material name to know what material is applied to that specific mesh


C&C are welcome

T.


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.


_________________
My Game Dev Blog
My Starcraft II Mod files and scripts


Top
 Profile  
 
 Post subject: Re: ArtStation .mview files
PostPosted: Tue Aug 04, 2015 3:19 pm 
Offline
advanced

Joined: Fri Sep 03, 2010 8:45 am
Posts: 42
Has thanked: 13 times
Have thanks: 8 times
BIG THANKS :) !


Top
 Profile  
 
 Post subject: Re: ArtStation .mview files
PostPosted: Tue Aug 04, 2015 3:30 pm 
Offline
ultra-n00b

Joined: Mon Nov 21, 2011 6:12 pm
Posts: 8
Has thanked: 2 times
Have thanks: 0 time
Script does not work, 3ds max 2011(x64)
http://pastebin.com/RV6MrjCk

_________________
Sorry for my bad English


Top
 Profile  
 
 Post subject: Re: ArtStation .mview files
PostPosted: Tue Aug 04, 2015 3:48 pm 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Mon Sep 26, 2011 12:51 pm
Posts: 334
Has thanked: 12 times
Have thanks: 114 times
euh... did you look at the name of the file ?

very coincidental that it does not work on mesh3.dat since it is the file I use in my script, it is not necessarely the file you should use....

can you post the url of the model you are trying?

T.

_________________
My Game Dev Blog
My Starcraft II Mod files and scripts


Top
 Profile  
 
 Post subject: Re: ArtStation .mview files
PostPosted: Tue Aug 04, 2015 3:53 pm 
Offline
ultra-n00b

Joined: Mon Nov 21, 2011 6:12 pm
Posts: 8
Has thanked: 2 times
Have thanks: 0 time
https://www.artstation.com/embed/1033296
I tried several models but each time script gives the same error

_________________
Sorry for my bad English


Top
 Profile  
 
 Post subject: Re: ArtStation .mview files
PostPosted: Tue Aug 04, 2015 6:04 pm 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Mon Sep 26, 2011 12:51 pm
Posts: 334
Has thanked: 12 times
Have thanks: 114 times
I've taken a look at some other files as well.

Weird thing is that sometimes the number is equal to (IndexCount + WireCount ) * IndexTypeSize, which in some cases is not even dividable by 6 ( 3 faces * 2 bytes )
this results in a "broken" mesh

now this mesh that you are looking at, has a IndexTypeSize of 4 ?? non of the other models had that.

So I'm looking into that.

Code:
clearlistener()
/*
    Art Station dat Files

*/

file = @"G:\Game Dev\3D Models\Art Station\Jacket\mesh3.dat"

theName = "we" --> from the jSon File

stream = fopen file "rb"

indexCount = 11607
wireCount  = 15734
indexTypeSize = 2
indicesSize = ( indexCount + wireCount ) * indexTypeSize

/* INDICES */
indices = indicesSize / ( 6 ) --> from the jSon file
rest = mod indicesSize  ( 6  )
faces = #()

bigestIndex = 0

for i = 1 to indices do
(
    a = ( readshort stream #unsigned ) + 1
    b = ( readshort stream #unsigned ) + 1
    c = ( readshort stream #unsigned) + 1

    if ( bigestIndex < a ) then bigestIndex = a
    if ( bigestIndex < b ) then bigestIndex = b
    if ( bigestIndex < c ) then bigestIndex = c

    append faces [a,b,c]

)
print "biggest intdex"
print bigestIndex

currentPos = ftell stream

if( rest > 0.0) then
(
    for i=1 to rest do
        readbyte stream
)

/* VERTICES */
vertexCount = 2237 --> from the jSon file

vertices = #()
uvs = #()
normals = #()
vColor = #()
mesh
for v= 1 to vertexCount do
(
    x = readfloat stream
    y = readfloat stream
    z = readfloat stream
    u = readfloat stream
    v = readfloat stream
    nx = readfloat stream
    ny = readfloat stream
    r = (readbyte stream) as integer
    g = (readbyte stream) as integer
    b = (readbyte stream) as integer
    a = (readbyte stream) as integer

    append vertices [x,-z,y]
    append uvs [u,v,0.0]
    --append normals [nx, ny, 1.0]
    --append vColor [r,g,b,a]

)
theMesh = mesh name:theName vertices:vertices faces:faces tverts:uvs --vnorms:normals
theMesh.WireColor = Color (random 0 128) (random 0 255) (random 0 128)
buildTVFaces theMesh false
for i = 1 to faces.count do
( setTVFace theMesh i faces[i] )

update theMesh

fclose stream



I'm currently still looking into the Type 4 dat files.... no result yet, this was the closest I could get to a matching model for the jacket...

T.

_________________
My Game Dev Blog
My Starcraft II Mod files and scripts


Top
 Profile  
 
 Post subject: Re: ArtStation .mview files
PostPosted: Tue Aug 04, 2015 8:02 pm 
Offline
advanced

Joined: Tue Nov 06, 2012 7:57 am
Posts: 66
Has thanked: 7 times
Have thanks: 1 time
Getting the .mview is a lot easier than that. You just click the embed code just under the model screen.
Then copy the src (source) url without the quotations and paste it at the top.
Then go view source and the .mview url is right there.
Thanks a lot for this tool though:)


Top
 Profile  
 
 Post subject: Re: ArtStation .mview files
PostPosted: Wed Aug 05, 2015 1:28 am 
Offline
ultra-n00b

Joined: Tue Aug 04, 2015 11:49 pm
Posts: 1
Has thanked: 1 time
Have thanks: 0 time
Hi,

I tried on the Marmoset website gallery
with the IronMan model.
The last script works as well.
It's a little bit laborious, to assemble each elements,
at least, a dialog box to type each pieces would be more user friendly.

Anyway, thanks to share your experiments.

;)


Top
 Profile  
 
 Post subject: Re: ArtStation .mview files
PostPosted: Wed Aug 05, 2015 6:51 am 
Offline
advanced

Joined: Tue Nov 06, 2012 7:57 am
Posts: 66
Has thanked: 7 times
Have thanks: 1 time
I get the same error as lafugix for all models. I use MAX 2012 64bit.
Also I recommend calling this thread 'artstation files' so they don't see this topic and patch it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 120 posts ]  Go to page 1, 2, 3, 4, 5 ... 8  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: streetracer23, Yahoo [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group