niacdoial / blemd

BMD importer for blender (BDL format also partially supported)
GNU General Public License v3.0
32 stars 12 forks source link

Matcaps don't work #56

Open edbefee3-3888-462a-9411-741b7e9eb54e opened 2 years ago

edbefee3-3888-462a-9411-741b7e9eb54e commented 2 years ago

They are straight up ignored when not checking "Use complete materials", and just use Normal Texture coordinates with TexCoordMatrix1 when it is.

niacdoial commented 2 years ago

matcaps? As in, Blender's matcap lighting? or something from the bmd files ? I have to admit, it's been a while since I looked into what the materials contained, precisely.

edbefee3-3888-462a-9411-741b7e9eb54e commented 2 years ago

Some meshes (eg. bombhei.bdl from SMG/SMG2) use matcaps as part of their texturing, and the matcap texcoords are not implemented correctly, as they don't even use the camera information

niacdoial commented 2 years ago

…you mean normal vectors / normal maps? the thing that's used to know how which way a surface is pointing at?

edbefee3-3888-462a-9411-741b7e9eb54e commented 2 years ago

i mean view vectors, matcaps are basically a bunch of math using the mesh's normal vector and the view vector

edbefee3-3888-462a-9411-741b7e9eb54e commented 2 years ago

I'll work on rewriting the material pipeline to incorparate this (and many more changes)

niacdoial commented 2 years ago

er… OK, thank you! one thing to keep in mind is that, when the "complete materials" checkbox isn't checked, you should be able to export the model as an fbx file, then re-import it, and have the materials still work. …something that I admittedly didn't check since I ported the code for blender 2.8x.

edbefee3-3888-462a-9411-741b7e9eb54e commented 2 years ago

Screenshot_20220320_205333 It's possible to make it extremely close to ingame (if not identical)

edbefee3-3888-462a-9411-741b7e9eb54e commented 2 years ago

note how the reflection on the glasses, fingernails, wand and star are

niacdoial commented 2 years ago

er… you should probably ask blender to show you what it looks like when rendered with Cycles, because there are small things that are rendered incorrectly otherwise. Like, I know it's the case with some transparency things, but I'm not sure where else it could pop up

edbefee3-3888-462a-9411-741b7e9eb54e commented 2 years ago

that's in blender, and it doesn't use eevee-only stuff

edbefee3-3888-462a-9411-741b7e9eb54e commented 2 years ago

it does indeed render quite well in cycles