Skip to content

Tone optimization for Picture ( not with rotation )#3512

Open
MackValentine wants to merge 1 commit intoEasyRPG:masterfrom
MackValentine:optimization_tone_blit
Open

Tone optimization for Picture ( not with rotation )#3512
MackValentine wants to merge 1 commit intoEasyRPG:masterfrom
MackValentine:optimization_tone_blit

Conversation

@MackValentine
Copy link
Copy Markdown
Contributor

Quickfix for tone effect with bigger Pictures.
Instead of changing the color of the entire bitmap, if the sprite is a Sprite_Picture and the bitmap size is larger than the screen, we will render it in a smaller bitmap that will only contain the rendering displayed on the screen, then draw the resulting bitmap in the final sprite.
Should work with zoom, and wave effect, but not with rotation.
This requires calculating safety_w / safety_h according to the deformation related to rotation.

@carstene1ns
Copy link
Copy Markdown
Member

jenkins: ok to test

@BlisterB
Copy link
Copy Markdown
Member

BlisterB commented Jan 4, 2026

Here is a benchmark video of the first town of Aëdemphia, to evaluate the improvement of the commit 0ccd806 :
https://www.youtube.com/watch?v=cvxqvs5oV0w

Summary :

  • Average FPS : 30 to 57.8
  • 1% FPS : 8.6 to 30.4
  • 0.1% : 8.4 to 28.2

@Ghabry
Copy link
Copy Markdown
Member

Ghabry commented Jan 5, 2026

The idea sounds reasonable (havnt looked at the code yet) though imo the only good way to verify the correctness is writing unit tests.

If you don't know how to approach this you can suggest some test cases (especially of edge cases) here and I implement them myself to verify it:

Example (always assuming game has 320x240 window)

  • Input screen_x,screen_y,pic_w,pic_h
  • Output pic_rect_x,pic_rect_y,pic_rect_w,pic_rect_h
  1. 0,0,400,300 -> 0,0,320,240
  2. 100,200,400,300 -> 0,0,220,40
  3. -50,-100,400,300 -> 50,100,350,200

@Ghabry Ghabry added this to the 0.8.2 milestone Mar 17, 2026
@Ghabry
Copy link
Copy Markdown
Member

Ghabry commented Mar 29, 2026

Jenkins: test this please

@BlisterB
Copy link
Copy Markdown
Member

Here is a detailed protocol.

PC:

  • OS : Linux (Fedora KDE)
  • CPU : AMD Ryzen 7 7840U w/ Radeon 780M Graphics
  • 32 Gio of RAM

Tool : MangoHUD

Areas tested:

  • Title screen
  • Erfaran, first town of Aedemphia

Misc :

  • Vsync OFF
  • Frame Limiter 100
  • 16:9 Resolution mode (fake resolution)

Binaries tested:

Results (1%/0.1% are the most important results to check) :

Titlescreen:

  • Continuous build :
GetImage
  • PR3512 :
GetImage(1)
  • Summary: PR3512 feels much smoother despite an inferior AVG (the result from Continuous Build feels wrong), 1%/0.1% are multiplied by 2. PR3512 win, but it's obviously not perfect.

Erfaran:

  • Continuous Build :
GetImage(2)
  • PR3512 :
GetImage(3)
  • Summary: PR3512 feels drasticaly smoother, 1%/0.1% are multiplied by 3. PR3512 wins, not perfect, but playable.

@Ghabry
Copy link
Copy Markdown
Member

Ghabry commented Mar 30, 2026

Oh you are testing on Linux 😅. I thought it's windows.

The Linux build is a debug build (with the exception of flatpak and appimage but we don't do them for pr builds). On the ci only Windows is release.

Appimage: https://ci.easyrpg.org/view/Player/job/player-appimage/

So for testing a release build of the PR you must build it yourself.

Sorry for the inconvenience.


And I will also try mangohud tomorrow. Looks useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

4 participants