Jump to content

Crimson Skies: High Road to Revenge (DirectX *.x)


Recommended Posts

5 hours ago, shak-otay said:

Scaling in (older) blender behaves a little bit strange. And it would be required to have different ratios for x and y. If you scale the tga file in y-axis (outside blender), save it and load it into blender the displayed texture on the mesh doesn't change. Very odd...

In newer blender (v3.x) it seems to work "perfectly" because you can change the ratios for x and y independently.

 

zep_logo_scaling.png

logo_ok.png

very odd yeah. I do use newer blender at least. Now I'm wondering if it's worth turning the Noesis plugin into a direct Blender importer lol

Link to comment
Share on other sites

On 5/4/2024 at 1:32 AM, h3x3r said:

Sorry i am tired... Need sleep. BTW i think i got figured full struct.

hey there, was there any progress on this? still completely clueless myself unfortunately

Link to comment
Share on other sites

  • Engineer
Posted (edited)

Hey, sorry for being quite. Now working on matrix to get it right so the model parts will be on right place.

BTW i have made a good progress so far. I can export models with mtl files so it will have assigned textures.

But i am struggle with matrix. When i apply it the shape is not on correct position as it should be. It works for some of the parts.

For example "propeller blade" has correct matrix. Maybe i am missing something.bandito.thumb.jpg.282d5aca419c909266877f07eeed73e2.jpg

EDiT: Well i think i got the idea. Maybe i have wrong matrix order. X,Y,Z or Z,Y,X there is many so i must figure out which one is correct.

Edited by h3x3r
  • Like 1
Link to comment
Share on other sites

1 hour ago, h3x3r said:

Hey, sorry for being quite. Now working on matrix to get it right so the model parts will be on right place.

BTW i have made a good progress so far. I can export models with mtl files so it will have assigned textures.

But i am struggle with matrix. When i apply it the shape is not on correct position as it should be. It works for some of the parts.

For example "propeller blade" has correct matrix. Maybe i am missing something.bandito.thumb.jpg.282d5aca419c909266877f07eeed73e2.jpg

EDiT: Well i think i got the idea. Maybe i have wrong matrix order. X,Y,Z or Z,Y,X there is many so i must figure out which one is correct.

odd for sure, i wonder why it's set up like this. no wonder i couldn't figure it out though lol, hopefully you can figure out the matrix order!

  • Like 1
Link to comment
Share on other sites

hey guys im new here and was wondering whats going on exactly as i was on the hunt for a graphic mod for Crimson Skies: High Road to Revenge to hopefully get more out of it

 

Link to comment
Share on other sites

  • Engineer
Posted (edited)

So here it is. Far from perfect. A shit ton of exceptions. TBH it was nightmare...

Requirments: 
> 010 Hex Editor 
> Or rewrite it to the python

>Maya 2020 and above

Templete has some flaws like it doesn't know where to end the loop. Don't know how to fix it.
So it end up with those messages:
<Error on read file.>
<Template passed end of file at variable 'Count'.>
And if it ends up with those messages it means that template reach end of the file and succesfuly parsed.

If you catch different error message let me know on which file.

About models. Template output them as *.obj and *.mtl files. They also must be next to the "Textures" folder. Models doesn't have vertex normals so you must generate them.
About matrix... Deal with it. I noticed in most cases that model 0 use matrix from model 1. I think there will be some sort of group/parent. If you want try luck with matrix values you can use them in Maya in script editor > mel command.
If any of matrix file is empty it means there is no matrix at all.
For textures use Noesis with "Batch Process" and paste this $inpath$\Textures\$inname$.$outext$ to the "Output path:" and set "Input extension:" to tga and "Output extension:" to dds and select folder to Batch. 
If you want use different extension like tga or png or whatever you must change it in the Template. There is a line with dds string. "Printf("map_Kd Textures/%s.dds\n",Names.Name[0].TextureName);"

And lastly don't even think about import. I am not willing to do that in any way.

crismossky_x.7z

Edited by h3x3r
  • Like 1
Link to comment
Share on other sites

23 minutes ago, h3x3r said:

So here it is. Far from perfect. A shit ton of exceptions. TBH it was nightmare...

Requirments: 
> 010 Hex Editor 
> Or rewrite it to the python

>Maya 2020 and above

Templete has some flaws like it doesn't know where to end the loop. Don't know how to fix it.
So it end up with those mesages:
<Error on read file.>
<Template passed end of file at variable 'Count'.>
And if it ends up with those messages it means that template reach end of the file and succesfuly parsed.

If you catch different error massage let me know on which file.

About models. Template output them as *.obj and *.mtl files. They also must be next to the "Textures" folder. Models doesn't have vertex normals so you must generate them.
About matrix... Deal with it. I noticed in most cases that model 0 use matrix from model 1. I think there will be some sort of group/parent. If you want try luck with matrix values you can use them in Maya in script editor > mel command.
If any of matrix file is empty it means there is no matrix at all.
For textures use Noesis with "Batch Process" and paste this $inpath$\Textures\$inname$.$outext$ to the "Output path:" and set "Input extension:" to tga and "Output extension:" to dds and select folder to Batch. 
If you want use different extension like tga or png or whatever you must change it in the Template. There is a line with dds string. "Printf("map_Kd Textures/%s.dds\n",Names.Name[0].TextureName);"

And lastly don't even think about import. I am not willing to do that in any way.

crismossky_x.7z 12.02 kB · 0 downloads

ah dang, don't have Maya. will have to try figure out how to make this usable with Blender or Noesis. appreciate the effort though!

Link to comment
Share on other sites

1 minute ago, h3x3r said:

You can open them in any 3d editor but you will be unable use matrix values. Because it's specific to maya and maybe max.

yeah i just realised you do the processing in 010. i'm an idiot lol, my bad!

Link to comment
Share on other sites

Posted (edited)
7 minutes ago, h3x3r said:

You can open them in any 3d editor but you will be unable use matrix values. Because it's specific to maya and maybe max.

had a quick test by importing in Blender - it seems to do the UV part correctly but fails to properly grab the skeleton stuff and leaves most submeshes at 0 instead of correctly positioning them, unless that's what the matrix stuff is that you were talking about (testing with cinematics_only_hr_devastator)

how would i merge the UV fixes with what @Durik256did with the noesis plugin? since that seems like it would probably produce a finished version

Edited by notameowcelot
Link to comment
Share on other sites

  • Engineer
4 minutes ago, notameowcelot said:

but fails to properly grab the skeleton stuff and leaves most submeshes at 0 instead of correctly positioning them, unless that's what the matrix stuff is that you were talking about

Yep that's matrix stuff. Manual.

BTW maybe durik can look at it. I don't know much about python.

Link to comment
Share on other sites

Posted (edited)
Just now, h3x3r said:

Yep that's matrix stuff. Manual.

BTW maybe durik can look at it. I don't know much about python.

gotcha - Durik did manage to get it, I don't think he said what the issue was specifically but all models worked fine - it was just the UVs that needed fixing (plus proper mat naming) and then I think the plugin could be considered complete

Edited by notameowcelot
  • Like 1
Link to comment
Share on other sites

  • Engineer

I can implement code for UV scale factor but dont know how to use it on buffer.

vnum = bs.readShort()
vbuf = bs.read(vnum*32)

//uv scale code
curPos = bs.tell()
uvscale = bs.readFloat()      
bs.seek(curPos,NOESEEK_ABS)

 

  • Like 1
Link to comment
Share on other sites

1 hour ago, h3x3r said:

I can implement code for UV scale factor but dont know how to use it on buffer.

vnum = bs.readShort()
vbuf = bs.read(vnum*32)

//uv scale code
curPos = bs.tell()
uvscale = bs.readFloat()      
bs.seek(curPos,NOESEEK_ABS)

 

image.png.c5acdd0684ca5602bc735d8e58fcf702.png

tried implementing this for myself, didn't get very far so far...probably will have to see what Durik comes up with

  • Like 1
Link to comment
Share on other sites

  • Engineer
9 hours ago, h3x3r said:

I can implement code for UV scale factor but dont know how to use it on buffer.

vnum = bs.readShort()
vbuf = bs.read(vnum*32)

//uv scale code
curPos = bs.tell()
uvscale = bs.readFloat()      
bs.seek(curPos,NOESEEK_ABS)

 

 

I haven't read it before. if you just need to scale uvs use this:

rapi.rpgSetUVScaleBias(NoeVec3([uvScale]*3), None)
Link to comment
Share on other sites

  • Engineer

uvscale.thumb.jpg.1a354efd9877a2c1beea6c9e74778ef5.jpg

Well read function is correct. But not sure where to use the code you provided.  I thought it could be right under:

rapi.rpgBindPositionBuffer(vbuf, noesis.RPGEODATA_FLOAT, 32)

But... I think there is a problem in conversion. UV are ushort and scale factor is float. So uv's gets even smaller.

My code converts ushorts to float and then apply scale factor. U * ScaleFactor, -V * ScaleFactor

  • Like 1
Link to comment
Share on other sites

9 minutes ago, h3x3r said:

uvscale.thumb.jpg.1a354efd9877a2c1beea6c9e74778ef5.jpg

Well read function is correct. But not sure where to use the code you provided.  I thought it could be right under:

rapi.rpgBindPositionBuffer(vbuf, noesis.RPGEODATA_FLOAT, 32)

But... I think there is a problem in conversion. UV are ushort and scale factor is float. So uv's gets even smaller.

My code converts ushorts to float and then apply scale factor. U * ScaleFactor, -V * ScaleFactor

had a shot at trying that as well. all UVs just end up at 0 in the corner in UV view, so mesh just appears as flat colors. I'm not sure what's up there

image.png.575704127c3b45af44086421205c9d1d.png

image.png

Link to comment
Share on other sites

Posted (edited)

I still can't figure out what I'm doing wrong unfortunately. All models appear as a flat color with no UV mapping if I try to implement that code (like above), so I must be missing something.

Edited by notameowcelot
Link to comment
Share on other sites

On 5/9/2024 at 1:58 PM, h3x3r said:

BTW I found one function which converts datatype to float.

dataToFloatList

But i must put it into the loop. I will try later.

Been busy, but haven't figured out how to make use of that yet. At the moment I'm still stuck with airplanepf_devastator.x looking like the following:

Fq8KCnZ.png

I've tried looking for proper Noesis api documentation but can't find anything at all, so no clue how to make use of dataToFloatList. @Durik256 is there any chance you might know something at all? would appreciate it a ton 🙂 

Link to comment
Share on other sites

  • Engineer

noesisv4466\plugins\python\__NPReadMe.txt

{"dataToFloatList", Noesis_DataToFloatList, METH_VARARGS, "returns a list of floats interpreted from raw data. (Oiii|i)"}, //args=bytearray, number of elements, RPGEODATA_ type, NOE_LITTLEENDIAN or NOE_BIGENDIAN, (optional) scale and bias unsigned values into -1 to 1 range if 1

 

Link to comment
Share on other sites

Just now, h3x3r said:

noesisv4466\plugins\python\__NPReadMe.txt

{"dataToFloatList", Noesis_DataToFloatList, METH_VARARGS, "returns a list of floats interpreted from raw data. (Oiii|i)"}, //args=bytearray, number of elements, RPGEODATA_ type, NOE_LITTLEENDIAN or NOE_BIGENDIAN, (optional) scale and bias unsigned values into -1 to 1 range if 1

 

oh shit, completely missed that. thanks!

Link to comment
Share on other sites

Posted (edited)

so i've tried implementing it but just run into buffer or RPGEO triangle errors so still struggling here 😞

i'm also not sure if what i'm getting is uv scale or something else since in my print for mat_83 (which is the devastator main body submesh) is getting a uv scale of 8.56387268868275e-05 - it's way too large, a more accurate number is roughly 5.6 if i try to scale up in blender from durik's edit (which is what i'm working off)

Edited by notameowcelot
Link to comment
Share on other sites

  • Engineer

I tried:

    for x in range(vnum):
        bs.read('16B')
        uvbuffer = bs.read(4)
        vtbuf = rapi.dataToFloatList(uvbuffer, 2, noesis.RPGEODATA_USHORT, NOE_LITTLEENDIAN)
        bs.read('12B')

This skips first 16 bytes and read next 4 bytes which are UV's and skips another 12 bytes to match stride 32 bytes.

But can't transfer it to the rapi.rpgBindUV1Buffer.

I also tried but with no luck.

{"rpgBindUserDataBuffer", RPGBindUserDataBuffer, METH_VARARGS, "binds user data buffer. (sOii|i)"}, //args=name, data bytes, element size, stride (may be 0 to specify per-instance instead of per-vertex), (optional) offset

Not sure if i must also loop rapi.rpgBindUV1Buffer.

Problem is that uv are converted to float and rapi.rpgBindUV1Buffer function requires specified data type to work and refuse use of vtbuf.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...