[Release] Speedy Scb to Obj, Sco Converter 1.6

Page 1 of 3 123 LastLast
Results 1 to 15 of 35
  1. #1
    Rival Gamers Owner own_prox is offline
    MemberRank
    Jul 2007 Join Date
    HellLocation
    1,077Posts

    thumbs up [Release] Speedy Scb to Obj, Sco Converter 1.6

    hello i'm proud to release this converter i have been working on and off on for the last few 2 days

    Programmed in: C++

    Features:
    Attempts to fix broken .wgt
    Generates .wgts files (need to add source below this fix's the armours bug that is if you want to use it for .sco generation)
    Convert separate scb files to sco
    Convert separate scb files to obj
    Convert all scb to obj in the same directory

    Convert all scb to sco in the same directory

    Download v1.6: Click Here!

    Virus Scan: Click Here!

    Modifications to RsBuild to work with new wgts files

    Find (r3dObj.h):
    Code:
    void		TryLoadWeights(const char* baseFileName);
    Add this under it:
    Code:
    void LoadSourceWeights(const char* fname);
    Find(r3dObj.cpp):
    Code:
    void r3dMesh::TryLoadWeights( const char* baseFileName )
    {
    	// first, try .wgt
    	char weightName[25];
    
    	ToSkinFileName( weightName, baseFileName ) ;
    
    if(r3d_access(weightName, 0) == 0) 
    		LoadWeights( weightName );
    }
    Replace with:
    Code:
    void r3dMesh::TryLoadWeights( const char* baseFileName )
    {
    	// first, try .wgt
    	char weightName[256], weightsource[256];
    
    	ToSkinFileName( weightName, baseFileName ) ;
    	sprintf(weightsource, "%ss", weightName);
    	if(r3d_access(weightsource, 0) == 0) 
    		LoadSourceWeights(weightsource);
    	else if(r3d_access(weightName, 0) == 0) 
    		LoadWeights( weightName );
    }
    void r3dMesh::LoadSourceWeights(const char* fname)
    {
    	AllocateWeights();
    
    	for(int i=0;i<NumVertices;i++) {
    		pWeights[i].BoneID[0] = 0;
    		pWeights[i].Weight[0] = 0;
    		pWeights[i].BoneID[1] = 0;
    		pWeights[i].Weight[1] = 0;
    		pWeights[i].BoneID[2] = 0;
    		pWeights[i].Weight[2] = 0;
    		pWeights[i].BoneID[3] = 0;
    		pWeights[i].Weight[3] = 0;
    	}
    
    
    	r3dFile *f = r3d_open(fname, "rb");
    	if(!f) r3dError("can't open %s\n", fname);
    	char inbuf[256], buf1[128];
    	int VertNum = 0;
    	fgets(inbuf, sizeof(inbuf), f);
    	sscanf(inbuf, "%s %d", buf1, &VertNum);
    
    		for(int i=0; i<VertNum ;i++) 
    	{
    		
    		
    		r3dWeight& w = pWeights[i];
    
    		float ws = 0.0f;
    		for(int k=0; k<4; k++) 
    		{
    			
    		byte  iBoneId = 0;
    		float fWeight = 0;
    	fgets(inbuf, sizeof(inbuf), f);
    			if(sscanf(inbuf, "%d %f", &iBoneId, &fWeight) == 2)
    		{
    			if(!(fWeight >= 0.f && fWeight <= 1.f)) r3dOutToLog("Weight Issue: %f", fWeight);
    			r3d_assert(fWeight >= 0.f && fWeight <= 1.f);
    			w.Weight[k] = fWeight;
    			w.BoneID[k] = iBoneId;
    
    			ws += w.Weight[k];
    			}
    		}
    
    		if(ws > 0.0f) 
    		{
    			// renormalize weights, because some Maya exporter dude screwed it up.
    			w.Weight[0] /= ws; 
    			w.Weight[1] /= ws; 
    			w.Weight[2] /= ws; 
    			w.Weight[3] /= ws; 
    		}  
    			
    	}
    
    	fclose(f);
    	return;
    }
    ScreenShots:





    Let the leeching begin... lol

    Credits:
    Me
    Warz
    GigaToni (for the idea + hints about the weight files)
    Attached Files Attached Files
    Last edited by own_prox; 11-08-15 at 10:12 PM. Reason: Added .obj support


  2. #2
    ☆Dying Dawn☆ Bombillo is offline
    MemberRank
    Jan 2012 Join Date
    ValhallaLocation
    977Posts

    Re: [Release] Warz Scb to Sco Converter

    awesome release it's very useful for the RSBuild without scb convert

  3. #3
    Rival Gamers Owner own_prox is offline
    MemberRank
    Jul 2007 Join Date
    HellLocation
    1,077Posts

    Re: [Release] Warz Scb to Sco Converter

    thanks well i made my rsbuild convert the scb's to sco but when i built a incremental update later on it bugs all textures and weights for some reason so i just made a converter and put rsbuild back to normal hopefully this will solve that :)



    Version 1.1 released if you have the previous version it does not work.


    edit unfortunately atm this only seems to work correctly with weapons and in some cases it does work with armour

    weapon Converted:


    Rare armours that converted:


    Amour Converted(will fix soon):



    anyone else got any insight to why some armour conversions cause such a bug? all the flag types are 1.

    mind you i used Thailand data to convert
    Last edited by own_prox; 09-08-15 at 05:23 AM.

  4. #4
    Survivalsunknown owner fpskiller is offline
    MemberRank
    Oct 2013 Join Date
    englandLocation
    416Posts

    Re: [Release] Warz Scb to Sco Converter v1.1

    seems to work fine for armour for me just tryed it with the swat armor
    [IMG][/IMG]

  5. #5
    Custom Title Enabled GigaToni is offline
    MemberRank
    Aug 2009 Join Date
    GER / FRLocation
    2,329Posts

    Re: [Release] Warz Scb to Sco Converter v1.1

    You should look into flags.

    Flag 1 means it has weights
    Flag 2 means multi UV

    btw @own_prox that bug is caused by the weight file. Not the model itself. (Weight file = wgt) for example:
    It's flag 1 but it can't load the wgt
    It's flag 1 but can't create the wgt (Only scb create wgt files.)
    It's flag 1 but the wgt file is damaged.
    Last edited by GigaToni; 11-08-15 at 01:59 AM.

  6. #6
    Rival Gamers Owner own_prox is offline
    MemberRank
    Jul 2007 Join Date
    HellLocation
    1,077Posts

    Re: [Release] Warz Scb to Sco Converter v1.1

    @GigaToni
    hmm yeah but when logging all the flag types for armour and weapons it seemed they were only flag type 1, but yeah ill add flags 4 support and look into adding flags 2

    Flag 4 Loading:
    Code:
    // read UV2 section if it exists
    	fgets(inbuf, sizeof(inbuf), f);
    	if(_r3d_Mesh_LoadSecondUV && strncmp(inbuf, "[UV2]", 5) == 0)
    	{
    		r3d_assert(VertexSecondUVs == NULL);
    		VertexSecondUVs = gfx_new r3dPoint2D[NumVertices];
    		VertexFlags |= vfHaveSecondUV;
    
    		for(int i=0; i<NumVertices; i++)
    		{
    			fgets(inbuf, sizeof(inbuf), f);
    
    			int scanned = sscanf(inbuf, "%f %f", &VertexSecondUVs[i].x, &VertexSecondUVs[i].y);
    			if(scanned != 2)
    			{
    				MessageBox(0, "Bad UV2 mesh format", f->GetFileName(), MB_OK);
    				break;
    			}
    		}
    	}
    thats easy format in sco would be like this:
    Code:
    [UV2]
    x y
    x y
    ill add support now

    @fpskiller
    it only seems some amours happen to do this try items from thailand, like the valentine head pieces
    here i uploaded them them: https://mega.co.nz/#!RZIwFBrD!axF7NF...N8_UOGNsUFrGf8

    Update:
    V1.2 Released with flags 2 & 4 supported however i cannot find a file with such flags to test, if anyone can head me to a .scb or .sco that has them i will be able to actually test it

    Quote Originally Posted by GigaToni View Post
    You should look into flags.

    Flag 1 means it has weights
    Flag 2 means multi UV

    btw @own_prox that bug is caused by the weight file. Not the model itself. (Weight file = wgt) for example:
    It's flag 1 but it can't load the wgt
    It's flag 1 but can't create the wgt (Only scb create wgt files.)
    It's flag 1 but the wgt file is damaged.
    so your telling me its due to me not saving weights properly in a sco format, if so thats gonna be annoying :)

    weird part is heres how warz loads a sco: [C++] int r3dMesh::LoadAscii( r3dFile *f, bool use_default_material ) { char inbuf[ - Pastebin.com
    cant seem to find anything about loading the weights in here

    yeah i get you like when using 3dmax exporting, it exports a weight file,

    does this mean infestation thailand has changed the wgt files ? because some work and some dont its weird


    heres another weird thing when using rsbuild method to convert the scb to sco released on ragezone somewhere it worked the fist time every single model but when i did a update using incremental update it bugged them its really strange not sure why it did that.
    Last edited by own_prox; 11-08-15 at 02:31 AM.

  7. #7
    Survivalsunknown owner fpskiller is offline
    MemberRank
    Oct 2013 Join Date
    englandLocation
    416Posts

    Re: [Release] Warz Scb to Sco Converter v1.2

    @own_prox i used the scb from thailand for the swat armor and the vdv's

  8. #8
    m70b1jr#9501 m70b1jr is offline
    MemberRank
    May 2013 Join Date
    North CarolinaLocation
    862Posts

    Re: [Release] Warz Scb to Sco Converter v1.2

    You should try a proper scb/sco to .obj converter..
    Good work.

  9. #9
    Rival Gamers Owner own_prox is offline
    MemberRank
    Jul 2007 Join Date
    HellLocation
    1,077Posts

    Re: [Release] Warz Scb to Sco Converter v1.2

    @fpskiller try these they are valentine gear from thailand
    https://forum.ragezone.com/redirect-...N8_UOGNsUFrGf8


    i was going to add support to export as .obj
    thanks but i don't think i need to try other converters as this is a "proper converter"
    Last edited by own_prox; 11-08-15 at 10:52 AM.

  10. #10
    Survivalsunknown owner fpskiller is offline
    MemberRank
    Oct 2013 Join Date
    englandLocation
    416Posts

    Re: [Release] Warz Scb to Sco Converter v1.2

    im going to try them later as about to go out @own_prox

  11. #11
    Rival Gamers Owner own_prox is offline
    MemberRank
    Jul 2007 Join Date
    HellLocation
    1,077Posts

    Re: [Release] Warz Scb to Sco Converter v1.2

    Update: V1.5 now generates .wgts files :) requires source edits to load these files (sorry), i tried to make a wgt file but for some reason after saving and then loading it the data corrupts it reads up to 59 weights fine, so i simply just made it dump to text which solved the issue

    will upload some more screenshots when i tested my new armour :)



    well after seeing that number i dont think i want add anything else im happy with 420 lines :), talking of 420 its about time i blaze 1

    p.s any damaged weight value will be set to 1.f



    This worked all armours work 100% now no issue enjoy the converter!
    Last edited by own_prox; 11-08-15 at 06:05 PM.

  12. #12
    m70b1jr#9501 m70b1jr is offline
    MemberRank
    May 2013 Join Date
    North CarolinaLocation
    862Posts

    Re: [Release] Warz Scb to Sco Converter v1.5

    I don't think Gigatoni or Synx understood what I was trying to say.
    I was saying in the future he should make a .sco to .obj converter..

  13. #13
    Rival Gamers Owner own_prox is offline
    MemberRank
    Jul 2007 Join Date
    HellLocation
    1,077Posts

    Re: [Release] Warz Scb to Sco Converter v1.5

    i will add support soon i gotta build both files and compare the differences then manipulate it,
    taking alook at obj file but i cant find any comparison in the numbers they must use some sort of forumla


    90% done on .obj support faces was tricky
    Code:
    int a=0,b=0,c=0, counter = 1, ca, cb,cc;
    	for(i = 0; i < s->Faces; i++)
        { 
    		a = s->IndicesA[i] + 1;
    		b = s->IndicesB[i] + 1;
    		c = s->IndicesC[i] + 1;
    		ca = counter++;
    		cb = counter++;
    		cc = counter++;
    		fprintf(file, "f %d/%d/%d %d/%d/%d %d/%d/%d\n", a, ca, a, b, cb, b, c,cc, c);
        }
    just got material and textures to do

    Last edited by own_prox; 11-08-15 at 09:19 PM.

  14. #14
    Ass(et) Man The Owl is offline
    MemberRank
    Oct 2013 Join Date
    377Posts

    Re: [Release] Warz Scb to Sco Converter v1.2

    Quote Originally Posted by m70b1jr View Post
    You should try a proper scb/sco to .obj converter..
    Good work.
    this is litterly pointless and a waste of time because @GigaToni released sco import for 3ds max, which you can export obj from if you really want but that's pretty much unneeded as you can just work with the raw file....

  15. #15
    Rival Gamers Owner own_prox is offline
    MemberRank
    Jul 2007 Join Date
    HellLocation
    1,077Posts

    Re: [Release] Warz Scb to Sco Converter v1.2

    Quote Originally Posted by The Owl View Post
    this is litterly pointless and a waste of time because @GigaToni released sco import for 3ds max, which you can export obj from if you really want but that's pretty much unneeded as you can just work with the raw file....
    haha true but a bit too late i already did it :), i guess the good advantage of using this is you can convert multiple files with no trouble.

    it was'nt too much to programming anyways the .obj support
    Code:
    void SaveObj(SCB* s, char* path)
    {
        FILE *file = fopen(path, "wb");
    
        int i;
        for(i = 0; i < s->NumVertices; i++) fprintf(file, "v %.6f %.6f %.6f\n", s->VertexPositions[i].x, s->VertexPositions[i].y, s->VertexPositions[i].z);
    	fprintf(file, "\n");
    	for(i = 0; i < s->NumVertices; i++) fprintf(file, "vn %.6f %.6f %.6f\n", s->VertexNormals[i].x, s->VertexNormals[i].y, s->VertexNormals[i].z);
    	fprintf(file, "\n");
    	for(i = 0; i < s->Faces; i++) 
    	{
    		fprintf(file, "vt %.12f %.12f\n", s->VertexUVs[s->IndicesA[i]].x, s->VertexUVs[s->IndicesA[i]].y);
    		fprintf(file, "vt %.12f %.12f\n", s->VertexUVs[s->IndicesB[i]].x, s->VertexUVs[s->IndicesB[i]].y);
    		fprintf(file, "vt %.12f %.12f\n", s->VertexUVs[s->IndicesC[i]].x, s->VertexUVs[s->IndicesC[i]].y);
    	}
    
    	int a=0,b=0,c=0, counter = 1, ca, cb,cc;
    	for(i = 0; i < s->Faces; i++)
        { 
    		a = s->IndicesA[i] + 1;
    		b = s->IndicesB[i] + 1;
    		c = s->IndicesC[i] + 1;
    		ca = counter++;
    		cb = counter++;
    		cc = counter++;
    		fprintf(file, "f %d/%d/%d %d/%d/%d %d/%d/%d\n", a, ca, a, b, cb, b, c,cc, c);
        }
        fclose(file);
    
    }

    v1.6: supports converting to .obj (do note you will have to manually place a texture in 3d max)
    Last edited by own_prox; 11-08-15 at 09:46 PM.



Page 1 of 3 123 LastLast

Advertisement