Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Model Export #107

Open
LukeSchoen opened this issue Mar 22, 2022 · 22 comments
Open

Support Model Export #107

LukeSchoen opened this issue Mar 22, 2022 · 22 comments
Labels

Comments

@LukeSchoen
Copy link

Hi,

I'm the poster of this short article:

https://old.reddit.com/r/PlaystationClassic/comments/tjxxpw/today_i_found_out_how_to_rip_3d_models_from_all/

I've been hacking around in the avocado project and ive found a way to reliably export 3D models from any game.

The system ive jerried together dumps raw data from avocado then processes it in my own code base, i would love to discuss implementing the whole process within avocado and adding a simple 'save 3D scene frame as OBJ' button.

Also my current technique needs some texture handing improvement, i would like to process the texture pages into actual output RGB before i do the OBJ export, the idea is to make rhe process as simple as possible.

I really love the code base of avocado and appreciate how things are organised i would like to communicate with the dev/devs and maybe offer and also request help with this feature.

Imo this would make Avocado a very powerful alternative PSX emulator for hackers / devs who want to easily extract 3D game resources.

Nice work guys, look forward to hearing from you

@JaCzekanski
Copy link
Owner

Hey, thanks for reaching out!
We had another attempt of doing 3d dumps made by @rickomax (source is here https://github.com/JaCzekanski/Avocado/tree/feature/3d-screenshot and binaries can be found here: https://avocado-builds.czekanski.info/?branch=feature/3d-screenshot)

I never merged that feature into Avocado due to the massive amount of changes and hacks around the "psx core emulation".
If your solution doesn't heavily modify the core code itself and doesn't impact performance when the feature is not used, then I'll be happy to review the code and merge it into develop.

@vervalkon
Copy link

Please consider GLTF or DAE instead of OBJ! OBJ is arguably the easiest to parse but vertex color support is hit or miss.

@R7CrazyCanucks
Copy link

Oh boy! I'm quite excited to see this new 3D Export feature!

@LukeSchoen
Copy link
Author

Hi Jakub,

Thanks for responding!

The 3D screenshot technique in Rikomaxs branch works in a remarkably similar way to my technique (he also intercepts the verts passing thru the GTE rtps function) his code is great and has excellent support for texture and OBJ export but his 3D verts seems to be slightly confused: https://imgur.com/a/Gs5CUe1

My code is significantly simpler (just touching two files at the moment) but his branch has alot more options (like free camera control etc)

It seems to me that a hybrid of both of our model extraction branches would be the ultimate solution.

For the moment Ill keep developing both branches and ill try to merge them once I have a good handle on their exact implementation differences.

I like all his options but i agree his branch is painful to merge since it adds code everywhere, as for not modifying the core, i don't know if that's going to be possible (given the raw low level nature of the data extraction technique) but I'm sure we can use some c++ coding techniques (#ifdefs, name spaces or something along those lines) to keep the changes minimal and out of the way (performance impact on the unused path should be extremely minimal, but it may not be possible to make it exactly zero without some kind of self modifying code or a similar idea)

Again i really appreciate Avocado it's an awesome project and it makes hacking around in the PS1 super easy! I tried to push some branches this morning but it got stuck / hung on the push command, may i ask is this likely caused by a setting on my end ? or is there a protected group of contributors etc? please let me know the best way to push work for your review, thank you!

@vervalkon Thanks that's an important point! I'll keep that in mind, both DAE and GLTF should be easy enough to add! ill start with OBJ for its read-ability and simplicity but after im sure it all works well (its just textures need more attention right now) then ill include those format options.

@JaCzekanski
Copy link
Owner

@LukeSchoen

For the moment Ill keep developing both branches and ill try to merge them once I have a good handle on their exact implementation differences.
We don't have to do everything in one go, feel free to add the changes gradually. Starting with the export function is a good idea.

I tried to push some branches this morning but it got stuck / hung on the push command, may i ask is this likely caused by a setting on my end ? or is there a protected group of contributors etc? please let me know the best way to push work for your review, thank you!

You have to do it the "Github way" - that is fork the project, push the branch to your fork and open a Pull Request from there.

@paperjack93
Copy link

Following this

@rubixcube6
Copy link

I just had an Idea you might think about adding for the second release. The first release can be base functionality, then add this later, because I'm dying to try this new implementation ASAP lol. I noticed the 3D screenshot feature by rickomax doesn't work when emulation is paused. It seems to run in the same thread (is that the right term?) as the emulation itself and not in it's own sub routine. It would be super useful to have a way to advance frame by frame then 3D screenshot the frame you want while it's paused.

@R7CrazyCanucks
Copy link

@LukeSchoen Could I be able to get my hands on this version of Avocado to test out how good it rips models?

@msmalik681
Copy link

tested the rickomax branch and i did capture the scene just as it was displayed on the game and there was some depth but the 3d and textures were only displaying parts that were visible to the camera. @LukeSchoen will your version also display the hidden parts that the camera will not see ?

front_view

side_view

@alesan99
Copy link

tested the rickomax branch and i did capture the scene just as it was displayed on the game and there was some depth but the 3d and textures were only displaying parts that were visible to the camera. @LukeSchoen will your version also display the hidden parts that the camera will not see ?

@LukeSchoen Could I be able to get my hands on this version of Avocado to test out how good it rips models?

I was informed through reddit that it turns out rickomax's build produces the same results if you use the right settings.

I believe this is what you get with the best settings. Looks like there's no way around manual work but I've come to expect that from ripping.
Capture
Capture2

@ryantrawick
Copy link

@alesan99 What settings are the correct ones? I've been unable to get anything but flat, screen-projected vertices, most of the time textures aren't even saved, seems like it only works once then I have to restart the whole emulator to get another capture.

@alesan99
Copy link

@alesan99 What settings are the correct ones? I've been unable to get anything but flat, screen-projected vertices, most of the time textures aren't even saved, seems like it only works once then I have to restart the whole emulator to get another capture.

He didn't say, but these are what I used.
Capture

I've really only messed around with one game though. You can try asking in the reddit thread linked above to see if the game you're trying doesn't work with the other implementation either .

@LukeSchoen
Copy link
Author

Hey thanks for responding, i gave a detailed step by step on reddit yesterday you might want to check out.

Best luck

@Oreguru
Copy link

Oreguru commented May 18, 2022

Hello everyone. Thanks a lot for highlighting the topic. I noticed that when exporting a texture, the palette is not selected correctly. It may happen that the first part of the polygon is in one palette, and the second part is in another.

@MrTroodonTheOG
Copy link

Is there any way to get the assets on their t-pose?

@LukeSchoen
Copy link
Author

@MrTroodonTheOG Yeah sure is, I've been using mixamo.com.

Basically you upload your model and it will discover the hands / arms / feet / legs / heads etc etc and automatically rig your model (using some kind of machine learning / Mesh Processing AI)

Then you just download your model using any of their built-in animations and load it up in your favourite modeler.

Best part by far is the automatic vertex weighting which in amazingly effective!

The site suggests uploading your model already in a T pose but it actually works with almost anything human-like.

Be sure to post some screenshots if it works out for you, good stuff!

@MrTroodonTheOG
Copy link

Yeah that would be helpful, the main issue is the models aint exactly human like. Been extracting the assets of a couple of Jurassic Park games

@LukeSchoen
Copy link
Author

Ahh! that's an interesting one!

There is probably some advanced automatic technique possible where you give it lots of examples and it estimates the bones.

For now i suggest importing into blender, placing bones manually and posing it back to the default position for that dino.

Best regards, can't wait to see what your making :D

@MrTroodonTheOG
Copy link

Yeah I guess is what I can do, well anyways thanks for the help!

@scurest
Copy link

scurest commented May 12, 2024

I ported a version of the 3d-screenshot feature to DuckStation. You can try it if your game doesn't work with the current feature/3d-screenshot branch. Get it here.

@LukeSchoen
Copy link
Author

I ported a version of the 3d-screenshot feature to DuckStation. You can try it if your game doesn't work with the current feature/3d-screenshot branch. Get it here.

whaaat! 👍 downloading now!...

@LukeSchoen
Copy link
Author

Wow! works amazing! thank you kindly my dude!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests