Page 1 of 1

varint decoding

Posted: Thu Dec 18, 2014 1:22 pm
by Szkaradek123

Re: varint decoding

Posted: Thu Feb 23, 2017 7:31 pm
by Szkaradek123
Here is a trick how to decode varint.
I needed varint decoding to get models from Sketchfab.
So here is a way:
1.select Sketchfab site with your favorite model (best lowpoly)
2.save this site as complete html (it creates html file and folder with the same name as html file)
3.close web browser (best use mozilla firefox)
4.go to folder with saved site and doubleclick on html
5.change web browser mode to offline.
6.open web browser console
6.from saved html folder open file "viewer-c077fc97f229ec2c2f73.js" in notaped++
In offline mode and with "viewer-c077fc97f229ec2c2f73.js" you can control how translate data from function to function


7.in js file find something like that

Code: Select all

function(t,e,i){
       //data 't','e','i' on in
        console.log('t='+t)
        console.log('e='+e)
        console.log('i='+i)
	"use strict";
	var 
	n=i(1205),
	r=n.osg,
	a=function(t,e,i)
		{
		for(var n=new r[i](e),a=0,s=0;a!==e;){var o=0,u=0;do o|=(127&t[s])<<u,u+=7;while(0!==(128&t[s++]));n[a++]=o}if("U"!==i[0])
			for(var l=0;l<e;++l)
				{
				var h=n[l];n[l]=h>>1^-(1&h)
				}
			console.log(n)	
                       //or write console.log('n='+n)
                       //data "n" on out
			return n};t.exports=a},
8.in js write command "console.log(...)" you can see data in console
- example in code
9.refresh web browser and see what happen in console.
10.this method need time and patience.

edit:2019-02-18

here is a script which can not use to view textured models - for Blender version 2.49:
password:15 in polish language with english letters
How don't use:

1.use chrome
2. open sketchfab model
3.clear chrome cache ctrl+shift+del - clear only cache
4.run https://www.nirsoft.net/utils/chrome_cache_view.html
5.with "chrome cache view" export needed files: html, model, osgjs, and images to ONE folder
6.if you see no htm , save file from chrome - lctrl+s
7.
You need to install:
http://download.blender.org/release/Ble ... indows.exe
and
https://www.python.org/ftp/python/2.6.6 ... -2.6.6.msi

7.DOUBLECLICK Blender249.blend
8.press alt+p - mouse cursor in Blender Text Window and select htm(l) file.
9.for animation select first armature in 3d window and than import action file

Script is not for beginner. If you don't know what is Blender version 2.49 is, don't use.

Re: varint decoding

Posted: Fri Feb 24, 2017 4:51 am
by shakotay2
well, nice, as always :D

btw there's many "doubles" in the Uint16Arrays:
varint.JPG
These are the face indices? Do I miss something?

Re: varint decoding

Posted: Fri Feb 24, 2017 7:21 am
by Szkaradek123
Bytes are still encoded after unvarint.
It needs undelta, unimplicit and others use function to decode to indices.
But vertices need indices to decode and function like unpredict, unquantize.
All depend too if there are triangle_strip or triangles.

Re: varint decoding

Posted: Tue Feb 28, 2017 12:17 pm
by shakotay2
Szkaradek123 wrote:Bytes are still encoded after unvarint.
It needs undelta, unimplicit and others use function to decode to indices.
well, ok, thanks (sry, forgot this thread for a while).
I was a little bit confused because you wrote in your previous post (after that browser js action ):
Szkaradek123 wrote:Here is a finally script to import decoded models from Sketchfab.
As you may know I've extracted an orc some months ago using simple RAM logging (viewtopic.php?f=16&t=10668&p=117317&hil ... ng#p117317).
The problem was to find the (decoded!) face indices in tons of data.
(not sure whether this approach would be successful 11 months later :D )

Re: varint decoding

Posted: Sat Jul 01, 2017 10:00 pm
by feber13
Szkaradek123 wrote:Here is a trick how to decode varint.
I needed varint decoding to get models from Sketchfab.
So here is a way:
1.select Sketchfab site with your favorite model (best lowpoly)
2.save this site as complete html (it creates html file and folder with the same name as html file)
3.close web browser (best use mozilla firefox)
4.go to folder with saved site and doubleclick on html
5.change web browser mode to offline.
6.open web browser console
6.from saved html folder open file "viewer-c077fc97f229ec2c2f73.js" in notaped++
In offline mode and with "viewer-c077fc97f229ec2c2f73.js" you can control how translate data from function to function


7.in js file find something like that

Code: Select all

function(t,e,i){
       //data 't','e','i' on in
        console.log('t='+t)
        console.log('e='+e)
        console.log('i='+i)
	"use strict";
	var 
	n=i(1205),
	r=n.osg,
	a=function(t,e,i)
		{
		for(var n=new r[i](e),a=0,s=0;a!==e;){var o=0,u=0;do o|=(127&t[s])<<u,u+=7;while(0!==(128&t[s++]));n[a++]=o}if("U"!==i[0])
			for(var l=0;l<e;++l)
				{
				var h=n[l];n[l]=h>>1^-(1&h)
				}
			console.log(n)	
                       //or write console.log('n='+n)
                       //data "n" on out
			return n};t.exports=a},
8.in js write command "console.log(...)" you can see data in console
- example in code
9.refresh web browser and see what happen in console.
10.this method need time and patience.

Here is a finally script to import decoded models from Sketchfab.
Install Blender249 and Python266, doubleclick Blender249.blend, in Text Window press alt+p and select file.osgjs.
To import model you need model_file.bin and file.osgjs in the same folder.
To skip bindposing change line BINDPOSE=1 to BINDPOSE=0
Hello master, I wanted to know if you can make a video tutorial about maybe I got confused in some steps and it would be great help try the blender script produces an error or maybe I am very clumsy

Re: varint decoding

Posted: Wed Mar 13, 2019 6:49 pm
by M0fD
Aaaand a second method but who keeps the animation, love it !

Re: varint decoding

Posted: Thu Mar 14, 2019 9:29 am
by tpcrew
Szkaradek123 wrote:
Thu Feb 23, 2017 7:31 pm
edit:2019-02-18

here is a script which can not use to view textured models - for Blender version 2.49:
password:15 in polish language with english letters
How don't use:

3.clear chrome cache ctrl+shift+del - clear only cache

5.with "chrome cache view" export needed files: html, model, osgjs, and images to ONE folder
It'd be great if you could explain this a little better. Thanks.

Re: varint decoding

Posted: Mon Mar 18, 2019 10:15 pm
by RetroGEO
Keeps giving me illegal character errors clicking the html file with the model name

Re: varint decoding

Posted: Thu Mar 21, 2019 5:08 pm
by slipknot25
it extract animation as .action file , how i can unpack .action file or how to use it ?