Important information: this site is currently scheduled to go offline indefinitely by end of the year.

Cyberpunk 2077 Noesis script

Post questions about game models here, or help out others!
lndrx
ultra-n00b
Posts: 4
Joined: Sat Jan 16, 2021 2:39 am
Been thanked: 1 time

Re: Cyberpunk 2077 Noesis script

Post by lndrx »

lndrx wrote: Sat Jan 16, 2021 7:16 pm Ok, I'm not a great programmer, but I kinda sorted what is "wrong". The new version of CP77Tools (v1.0 at this time) doesn't have any buffer files. It cleans everything leaving only the mesh file. Joschka's script 1.2.1 needs these buffer files to work. I'm trying to update the python code to point the original file "as also the buffer file".
I did it and nope. It doesn't work this way.
crypt
ultra-n00b
Posts: 4
Joined: Mon Jan 25, 2021 2:33 am

Re: Cyberpunk 2077 Noesis script

Post by crypt »

Hi, I'm trying to load the .mesh files in noesis and I can't, I extracted the files several times from several versions of cp77 and no problem, but with the noesis scrypt it doesn't work, I can't see the model and when exporting in fbx or obj says file buffer error, I don't understand what can happen, I hope you can advise me, a greeting.
jayaqua
ultra-n00b
Posts: 1
Joined: Wed Jan 20, 2021 7:35 pm

Re: Cyberpunk 2077 Noesis script

Post by jayaqua »

so ripping the models is easy but how do you get textures from the buffer files?
alphaZ
ultra-n00b
Posts: 5
Joined: Thu Feb 06, 2020 9:23 am
Has thanked: 4 times
Been thanked: 10 times

Re: Cyberpunk 2077 Noesis script

Post by alphaZ »

Thank you Joshcka for your amazing work on this. Sorry it took so long for me to post this here, but I have been developing a lot of new features for your plugin. I redubbed this new version "fmt_CP77mesh" to avoid confusion, since "mesh" is such a generic format name.

fmt_CP77mesh.py v1.44
Image

New / updated features:
Textures (Import and Export):
- Preview of .xbm and .mi textures (as extracted by the latest CP77Tools), including files with multiple images inside
- Preview of other textures embedded inside meshes, particle files, and wherever else if you rename the file's extension to ".cp77tex"
- Beta texture export support for encoding images as new .buffer files by exporting as .cp77tex

Model Import:
- Imported models are rotated upright and scaled to a user-set scaling value (default 100x, found at the top of the .py file)
- Corrected bone maps when using a .rig file
- Correctly rotated normals
- Support for .morphtarget meshes (import and export) and export support for static meshes

Model Export:
- Export FBX to .mesh, writing new model data to a new .mesh.buffer file
- Modify only the bone positions in a .mesh by exporting them with the advanced option " -bones". A copy of the picked model will be created using the bone positions from your FBX (no need to rebuild this since no .buffer file is made)
- Modify the bone positions and model data of a .mesh simultaneously by exporting with the advanced option " -meshbones"

About Model Export:
You can create a mesh mod by importing an original .mesh into Noesis and saving it as FBX, editing it in a 3d editor, then loading that FBX back into Noesis and exporting it back to .mesh over the model you originally extracted it from. Mesh editing seems to work well now as of v1.44; most of the issues with crashes and exploding verts have been fixed.

To get your mesh in-game, you need to reconstruct the .mesh file so that your new buffer is packed up and embedded inside it. The latest versions of CP77Tools can do this using the command:

Code: Select all

rebuild -p "MODDED FOLDER PATH" -b -t --keep --unsaferaw 
The following options are available at the top of the .py file and can be changed with a text editor:

Code: Select all

#Mesh options:
meshScale = 100						#scale model to this size
bHighestLODOnly = True   	  		#if put to True, the low poly meshes will be loaded as separate models
bLoadRigFile = False 	       		#if put to True, enables user-selection of a paired rig file with the skeleton hierarchy info
bAutoDetectRig = True				#if put to True, the plugin will search for and load the closest-named .rig file to the mesh filename
bParentToRootIfNoParent = True		#if put to True, unparented bones will be parented to Root
bReadTangents = False				#if put to True, tangents are read from the file and applied to the model
bImportGarmentMesh = False			#if put to True, garment meshes will be imported along with the regular mesh
bImportExportDamageMeshes = True	#if put to True, vehicle damage meshes will be imported along with the regular mesh, and will be exported if they are detected in the fbx
bImportMorphtargets	= False			#if put to True, morphs will be imported with morphtarget files (currently broken)**
bVertexColors	= True				#if put to True, vertex colors will be read and applied to the model on import, and will be written on export
bExportAllBuffers = True			#if put to True, all buffers will be exported when saving meshes or textures, rather than just the ones modified
bConnectRigToRoot = False			#if put to True, rigs will be assembled in such a way that a connection is always made to the Noesis_Root bone
bSplitDoubleSidedMeshes = True		#If put to True, double-sided meshes (such as hair meshes) will be imported as inner and outer parts

bFlipImage = False				#if put to True, images and UVs are flipped upright on imported textures and meshes
bManualDimensions = False			#if put to True, the user can set their own texture resolution on import
bManualCompression = False			#if put to True, the user can set their own texture compression on import	
bReadAsSigned = True #if put to True, textures will be decoded as signed data, making normal maps yellow instead of blue[/code]

If you want to follow the development of this version more closely, you can on the Cyberpunk Modding Discords:

Cyberpunk 2077 Modding:
https://discord.com/invite/2bT93CkA4B

CP77 Modding Community:
https://discord.gg/Epkq79kd96

Recently updated:
-Fixed Noesis splitting some meshes
-Bone hierarchy is automatically from your extracted game files and saved to a text file "CP77ExtractedPath.txt" next to the plugin
-Single-LOD hack is applied when exporting with `bHighestLODOnly`
-Tangent space problems (causing neck seams) are fixed
-Bones are rotated upright in-place and in-world
-Morphs are automatically disabled on morphtarget export
-New advanced options "-cp77optimize" to optimize the mesh on import and "-vf [factory]" to set a morphtarget vertex factory on export
-A Maxscript is included with the plugin for use in remote-controlling Noesis from 3dsmax, for those who have it
-Double-faced hair meshes can now be imported correctly if they are split in two by enabling "bSplitDoubleSidedMeshes". These meshes must have their normals recalculated and their faces unified, but after doing that they will work correctly

Download Here:
https://www.mediafire.com/file/zyutd5se ... 2.zip/file

Old versions:

Code: Select all

https://www.mediafire.com/file/zyutd5se2dphute/fmt_CP77mesh_v1.52.zip/file
https://www.mediafire.com/file/8gpv9grobnu9y93/fmt_CP77mesh_1.5.zip/file
https://www.mediafire.com/file/rikr6retuqophs6/fmt_CP77mesh_1.49.zip/file
http://www.mediafire.com/file/g1t443fj7nfn6tt/fmt_CP77mesh_1.48.zip/file
http://www.mediafire.com/file/kkj9orx9qsucj8o/fmt_CP77mesh_1.47.zip/file
http://www.mediafire.com/file/bouaqa47ywpa9cn/fmt_CP77mesh_1.46.zip/file
http://www.mediafire.com/file/n1a2gy9s3arc3jt/fmt_CP77mesh_1.45.zip/file
https://www.mediafire.com/file/be5a61bpwd34maw/fmt_CP77mesh_1.44.zip/file
https://www.mediafire.com/file/ks3qun82ucvb8gg/fmt_CP77mesh_1.43.zip/file
https://www.mediafire.com/file/8ufh9m9andjsjtm/fmt_CP77mesh_1.42.zip/file
https://www.mediafire.com/file/ycyad5r3baiulod/fmt_CP77mesh_1.41.zip/file
https://www.mediafire.com/file/9hkm3lajxqmu993/fmt_CP77mesh_1.4.zip/file
You do not have the required permissions to view the files attached to this post.
Last edited by alphaZ on Thu Apr 08, 2021 9:52 pm, edited 9 times in total.
JKerman
ultra-n00b
Posts: 5
Joined: Sat Feb 06, 2021 12:02 am

Texture names

Post by JKerman »

When I extract the textures, I get png and dds files named whatever_maskset. Are they for individual RGB channels? How can I tell which are the specular, AO, metallic, etc?
choochoomomdad
ultra-n00b
Posts: 1
Joined: Sun Jan 24, 2021 9:59 am

Re: Cyberpunk 2077 Noesis script

Post by choochoomomdad »

alphaZ wrote: Fri Feb 05, 2021 9:04 pm Thank you Joshcka for your amazing work on this. Sorry it took so long for me to post this here, but I have been developing a lot of new features for your plugin. I redubbed this new version "fmt_CP77mesh" to avoid confusion, since "mesh" is such a generic format name.

fmt_CP77mesh.py v1.43
Image

New / updated features:
Textures (Import and Export):
- Preview of .xbm and .mi textures (as extracted by the latest CP77Tools), including files with multiple images inside
- Preview of other textures embedded inside meshes, particle files, and wherever else if you rename the file's extension to ".cp77tex"
- Beta texture export support for encoding images as new .buffer files by exporting as .cp77tex

Model Import:
- Imported models are rotated upright and scaled to a user-set scaling value (default 100x, found at the top of the .py file)
- Corrected bone maps when using a .rig file
- Correctly rotated normals
- Support for .morphtarget meshes (import and export) and export support for static meshes

Model Export:
- Export FBX to .mesh, writing new model data to a new .mesh.buffer file
- Modify only the bone positions in a .mesh by exporting them with the advanced option " -bones". A copy of the picked model will be created using the bone positions from your FBX (no need to rebuild this since no .buffer file is made)
- Modify the bone positions and model data of a .mesh simultaneously by exporting with the advanced option " -meshbones"

About Model Export:
You can create a mesh mod by importing an original .mesh into Noesis and saving it as FBX, editing it in a 3d editor, then loading that FBX back into Noesis and exporting it back to .mesh over the model you originally extracted it from. Mesh editing is currently pretty finicky, however, and only guns, cars and hair meshes have had much success so far. Clothes and characters will often have issues with exploding faces, so that needs more research.
To get your mesh in-game, you need to reconstruct the .mesh file so that your new buffer is packed up and embedded inside it. The latest versions of CP77Tools can do this using the command:

Code: Select all

rebuild -p "MODDED FOLDER PATH" -b -t --keep --unsaferaw 
The following options are available at the top of the .py file and can be changed with a text editor:

Code: Select all

meshScale = 100					#scale model to this size
bOriginalTransform = False			#if put to true, the mesh will be imported where you can see its original "boneRigMatrices" transforms in a 3D editor (by checking the inverse of any bone's matrix)
bHighestLODOnly = False   	  		#if put to True, the low poly meshes won't be loaded
bLoadRigFile = False 	       		        #if put to True, enables selecting a paired rig file with the skeleton hierarchy info
bLoadSeveralRigFiles = False		        #if put to True, same as above but with several rig files and without validity check
bParentToRootIfNoParent = True		        #if put to True, unparented bones will be parented to Root
bReadTangents = False				#if put to True, tangents are read from the file and applied to the model
bWriteVerts = True				#if put to True, exported meshes will rewrite the entire .buffer file (instead of only rewriting verts within the original .buffer)

bFlipImage = False				#if put to True, images and UVs are flipped upright on imported textures and meshes
bManualDimensions = False			#if put to True, the user can set their own texture resolution on import
bManualCompression = False			#if put to True, the user can set their own texture compression on import	

If you want to follow the development of this version more closely, you can on the Cyberpunk Modding Discords:

Cyberpunk 2077 Modding (my home server):
https://discord.com/invite/2bT93CkA4B

CP77 Modding Community:
https://discord.gg/Epkq79kd96


Download Here:
https://www.mediafire.com/file/ks3qun82 ... 3.zip/file
or
How about error “wrong buffer file”?
truforza
ultra-n00b
Posts: 2
Joined: Thu Feb 04, 2021 10:36 pm
Has thanked: 1 time

Re: Cyberpunk 2077 Noesis script

Post by truforza »

Hi people. I'm hoping someone can help me figure out what I'm missing because I'm stuck with this message for every mesh i try to preview.. and the exports are nonexistent as well

Image

I'm not sure if I missed something while extracting the game data, but I would highly apprecaiate any help. Thanks and my apologies for being a noesis noob
alphaZ
ultra-n00b
Posts: 5
Joined: Thu Feb 06, 2020 9:23 am
Has thanked: 4 times
Been thanked: 10 times

Re: Cyberpunk 2077 Noesis script

Post by alphaZ »

truforza wrote: Wed Feb 10, 2021 10:49 pm Hi people. I'm hoping someone can help me figure out what I'm missing because I'm stuck with this message for every mesh i try to preview.. and the exports are nonexistent as well

Image

I'm not sure if I missed something while extracting the game data, but I would highly apprecaiate any help. Thanks and my apologies for being a noesis noob
This happens because you haven't uncooked the mesh files when you extracted your game archives. There are two ways to extract files with CP77Tools: uncook and unbundle. Unbundle is what you did, and that gives you the mesh files themselves, but the actual mesh data is hidden inside some Oodle-compressed data blocks inside those mesh files. That needs your oo2ext_7_win64.dll file from your game in order to extract ("uncook"), and that's why CP77Tools needs that DLL too.

So in order to preview the meshes, they must be surrounded by their extracted data parts (called ".buffer" files). Noesis will find the uncooked buffer file that contains the model data and load it automatically, if it is in the same folder and with the same name as the .mesh file.

To uncook all mesh files from a game archive, use a command like this:

Code: Select all

uncook -p "D:\GOG\Cyberpunk2077\Cyberpunk 2077\archive\pc\content\basegame_4_gamedata.archive" -w *mesh*
truforza
ultra-n00b
Posts: 2
Joined: Thu Feb 04, 2021 10:36 pm
Has thanked: 1 time

Re: Cyberpunk 2077 Noesis script

Post by truforza »

alphaZ wrote: Fri Feb 12, 2021 2:16 am
This happens because you haven't uncooked the mesh files when you extracted your game archives. There are two ways to extract files with CP77Tools: uncook and unbundle. Unbundle is what you did, and that gives you the mesh files themselves, but the actual mesh data is hidden inside some Oodle-compressed data blocks inside those mesh files. That needs your oo2ext_7_win64.dll file from your game in order to extract ("uncook"), and that's why CP77Tools needs that DLL too.

So in order to preview the meshes, they must be surrounded by their extracted data parts (called ".buffer" files). Noesis will find the uncooked buffer file that contains the model data and load it automatically, if it is in the same folder and with the same name as the .mesh file.

To uncook all mesh files from a game archive, use a command like this:

Code: Select all

uncook -p "D:\GOG\Cyberpunk2077\Cyberpunk 2077\archive\pc\content\basegame_4_gamedata.archive" -w *mesh*
I followed your instructions to re-copy the DLL (just to be sure) and use the 'uncook' command but ended up getting flooded with loads of errors about being unable to read cr2w or something while CP77Tools created 0Kb mesh files for everything. Is this supposed to happen? I still feel like I have missed something very important..

Image


Edit: I managed to unbundle the mesh files after uncooking and gained access to some of the models.. though the majority of them still can't be opened for some reason
Last edited by truforza on Thu Feb 25, 2021 2:09 am, edited 1 time in total.
User avatar
Crazy31139
veteran
Posts: 121
Joined: Fri Dec 02, 2016 5:53 pm
Has thanked: 324 times
Been thanked: 63 times
Contact:

Re: Cyberpunk 2077 Noesis script

Post by Crazy31139 »

Screenshot_1.jpg
When i try open npc clair skirt - l1_003_wa_skirt__clair.mesh
Noesis give me this error
I extract all l1_003_wa_skirt__clair.mesh.0.buffer by l1_003_wa_skirt__clair.mesh.73.buffer
You do not have the required permissions to view the files attached to this post.
Hayte
ultra-n00b
Posts: 2
Joined: Sat Mar 06, 2021 5:20 pm

Re: Cyberpunk 2077 Noesis script

Post by Hayte »

Not sure where to post this to be honest as its not strictly related to Noesis.

I am able to edit game meshes and get them into the game with CP77Tools but ran into an issue when using Blender and Maya's .fbx exporter. For some reason, this happens:

Image
Image

The top screenshot is how the mesh should look in game.

1. In Noesis, export .mesh to .fbx.
2. In Noesis, export .fbx over the existing .mesh.
3. Using CP77 Tools, rebuild the mesh and repack the archive.

You will always get the same results as in the first screenshot.

The bottom screenshot is what happens if you do this:

1. In Noesis, export .mesh to .fbx.
2. Open .fbx in Blender/Maya.
3. In Blender/Maya, export to .fbx.
4. In Noesis, take the Blender/Maya exported .fbx and export over .mesh
5. Using CP77Tools, rebuild the mesh and repack the archive.

No editing in Blender/Maya necessary. For some reason something is lost in the export. The jacket seams are inverted and the creases on the shoulders/arms lack depth. Its like the normals are getting screwed. There are also some shadows under the collar of the jacket which correspond to the topology of the mesh (this is much easier to see in Blender/Maya's viewport with shading).

So I've re-rigged this mesh (to stop the neck bones getting yanked down by the head when it is replaced by the FPP viewport) and fixed some geo to eliminate clipping problems under the armpits. I can get it back into the game with Noesis/CP77Tools no problem. But Blender/Maya's .fbx exporter is kind of ruining it by wrecking the normals (?)

Any insight as to what could be causing this?
devilsnake88
beginner
Posts: 32
Joined: Thu Dec 05, 2013 5:14 pm
Has thanked: 13 times
Been thanked: 20 times

Re: Cyberpunk 2077 Noesis script

Post by devilsnake88 »

Hayte wrote: Sat Mar 06, 2021 5:34 pm ...
Not sure but can't it come from the way the engines interprets normal maps?
Image

Try to invert/flip the green channel of your normal map and see if it works in game
Hayte
ultra-n00b
Posts: 2
Joined: Sat Mar 06, 2021 5:20 pm

Re: Cyberpunk 2077 Noesis script

Post by Hayte »

Yeah, this is exactly the problem. I'm working on it now and I am documenting the process (mistakes and everything).

Edit: Ok, I documented everything here: https://forums.cdprojektred.com/index.p ... .11082448/

But I hit a wall. Flipped X and Y channels does work but I think there is a leather material used that has normals inverted no matter what and I cant uncook basegame_3_nightcity without CP77Tools throwing an unhandled exception. Besides that, screwing with materials to solve a problem that manifests on .fbx export for a single player wearable is a whole can of worms I don't think I can or should open.

I tried to circumvent the problem entirely since the original goal was a rigging job so I would export only the armature using "-bones", but I'm not sure if its working? I could be making another noob error. Or if it is its only certain bone parameters like position that are being written to the .mesh? The mesh I'm trying to export has multiple armatures but it seems Noesis merges them all when exporting over the old .mesh?
lulzx
ultra-n00b
Posts: 1
Joined: Wed Mar 24, 2021 4:55 pm

Re: Cyberpunk 2077 Noesis script

Post by lulzx »

When I tried to uncook the meshes, an error occured(displayed red),saying that a json file cannot be uncooked, would anyone help me plz~~~~~
Image
photojoe
beginner
Posts: 23
Joined: Tue Jan 26, 2016 11:49 pm
Has thanked: 5 times
Been thanked: 1 time

Re: Cyberpunk 2077 Noesis script

Post by photojoe »

Are there any tutorials for extract one's 'V' character from the game?

Also what files for extracting Rig animations do i need to uncook? I know the XBM for textures, Mesh has the MorphTarget, Rig and Mesh itself, but don't know what the MI is (material index?) or other files CP22Tools can extract that I can reassemble.

Also for extracting meshes from the game, any help figuring out where the NPC are, they seem to be in pieces like the Player mesh.
Post Reply