PokeMiners / pogo_assets

Repository of all mined assets including sprites, news items, sound files, translations, and 3D Assets for Pokemon GO.
417 stars 117 forks source link

3D Model #4

Closed gonka26 closed 4 years ago

gonka26 commented 4 years ago

Hi, when i open pokemon 3d model the eyes never work. i use blender. What you recommend? Thanks

cemtufekci commented 4 years ago

https://blender.stackexchange.com/questions/161553/pokemon-texture-model

gonka26 commented 4 years ago

Thanks for quick answer.

I did what is on the link but don't work. And i think isnt the same issue. I have only one material.

imagem imagem

marty0678 commented 4 years ago

I'll be honest, I'm not sure haha. We don't really know much about 3D graphics and we just add to this repo what we mine. Personally I tried for a bit tonight to figure it out but I didn't have much luck. But only having touched Blender for the first time tonight, I'm not surprised haha.

If we figure anything out we'll let you know (or if you figure anything out please let us know too haha).

rllyy97 commented 4 years ago

I tried to figure this out a few months ago and I think I figured out what was happening.

If you look at the UV maps the eye mapping is actually off the edge of the base texture, and the .fbx is tiling the base texture to include it. I think in the actual game they do something to put the base texture and the eye texture next to each other so that the eye mapping is in the correct spot on the eye texture, then when they need to change the eye image on-model in game, they just move the mapping around the same eye texture (if that makes sense).

As far as making the models have correct eyes, even just one static eye texture, I think Blender only allows one texture per mesh, so to fix each model you would have to separate each eye sub-mesh from the base mesh, then retexture it. It seems doable, but just a lot of effort if you want to do each one.

Disclaimer --- I would advise you not to modify any of the files for copyright reasons

gonka26 commented 4 years ago

I'll be honest, I'm not sure haha. We don't really know much about 3D graphics and we just add to this repo what we mine. Personally I tried for a bit tonight to figure it out but I didn't have much luck. But only having touched Blender for the first time tonight, I'm not surprised haha.

If we figure anything out we'll let you know (or if you figure anything out please let us know too haha).

Thanks and if i know i will tell you ;)

gonka26 commented 4 years ago

I tried to figure this out a few months ago and I think I figured out what was happening.

If you look at the UV maps the eye mapping is actually off the edge of the base texture, and the .fbx is tiling the base texture to include it. I think in the actual game they do something to put the base texture and the eye texture next to each other so that the eye mapping is in the correct spot on the eye texture, then when they need to change the eye image on-model in game, they just move the mapping around the same eye texture (if that makes sense).

As far as making the models have correct eyes, even just one static eye texture, I think Blender only allows one texture per mesh, so to fix each model you would have to separate each eye sub-mesh from the base mesh, then retexture it. It seems doable, but just a lot of effort if you want to do each one.

Disclaimer --- I would advise you not to modify any of the files for copyright reasons

Thanks, you know another app? Because I try on unity and its the same.

marty0678 commented 4 years ago

I've also tried the Windows 3D Builder and Paint 3D and both do the same.

cchara11 commented 3 years ago

@gonka26 Did you find any way to fix the eyes? I am struggling to do so. Any luck with Unity?

gonka26 commented 3 years ago

Sorry but no 😞

marty0678 commented 3 years ago

Unity magic. :P

cchara11 commented 3 years ago

@marty0678 do u have a sample scene with one pokemon? I tried to create the materials but failed miserably. Also it seems that the poke is not on t-pose. is this something that is fixed when you play the scene?

marty0678 commented 3 years ago

Whenever I look at stuff, I just import the FBX into Blender and then apply the texture to the model. It's quick for my purposes so I never save any of that as it's easy to re-create.

cchara11 commented 3 years ago

I am not really familiar with Blender. Any step-by-step guide to at least view the model with the eyes in blender (render mode) ?

marty0678 commented 3 years ago

I don't know how to get the eyes working in Blender, but the Blender YouTube page has some good introduction tutorials.

buu342 commented 3 years ago

Has anyone attempted to import the models in 3DS Max? The FBX model format is proprietary, created by Autodesk, and the only reason that Blender's got an FBX importer is because the format was reverse engineered back in 2013. It very well might be that there's a bug with Blender's importer which is causing the eyes to get messed up.

marty0678 commented 3 years ago

It also messes up with the Windows 3D Viewer too so not sure if it's specific to Blender.

buu342 commented 3 years ago

As explained by @rllyy97, the eye textures' UVs are outside the main UV map, and they work by overlaying them on top of the original mesh (this is very likely done through a shader in Unity). You can apply the eye texture on top of the original model and you'll see they end up in the right position.

The easiest solution to this is to duplicate the original model, and apply the base texture to one and the eyes to the other, you can then trim out the parts of the model that you don't need manually. You'll probably need to offset this model slightly to prevent Z-fighting.

I'm sure there's other methods to achieve the same result, such as spending 100 years in the node editor.

Edit: Correction, you actually want to replace the sections of the models where the eyes are supposed to be. The eye textures, while transparent, actually contain important color information.

To simplify selecting the correct part of the mesh, you can use a button called Keep UV Selection In Sync. Here's video of me selecting and applying the eye textures to Bulbasaur in Blender 2.79 (I haven't made the jump to 2.8 entirely as I'm still working on porting some plugins): https://www.youtube.com/watch?v=EzCz-bv5YTc

Edit (10/03/2022): Blender 2.8+ video, since this comment seems to have gotten more traction than I was expecting: https://www.youtube.com/watch?v=o744iAu5EMw

cchara11 commented 3 years ago

@buu342 Nice job on the above guide. Just wanted to ask you how you import the object. Do you import the fbx? because doing so it seems that the object is messed up.

buu342 commented 3 years ago

@cchara11 Yeah I import the FBX, and make some very minor adjustments (scaling, positioning, etc...). Nothing fancier than that.

cediwelli commented 3 years ago

@buu342 Hi, sorry to bring this up again but you seem very knowledgeable about this topic. My Partner and I figured out how to apply eye textures to fit our needs but we are now stuck because everytime we try to export the model with its Actions, the filesize jumps into Hyperspace. Do you know a way to achieve a resonable filesize? (We also tried to use our 26mb .blend project-file but we can't get it to have more than one Action after importing to Unity... :( )

buu342 commented 3 years ago

@Cediwelli What model format are you exporting as? Asking because that could have a substantial effect on the filesize. Is there any reason you can't just import the FBX directly into Unity?

cediwelli commented 3 years ago

I am exporting the model (in this particular case Pikachu's model) as FBX. We can't use the original FBX because we havn't found a solution to repairing the eyes directly in Unity so we have to fix them in Blender before importing the model to Unity. We couldn't use(*) other formats because the animations were broken. I am more or less new to 3D things and am myself more of an Engineer so I am doing this mostly to learn about 3D Modelling, Animating etc. while creating my own little "Game" as a side-effect.

I suspect the Animations are the most significant factor when it comes to filesize because enabling the "Reduced Keyframe"(2) option the filesize shrinked from 280mb to 120mb (which is still too much). We also found out that there are two formats of FBX (ASCII/Binary), so I thought that we are missing an option and exported the FBX as ASCII but then I read somewhere that Blender 2.9.1 (which is the Version we use) always exports(3) as Binary.

We are just beyond confused how an 8mb FBX file with tons of Animations suddenly jumps to 280mb after importing and exporting with Blender. I know FBX is an proprietary Format and I already found discussions about the FBX-Exporter having bugs but I hope it's just me being a novice.

Thanks for your reaction, by the way. I appreciate it.

() We found a few Videos but weren't able to reproduce them properly. (2) I am currently not at home so I can't look up the proper name. (*3) Please fact-check me on that.

buu342 commented 3 years ago

@Cediwelli Blender does export them as Binary only (You can confirm this by trying to open the model file in notepad). If I were to take a guess, the mass filesize increase comes from you exporting with "bake animation" enabled. I haven't been able to replicate your issue on my end though (on 2.9.1 as well). Could very well be that Blender is doing something to the models on import, as I noticed a model can take up to 5 minutes to load on my machine (which could be just me, this is an old machine after all).

Regardless, there should be no need for you to fix the models in Blender. From what I've seen, all models have the eye texture coordinates always outside of the normal UV range. I've also noticed that some models import into Blender as pure black, because they have vertex colors. It could be that the vertex colors contain some useful information that the PoGo engine uses, but I haven't had the chance to test out this theory. Might be worth investigating.

I'll give you a quick overview of what you can do to fix the ripped models in Unity directly, and I'll also provide some quick theory just in case.

Every vertex has a UV coordinate, which tell the shader where the vertex is mapped to the texture (U represents the X position and V the Y position in the texture). UV coordinates typically range from 0 to 1 (top left coordinate is 0,1 and bottom right is 1,0), and what happens if the vertex lies outside of this range is dictated by your engine. By default though, the texture should tile (AKA repeat).

The UV coordinates for the eyes seem to always be outside of the 0-1 range on V (from what I've seen, always larger than 1). So all you have to do is to find a way to iterate through all the verticies of the model and to check if their V coordinate falls outside of that range. If it does, you can store it in some data structure of "eye verticies", which you can then feed the eye texture to (or manipulate in whatever other way you see fit).

Alternatively, you can pass two textures to your shader (body and eyes), and then in your vertex shader, you can simply check if that vertex's V coordinate falls outside of the 0-1 V range. If it does, pass a varying value to your fragment shader so that it knows to use the other texture instead.

I'm not a Unity wiz, but if you want to be able to talk to me easier, feel free to reach out on Discord so we're not spamming Marty's poor repo :sweat_smile: Buu342#1427

marty0678 commented 3 years ago

Haha no worries, I find it interesting. I'm learning too. 😂