Reverse Model Wireframe

Post questions about game models here, or help out others!
User avatar
Bigchillghost
ultra-veteran
ultra-veteran
Posts: 426
Joined: Tue Jul 05, 2016 9:37 am
Has thanked: 21 times
Been thanked: 269 times

Re: Reverse Model Wireframe

Post by Bigchillghost » Sat Apr 28, 2018 12:07 pm

A local compare on the face:
Image
Last edited by Bigchillghost on Fri Oct 05, 2018 7:04 am, edited 1 time in total.
May you find peace in this puzzle-solving game. Say it with action: click the Image when you get helped.:)

mono24
mega-veteran
mega-veteran
Posts: 296
Joined: Sat Nov 06, 2010 12:27 am
Has thanked: 101 times
Been thanked: 46 times

Re: Reverse Model Wireframe

Post by mono24 » Sun Apr 29, 2018 1:34 am

Bigchillghost wrote:Same usage as the one I posted in that thread at the same page
Thank you for your example tool for that game only, but, it seems they both have same result:
No matter how I run: GSTDQuadifyer.exe it has same result as: GSTDConv.exe
And that is just extraction of rendermesh_0 / rendermesh_1. Nothing else.

User avatar
Bigchillghost
ultra-veteran
ultra-veteran
Posts: 426
Joined: Tue Jul 05, 2016 9:37 am
Has thanked: 21 times
Been thanked: 269 times

Re: Reverse Model Wireframe

Post by Bigchillghost » Sun Apr 29, 2018 2:00 am

mono24 wrote: Thank you for your example tool for that game only
Yeah, I also want to present more.
mono24 wrote: No matter how I run: GSTDQuadifyer.exe it has same result as: GSTDConv.exe
And that is just extraction of rendermesh_0 / rendermesh_1. Nothing else.
What do you mean by "same result"? Did you get the obj files?
Last edited by Bigchillghost on Thu Sep 20, 2018 6:06 am, edited 1 time in total.
May you find peace in this puzzle-solving game. Say it with action: click the Image when you get helped.:)

mono24
mega-veteran
mega-veteran
Posts: 296
Joined: Sat Nov 06, 2010 12:27 am
Has thanked: 101 times
Been thanked: 46 times

Re: Reverse Model Wireframe

Post by mono24 » Sun Apr 29, 2018 5:22 am

Bigchillghost wrote:Did you get the obj files?
That's what they both seem to do identically, that's what I meant, it only export obj files, nothing is quadifyed by the tool, unless I am missing something? Everything is presented in triangles.

User avatar
Bigchillghost
ultra-veteran
ultra-veteran
Posts: 426
Joined: Tue Jul 05, 2016 9:37 am
Has thanked: 21 times
Been thanked: 269 times

Re: Reverse Model Wireframe

Post by Bigchillghost » Sun Apr 29, 2018 6:05 am

mono24 wrote:it only export obj files
Good. Then the tool worked without issues.
mono24 wrote:unless I am missing something? Everything is presented in triangles.
Have you imported the files into 3Ds Max? Or you're using other 3D softwares that doesn't support quads(like Noesis and the 3D Builder for Win10)?

The quadified meshes will be stored in the same obj file as the triangulate ones, but with the "_quadify" suffix. You'll need to filter and separate them from the original game meshes mamually in Max.
May you find peace in this puzzle-solving game. Say it with action: click the Image when you get helped.:)

mono24
mega-veteran
mega-veteran
Posts: 296
Joined: Sat Nov 06, 2010 12:27 am
Has thanked: 101 times
Been thanked: 46 times

Re: Reverse Model Wireframe

Post by mono24 » Mon Apr 30, 2018 2:56 am

Ah, got it now.
Amazing results, I hope you will consider in maybe making a universal 3dsMax Quadify selectable option same way as the built in one.
I've always wanted an accurate option as yours, if I can support this project let me know, I am very serious about it, I hope more can get on board, the results are stunning, period.

Thank you for allowing me to test, much appreciate it.

User avatar
Bigchillghost
ultra-veteran
ultra-veteran
Posts: 426
Joined: Tue Jul 05, 2016 9:37 am
Has thanked: 21 times
Been thanked: 269 times

Re: Reverse Model Wireframe

Post by Bigchillghost » Tue May 01, 2018 4:54 am

mono24 wrote:I hope you will consider in maybe making a universal 3dsMax Quadify selectable option same way as the built in one.
I don't think it will be a practical idea, at least not in a short term, so don't count on me. Yeah the results might look great but don't be deceived. This algorithm relies heavily on an ideal face indices buffer, and the filter rules of determining whether two adjacent triangles should be restructured as a quadrilateral might vary from game to game, or model to model. So usually you need to figure out the proper filter rules for desired medels, and that's why I insist on using it within the extraction process.
mono24 wrote:if I can support this project let me know, I am very serious about it
The discussion on related algorthms are open so be my guest if you're going to develop your own tool.
May you find peace in this puzzle-solving game. Say it with action: click the Image when you get helped.:)

User avatar
Bigchillghost
ultra-veteran
ultra-veteran
Posts: 426
Joined: Tue Jul 05, 2016 9:37 am
Has thanked: 21 times
Been thanked: 269 times

Re: Reverse Model Wireframe

Post by Bigchillghost » Tue May 01, 2018 3:11 pm

A test on a high poly model I downloaded on the web some years ago, don't remember where exactly though:
Image

With 3 filter rules enabled I managed to get a 100% accurate result:
Image
Image
Last edited by Bigchillghost on Sat Feb 23, 2019 2:20 pm, edited 1 time in total.
May you find peace in this puzzle-solving game. Say it with action: click the Image when you get helped.:)

User avatar
Bigchillghost
ultra-veteran
ultra-veteran
Posts: 426
Joined: Tue Jul 05, 2016 9:37 am
Has thanked: 21 times
Been thanked: 269 times

Re: Reverse Model Wireframe

Post by Bigchillghost » Sun May 13, 2018 11:58 am

Alright, time for introducing some main ideas of the algorithm.

To quadify a model, there could be a lot of potential methods, but a natural and simple one would be focusing on the face buffer.
Hence it comes the problem: how to determine which two triangles should form a new quadrangle? For convenience of explanation, let's discuss the problem with the aid of a simple image.

As you can see, in the following image, the triangle ABC (denoted by ΔABC, the same below) is surrounded by another 3 triangles: ΔADB, ΔBFC and ΔACE. The cyclic arrows represent the orientation of each triangle.
Tri4.jpg
Let's assume that ΔABC and ΔACE should form a quadrangle, and they share the same edge AC. So for a given triangle ΔABC, whose face indices would be "a b c",
its adjacent triangle ΔACE's face indices could be "a c e", "c e a", or "e a c".
Therefore we have 3 combinations of the actual face indices for these two triangles:

Code: Select all

|a b c|		or		|a b c|		or		|a b c|
|a c e|		  		|c e a|		  		|e a c|
Say ΔACE's face indices are "a c e" for example, then all you need to do is locate to these two triangles, the combination of who's face indices meets with the form of |a b c|a c e|, and create a new quadrangle by removing the shared edge AC. Taking into account the orientations of both triangles, the indices of the quadrangle would be "a b c e". Actually the indices are the same if ΔACE's face indices are "c e a" or "e a c". These combinations are used only to filter the two trangles ΔABC and ΔACE from the face buffer, and they won't influence the orientation of the quadrangle unless they're not of the same vertex.

But what if ΔABC should form a quadrangle with ΔADB, or ΔBFC? So in total we get 9 combinations, which I call the filter rules:

Code: Select all

|	abc	|	abc	|	abc	|	abc	|	abc	|	abc	|	
|	adb	|	cbd	|	bdc	|	dcb	|	bad	|	cda	|	
-------------------------------------------------------------------------------------------------
|	abc	|	abc	|	abc	|
|	acd	|	dba	|	dac	|
This is based on the conditions that you don't need to modify the face buffer, otherwise some of them can actually be regarded as the same rule, like |abc|adb| and |abc|acd| coz they're symmetric in the horizontal direction.

Luckily the game engines usually use only a few rules listed above to break a quadrangle into two triangles, which usually are stored adjacently.
For example, say there're two quadrangles:

Code: Select all

f 1 2 3 4
f 2 5 6 3
its triangle face indices could be

Code: Select all

f 1 2 3
f 3 4 1
f 2 5 6
f 6 3 2
That's what 3Ds Max usually do when you export to obj as triangles. Recreate the original quadrangles simply by dividing them into groups per two triangles in the order of how they're stored.
If the original model contains also triangles, so long as they're not inserted between the two triangles generated from a quadrangle, usually you can ignore the side effects.

Code: Select all

f 1 2 3
f 3 4 1		-->		f 1 2 3 4
f 1 4 5		-->		f 1 4 5
f 7 5 6
f 6 8 7		-->		f 7 5 6 8
You do not have the required permissions to view the files attached to this post.
Last edited by Bigchillghost on Sat Feb 23, 2019 2:24 pm, edited 4 times in total.
May you find peace in this puzzle-solving game. Say it with action: click the Image when you get helped.:)

User avatar
Bigchillghost
ultra-veteran
ultra-veteran
Posts: 426
Joined: Tue Jul 05, 2016 9:37 am
Has thanked: 21 times
Been thanked: 269 times

Re: Reverse Model Wireframe

Post by Bigchillghost » Sun May 13, 2018 12:52 pm

Things get more complicated when two triangles adjacent in 3D space are not stored adjacently in the face buffer.
But it isn't the dead end as long as the quadrangles are broken into triangles in strict accordance with filter rules. The less rules it uses, the more accurate the results would be, of course.
A good example would be The Witcher 3: Wild Hunt, which uses only 1 filter rule although most of the triangles were not adjacent in the buffer.

Image
Image
Image

However it is not so lucky for Rise of the Tomb Raider, which uses 2 filter rules(for the most common cases). I tried 4 variant methods but still havn't got a satisfied result yet.
ImageImage
ImageImage
ImageImage

Quick compare:
Image
Last edited by Bigchillghost on Sat Feb 23, 2019 2:35 pm, edited 1 time in total.
May you find peace in this puzzle-solving game. Say it with action: click the Image when you get helped.:)

User avatar
Bigchillghost
ultra-veteran
ultra-veteran
Posts: 426
Joined: Tue Jul 05, 2016 9:37 am
Has thanked: 21 times
Been thanked: 269 times

Re: Reverse Model Wireframe

Post by Bigchillghost » Thu May 17, 2018 4:46 pm

Seems I found the ultimate solution :wink: :
Image

Also a screenshot for details of some inner parts:
Image
Last edited by Bigchillghost on Sat Feb 23, 2019 2:37 pm, edited 1 time in total.
May you find peace in this puzzle-solving game. Say it with action: click the Image when you get helped.:)

mono24
mega-veteran
mega-veteran
Posts: 296
Joined: Sat Nov 06, 2010 12:27 am
Has thanked: 101 times
Been thanked: 46 times

Re: Reverse Model Wireframe

Post by mono24 » Fri May 18, 2018 1:19 am

Bigchillghost wrote:Seems I found the ultimate solution :wink:
Your being such a bad tease, I always dreamed of something like this to be done and be takes seriously, now your just making it worse, in a good way obviously.
Hundreds of people that wonder around forums like this are simply clueless as to what developers like yourself are doing, we do not understand, myself included, nor know code/programming/scripting languages etc etc etc, we simply use amazing tools that others, like yourself, are good at it and create for use.
So I hope you have thought about something as to make it work for all of us, if your really serious about it.
For example a scenario would be, you import your desired skinned mesh in 3dsMax, you know with bones/weights and all, and you just quadrangulate it as it was initially created, because from an artistic perspective quads are desired and far superior to triangles, since triangles is only needed in-game by the GPU.

I honestly hope you consider it, I hope more join in to express they're opinion, because this thing your doing is simply fantastic and I personally dream about it for a few years now, since I discovered this world of 3D possibilities.

My honest and humble opinion, thank you.

sfc123
n00b
Posts: 14
Joined: Sun Nov 09, 2014 7:25 pm
Has thanked: 1 time

Re: Reverse Model Wireframe

Post by sfc123 » Tue Jan 08, 2019 7:28 am

well done~~

Post Reply