CoDEmanX / blender-cod

Blender Add-On for Call of Duty® modding
83 stars 26 forks source link

Lambert should be set to Phong on materials in xmodel_export files #12

Closed gmzorz closed 6 years ago

gmzorz commented 6 years ago

once the xmodel_export files are created, phong shading is off by default.. i don't know if lambert does anything, but it's badly shaded without phong

SE2Dev commented 6 years ago

Which game are you checking on?

gmzorz commented 6 years ago

Actually, scrap what i said, i thought it would work but i didn't test it out myself i am having an issue with the shading on xmodels, in cod4

image

what i meant with phong shading ^ you can clearly see the edges, while it's supposed to look shaded had to use a quick example, but this happens on all models i export using blender-cod.

SE2Dev commented 6 years ago

What is the name of that model, and which version of Blender-CoD are you using?

0x8080 commented 6 years ago

@SE2Dev It's a giant M40a1

gmzorz commented 6 years ago

it's just the m40 i had to compile into a mod, replaced me_concrete_barrier real quick, happens with all models i compile, i'm using the latest version from this page. you can see it on this model as well, which is a custom one just anything made with blender shows up with the edges clearly visible image

0x8080 commented 6 years ago

Why is there a PSO on an M40?

CoDEmanX commented 6 years ago

If I understand correctly, smooth shading using vertex normals is desired here? Is the mesh shading set to smooth (on faces) in Blender?

SE2Dev commented 6 years ago

Can you show me a screenshot of the Blender-CoD add-on page in Blender so I know exactly which version you're using?

I need to know if you're using a development version or an older version.

gmzorz commented 6 years ago

yes, all faces are set to smooth here's the one im using image

Here's what it looks like in blender: image

and ingame: image

CoDEmanX commented 6 years ago

Looks like it exports the face normals instead of the vertex normals.

Well, that's the super old version 0.3.5, which is from 2012. It is also the only release available on GitHub.

Please try the latest code from master branch. @SE2Dev or development branch?

CoDEmanX commented 6 years ago

0.3.5 seems to export vertex normals: https://github.com/CoDEmanX/blender-cod/blob/blender_26/io_scene_cod/export_xmodel.py#L536

But since it looks like face normals in-game, there might actually be some problem with Blender. For instance, the vertex normals might require to be updated if to_mesh() is used to triangulate...

gmzorz commented 6 years ago

this is what i get from the master branch, when i try to tick the checkbox in add-ons image

CoDEmanX commented 6 years ago

Did you use Download Zip?

image

That's not going to work. You need to download the repo, extract the content and zip the subfolder io_scene_cod. That newly created archive should install in Blender. Alternatively, you could delete the existing folder io_scene_cod in %appdata%\Blender Foundation\Blender\2.78\scripts\addons and place the new one there.

SE2Dev commented 6 years ago

This should work for the time being. blender-cod_beta.zip

gmzorz commented 6 years ago

image sorry for the late reply, been busy with alot of things, this is what happens when i export as xmodel_export. selected all objects in the scene

SE2Dev commented 6 years ago

I assume your model has a skeleton, materials, uv maps, etc. You should just need to select the model and choose export from the menu. If that doesn't work, try using this version: io_scene_cod_beta2.zip

gmzorz commented 6 years ago

not sure if i'm doing it right.. image

here's the process: https://streamable.com/eawkj

SE2Dev commented 6 years ago

Ah, I see what happened. When I rewrote the export logic, I made it so that it'd look only for models that had skeletons, and forgot to restore the ability to automatically generate the default skeleton for static models. I still need to re-implement this feature.

In the mean time, you should be able to resolve this issue by adding a skeleton with a single bone (called tag_origin) and linking it to the model.

gmzorz commented 6 years ago

that actually makes alot of sense, thanks alot, i'll try it out asap

SE2Dev commented 6 years ago

I'm going to close this issue as it appears to have gotten somewhat off topic, and the original issue appears to have been resolved.