Skip to content

Table based warp parameters and new custom warp animations.#6500

Merged
BMagnu merged 23 commits into
scp-fs2open:masterfrom
Gamma39er:gammawarp
Jan 23, 2025
Merged

Table based warp parameters and new custom warp animations.#6500
BMagnu merged 23 commits into
scp-fs2open:masterfrom
Gamma39er:gammawarp

Conversation

@Gamma39er

@Gamma39er Gamma39er commented Jan 1, 2025

Copy link
Copy Markdown
Contributor

Overview

There are two reasons I want to add this feature. First, because the lens flare does not scale with model size and the warp model radius sizing was imprecise. In order to make the warp model radius bigger, the convention was to just make the model bigger in the .pof itself. Additionally the previous code divided by 25 in order to compensate for the larger model radius. Thus scaling the model relative to the ship is a trial and error process. Also, I've made my current effect larger than the effect has been previously, and when I did that I discovered that the lens flare does not scale relative to the warp model. So I wanted to remove any arbitrary scaling factors and allow for a way to make the lens flare proportional.

Secondly, I wanted to customize the animation to be more dynamic and resemble the intro cutscene of Freespace 1. In that cutscene there's variable "ripple speed' and an initial spin that make the subspace vortex opening a lot more dynamic and interesting.

So I've done several things in this PR.

  • I've made it possible to define the warp model to ship ratio and lens flare to ship ratio. The default ratio, as defined in shipfx_calculate_effect_radius() is 1.5. By changing the fireball table values $Warp size ratio: and $Flare size ratio:, it's possible to increase or decrease the ratios as necessary with any animation. These values are multiplied on top of the already existing 1.5 multiplier which allows us to maintain the retail default.
  • If the table option $Cinematic: true is defined, you then define the ratios as +Warp size ratio: and +Flare size ratio: underneath the cinematic option. This is because, with Cinematic turned on, there are different default values than with it off based on my own tweaking of the effect. The Cinematic warp defaults for +Warp size ratio: and +Flare size ratio: is 1.6 and 5.3 respectively.
  • Bobboau's spiking warp flare animation that was associated with the warp flash before is now toggleable with the $Bobboau anim: true table value. This will override the Cinematic option if $Cinematic: true is on.
  • $Cinematic: true also comes with the extra options +Rotation anim: and +Frame anim:. These give direct access to the functions that define the rotation and frame rate of the Cinematic warp animation.
  • +Rotation anim: first two slope values are multiplied against PI so we can define the rotation velocities in terms of radians.

An example -fbl.tbm entry (don't use these rotation values, they're ridiculous):

$Name:	WarpMap02
	+Knossos_Effect	
$LOD:		1
$Warp Glow: WarpGlow02
$Warp Ball: WarpBall02
$Bobboau anim: true
$Cinematic: true
+Warp size ratio: 1.6
+Flare size ratio: 5.3
+Rotation anim: 1.0, 1.0, 3.0
+Frame anim: 1.0, 1.0, 3.0

exp_to_line() explanation

This function starts off as an exponential function and then decreases into a linear function. This allows you to define an initial velocity that then decays into a linear velocity. The parameters of this function are start_slope, end_slope, and scale.

  • start_slope is the initial velocity.
  • end_slope is the linear velocity the function settles on.
  • scale is how long it takes to go from exponential to linear.

Demo Video

Warpmap Demo Video

@wookieejedi wookieejedi added enhancement A new feature or upgrade of an existing feature to add additional functionality. graphics A feature or issue related to graphics (2d and 3d) feature A totally new sort of functionality labels Jan 2, 2025

@MjnMixael MjnMixael left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed a few things with parsing that's not immediately apparent since our parsing system can be a touch confusing.

Comment thread code/fireball/fireballs.cpp Outdated
Comment thread code/fireball/fireballs.cpp Outdated
Comment thread code/fireball/fireballs.cpp Outdated
…enum and default else statements will not override earlier entries.
@Gamma39er

Copy link
Copy Markdown
Contributor Author

I believe I've addressed the suggested changes with this latest commit. Let me know if you think of anything else.

@MjnMixael MjnMixael left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done with the new changes. They revealed just a few more small cleanup things but otherwise the parsing is looking good to me.

Comment thread code/fireball/fireballs.cpp Outdated
Comment thread code/fireball/fireballs.cpp Outdated
@MjnMixael

Copy link
Copy Markdown
Contributor

Parsing looks good to me now. 👍

@BMagnu BMagnu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small changes.
Other than that, there's a bunch of math here.
For the new options, I'll just assume that it's sensible for the visual effect you're going for.
For the classic type, I can't easily validate that the defaults will result in the same visuals as they did before this PR. Is this the case? Or does this PR visually change things for the default tables?

Comment thread code/fireball/fireballs.cpp
Comment thread code/fireball/fireballs.cpp
Comment thread code/fireball/fireballs.cpp
Comment thread code/fireball/fireballs.cpp Outdated
Comment thread code/fireball/fireballs.h Outdated
Comment thread code/fireball/fireballs.h Outdated
@Gamma39er

Copy link
Copy Markdown
Contributor Author

Some small changes. Other than that, there's a bunch of math here. For the new options, I'll just assume that it's sensible for the visual effect you're going for. For the classic type, I can't easily validate that the defaults will result in the same visuals as they did before this PR. Is this the case? Or does this PR visually change things for the default tables?

Took a closer look, but I actually need to change the default flare size ratio to be 1.0f in order for it to match retail exactly when using classic.

All of these changes will change the size of the warp model for older media_vps. The scaling of the warp model was determined by a couple different factors including the radius of the model itself. I could make it to where the cinematic "defaults" that I chose would be required in a -fbl.tbm and the default radius would be what it needs to be for older media_vps when using the the 3d_warp flag? The changes you suggested are great. Thanks for reviewing! I'll get to these in a little while.

@BMagnu

BMagnu commented Jan 21, 2025

Copy link
Copy Markdown
Member

Hmm, that sounds interesting.
Is it feasible to have it, just in the classic default mode, still pull this data from the model?
That way, neither existing mods, nor retail would see a behaviour change, and modern MVPS could easily supply the improved look through the fireball table.
If it's not possible, I would want the defaults to be chosen in a way that retail stays visually identical.

@Gamma39er

Gamma39er commented Jan 21, 2025

Copy link
Copy Markdown
Contributor Author

Hmm, that sounds interesting. Is it feasible to have it, just in the classic default mode, still pull this data from the model? That way, neither existing mods, nor retail would see a behaviour change, and modern MVPS could easily supply the improved look through the fireball table. If it's not possible, I would want the defaults to be chosen in a way that retail stays visually identical.

I suppose I could pull that information from the model, but the radius is also arbitrarily divided by 25.0f in the current code. The radius of the model would be too large without the divisor. So I guess a reasonable default would be, if the 3d_warp is used and we want classic mode, divide the radius by 25.0f unless the table overrides the warp_size_ratio parameter?

@BMagnu

BMagnu commented Jan 21, 2025

Copy link
Copy Markdown
Member

Yeah, pretty much.
Maybe something like just default warp_size_ratio to 1/25.
But yeah, it'd be great if the default settings would behave as they did before, in most to all cases

@Gamma39er

Copy link
Copy Markdown
Contributor Author

This latest commit should preserve older mediavps. I pulled out my new table and my new warp.pof and it reverted back to the settings it had previously. But, any effect that takes advantage of the new "warp styles" should be aware that the warp.pof model needs to be normalized to a radius of 1.

@BMagnu BMagnu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, seems good.
I'll assume this is well tested both for existing MVPS / retail and your new use case based on your comment.

@BMagnu BMagnu merged commit ab00484 into scp-fs2open:master Jan 23, 2025
Goober5000 added a commit to Goober5000/fs2open.github.com that referenced this pull request Sep 4, 2025
Small and subtle fix: move the CINEMATIC options inside the preceding if() block in the same way that the flare style options are inside their preceding if() block.  This prevents the CINEMATIC options from being reset to their default values in subsequent modular table parsing.  Followup to scp-fs2open#6500.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement A new feature or upgrade of an existing feature to add additional functionality. feature A totally new sort of functionality graphics A feature or issue related to graphics (2d and 3d)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants