Commit Graph

12 Commits

Author SHA1 Message Date
Hat Kid c476b84182
custom models: option to copy mod/eye draws from original model (#3800)
Two new flags were added to the Blender plugin to allow reusing the mod
and/or eye draws of the original model that is being replaced. Works
pretty well for eyes, but the blerc draws can cause some Z-fighting with
the non-moving parts of the model.

Also a small refactor to the merc replacement code to de-duplicate some
code by moving stuff to `gltf_util.cpp`.
2024-12-09 20:49:56 +01:00
Hat Kid 477cefb6a5
model replacements: prevent duplicate processing (#3789)
Store a small database of which models have already been swapped out in
a level to prevent duplicate processing.

Also a small fix for cases where using a model replacement that has no
armature would cause merc nightmares due to only having a `max_bones` of
3.
2024-12-01 22:01:50 +01:00
Hat Kid 620168c45a
custom models: ignore invalid envmap material (#3785)
If a model has a material with specular properties, but is missing a
roughness texture, warn and treat it as a normal draw instead of
erroring out.
2024-11-29 09:27:46 +01:00
Hat Kid ef719d2ab7
custom models: better error for invalid envmap material (#3784)
When a material in Blender has its IOR level changed to anything other
than the default value of 0.5, the `KHR_materials_specular` extension is
applied during the glTF export, which is what we use to check for
envmaps in custom models. If an envmap is undesired, but the IOR value
was accidentally changed, the program would assert during model
processing if there is no metallic roughness texture attached to the
material.

Since this is an easy mistake to make and is hard to spot, this adds a
better error message for such cases.
2024-11-27 19:14:23 +01:00
Hat Kid f6c55eba9f
custom models: increase default joint count (#3782) 2024-11-27 04:21:33 +01:00
Hat Kid 6a06291e6e
jak1, jak2: add `get-texture` macro (#3778)
Ports the `get-texture` macro added in Jak 3 to Jak 1 and 2.
2024-11-26 11:29:34 +01:00
Hat Kid c263bc2114
custom models: envmap support (#3777)
Custom models and model replacements now support environment mapping.

Also fixed some cases in Jak 3 where tfrags had missing textures
(defaulting to texture 0 from tpage 0, which in Jak 3 is the default eye
texture) and replaced them with more suitable alternatives.

Fixes #3776 


https://github.com/user-attachments/assets/7c11b0de-b254-40cb-9719-11238dfb3d43


![image](https://github.com/user-attachments/assets/4cc60b55-4965-4cb8-b29d-096560e7b3aa)


![image](https://github.com/user-attachments/assets/cb46d0d1-57d7-482c-b235-15d0e633f62c)
2024-11-23 14:32:55 +01:00
Hat Kid 7543acfb8a
jak3: speedrunner mode (#3761)
Base implementation of the popup menu and speedrunner mode in Jak 3.
Autosplitter is untested because I'm on Linux.

Also a couple of other misc changes:

- Model replacements can now have custom bone weights. Needs the "Use
Custom Bone Weights" property (provided by the OpenGOAL Blender plugin)
enabled in Blender.
- Better error message for lump syntax errors in custom level JSON
files.
2024-11-17 06:45:34 +01:00
water111 fe29eae395
Background improvements for custom levels (#3672)
This only applies to the background for now:

- support for alpha for vertex colors in custom levels
- switch time of day palette generation from octree to k-d tree
- support for alpha masking in custom levels
- support for transparent textures
- support for envmap in custom levels

---------

Co-authored-by: water111 <awaterford1111445@gmail.com>
2024-09-21 11:39:50 -04:00
Will d46e9fb8bb
Use custom normals in model replacement (#3649)
A small change that makes the models look a lot better. 
Will likely cause a crash if imported model has no normal data, but
that's on the user to fix on their model.
2024-09-02 19:27:28 -04:00
water111 f2e7606f1b
[build_actor] Add skeleton and animation support (#3638)
This adds a feature to `build_actor` to support importing skeletons and
animations from .glb files.

Multiple animations are handled and will use the name in the GLB. The
default `viewer` process will end up playing back the first animation.

There are a few limitations:
- You can only have around 100 bones. It is technically possibly to have
slightly more, but certain animations may fail to compress when there
are more than ~100 bones.
- Currently, all animations have 60 keyframes per second. This is a
higher quality than what is normally used. If animation size becomes
problematic, we could make this customizable somehow.
- There is no support for the `align` bone.

---------

Co-authored-by: water111 <awaterford1111445@gmail.com>
2024-08-16 11:25:53 -04:00
Hat Kid edae60d58d
decompiler: support merc model replacements and adding custom actor models to vanilla fr3s (#3597)
This adds support for replacing existing merc models in FR3 files with
custom GLB model files. The replacements go in
`custom_assets/<GAME>/merc_replacements`, similar to texture
replacements. When a `.glb` file with a file name that matches any model
present in an FR3 is detected (e.g. `eichar-lod0` for Jak), all merc
model data is replaced with the given model.

Additionally, models for custom actors can now also be added to vanilla
FR3s. The models for this go in
`custom_assets/<GAME>/models/<LEVEL_NAME>` (e.g.
`custom_assets/jak1/models/jungleb/test-actor-lod0.glb`) and will be
added to the FR3 that has a matching name (exception: to add things to
the common level file, the folder should be named `common` instead of
`GAME`).
For custom levels, these now go in
`custom_assets/<GAME>/models/custom_levels` (previously
`custom_assets/<GAME>/models`).

Another small change: When level ripping is enabled, the resulting model
files will now be stored in game name subfolders inside of `glb_out`.
2024-07-21 01:51:31 +02:00