Skip to content

Commit

Permalink
[jak3] fix envmap texture and strength (#3704)
Browse files Browse the repository at this point in the history
Fix the envmap texture using the eye texture by default (will require a
re-extract to fix), fix envmap strength in all three games being off by
2x. (oops)

With envmap scale fix:

![image](https://github.com/user-attachments/assets/3b0ef8b7-cbdc-4402-8a12-af368538c16e)

without envmap scale fix (but with texture fix):

![image](https://github.com/user-attachments/assets/fd72d75b-f0bb-455c-a7c9-56916fbd4a67)

---------

Co-authored-by: water111 <[email protected]>
  • Loading branch information
water111 and water111 authored Oct 5, 2024
1 parent b8c77c6 commit 452f132
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
11 changes: 9 additions & 2 deletions decompiler/level_extractor/extract_merc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -853,12 +853,19 @@ ConvertedMercEffect convert_merc_effect(const MercEffect& input_effect,
u32 tidx = (env >> 8) & 0b1111'1111'1111;
tex_combo = (((u32)tpage) << 16) | tidx;
} break;
case GameVersion::Jak2:
case GameVersion::Jak3: {
case GameVersion::Jak2: {
u32 tpage = 0x1f;
u32 tidx = 2;
tex_combo = (((u32)tpage) << 16) | tidx;
} break;
case GameVersion::Jak3: {
// (define *generic-envmap-texture* (get-texture pal-environment-front environment-generic))
// (defconstant environment-generic 2) tpage
// (def-tex pal-environment-front environment-generic 1) texture
u32 tpage = 2;
u32 tidx = 1;
tex_combo = (((u32)tpage) << 16) | tidx;
} break;
default:
ASSERT_NOT_REACHED();
}
Expand Down
2 changes: 0 additions & 2 deletions game/kernel/jak3/kscheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1085,8 +1085,6 @@ u64 type_typep(Ptr<Type> t1, Ptr<Type> t2) {

u64 method_set(u32 type_, u32 method_id, u32 method) {
Ptr<Type> type(type_);
if (method_id > 255)
printf("[METHOD SET ERROR] tried to set method %d\n", method_id);

auto existing_method = type->get_method(method_id).offset;

Expand Down
3 changes: 2 additions & 1 deletion goal_src/jak2/engine/gfx/foreground/foreground.gc
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,8 @@
)
(cond
((or (nonzero? (-> bucket-info must-use-mercneric-for-clip))
(or (< 0.0 t-amount) (logtest? (-> geo effect effect-idx effect-bits) (effect-bits cross-fade)))
;; force envmap mode, even if strength is zero - PC renderer will handle this case.
(or #|(< 0.0 t-amount)|# #t (logtest? (-> geo effect effect-idx effect-bits) (effect-bits cross-fade)))
)
(let ((a0-33 (&-> tint-info tint))
(v1-74 (the-as object (-> bucket-info effect effect-idx)))
Expand Down
3 changes: 2 additions & 1 deletion goal_src/jak3/engine/gfx/foreground/foreground.gc
Original file line number Diff line number Diff line change
Expand Up @@ -2102,7 +2102,8 @@
)
(cond
((or (nonzero? (-> bucket-info must-use-mercneric-for-clip))
(or (< 0.0 t-amount) (logtest? (-> geo effect effect-idx effect-bits) (effect-bits cross-fade)))
;; force envmap mode, even if strength is zero - PC renderer will handle this case.
(or #t #|(< 0.0 t-amount)|# (logtest? (-> geo effect effect-idx effect-bits) (effect-bits cross-fade)))
)
(let ((a0-33 (&-> tint-info tint))
(v1-74 (the-as object (-> bucket-info effect effect-idx)))
Expand Down

0 comments on commit 452f132

Please sign in to comment.