Hi, i did some tests on N64 and some improvements on libdragon on the past months, i was tempted to post here but the forum was down? Anyway i will show my progress, sorry for my english.
I've focused all my efforts on improving and expanding rdp.c, these are all the features added so far:
- Sprite flip (vertically, horizontally or both)
- Sprite zooming (Scale X, Scale Y, both)
- Virtual center align
- Alpha blending (32 levels on 16bit mode)
- Additive blending (somewhat)
- Intensify / Color Mask and other kind of effects using different color combiners
- 4 and 8bit texture support
- Set other modes options: enable copy / 1cycle, enable tlut, enable bilinear filter (useful for zooming), enable atomic prim, etc
- Bug fixes: RDP textures works now on 32bit mode
- Some other fixes
These features are tested on the following examples (used real hardware or CEN64):
FLIP (Iridion 3D sample)
Replicates a bit the effect of Iridion 3D (GBA) which indeed uses a small portion of the screen, then the tiles are mirrored.
![[IMG]](https://web.archive.org/web/2im_/https://i.imgur.com/yp0zBRb.png)
GBA uses a small area then scrolls, so i had to set 256x240 with black borders.
![[IMG]](https://web.archive.org/web/2im_/https://i.imgur.com/kUmXjpb.png)
Sprites are sets of 172x8 loaded only once on TMEM to be mirrored, it seems it takes a bit to load, they are 480 files and about 1,30MB for the full animation (16bit textures).
The example looks like this:
![[IMG]](https://web.archive.org/web/2im_/https://i.imgur.com/895bgkF.gif)
DOWNLOAD
https://mega.nz/#!NowTCZiR!zjdeRzSzBwgweoAUCFt4y_wRz-L9mxwA_fheN_Z8p1Q
ALIGN
The function brings a virtual center to X/Y coordinates plus support for multiple sprite joins, mirrored sprites are aligned, the scaled textures will attempt to align equally.
Textures on libdragon are 0,0 aligned, left pic, on the center the animation uses custom coords for X/Y axis, the right pic shows the number of rectangles, sometimes they can fit TMEM (32x64) or they are split in parts.
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/Hsez7Uy.gif)
Program example:
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/88bLlV5.gif)
CONTROLS
A - Mirror horizontally
B - Mirror vertically
Z - Delays animation 1 second
L - Stops animation for a while
C up/dowm - Scale Y
Dpad - Joysticks - Moves the reference pointer
DOWNLOAD
https://mega.nz/#!s0ATnZga!IdDcgNhDe8j1V2gM02LwLf3GJOo2xauhOFXlAFuXN_A
ALPHA BLENDING TEST
Small test that shows 32 levels of transparency in 1cycle mode (16bit mode / RDP).
![[IMG]](https://web.archive.org/web/2im_/https://i.imgur.com/WtJdl2K.png)
CONTROLS
A - Flip Sprite
Z - Enable/Disable Additive blending
L/R - Alpha control
Joy - Scroll
C buttons - X / Y Scale (zoom)
DOWNLOAD
https://mega.nz/#!g4ZlELCY!1Wbgx4wzpJalM798Ck0zXLHRK2Q6qNmYzyY9zFcOHvY
PALETTE EDITOR (4bit texture)
Uses a 4bit sprite (1cycle, 2x scaled), you can pick a color from the table (get pixel from the framebuffer) and replace any palette color.
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/QV1Pe3a.png)
By pressing L starts an automatic palette rotation, you can stop it at any time with R.
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/f7vCczU.gif)
CONTROLS
Joystick - Mouse
A - Pick color
L/R - Start/Stop palette rotation
Z - Reverse changes (only 1 slot)
Start - Default palette
DOWNLOAD
https://mega.nz/#!l4JFxIiB!jTS5TAQl8-0b5008yk7QQ392qOlYw0cbAK0QbAGOKSw
INTENSIFY
RGB from 0 (normal) to 255 (white), can do this:
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/o9qs6Pn.gif)
COLOR MASK
Shows the sprite silouette in 1 RGB color, can do this kind of effects:
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/HhtzC1G.gif)
OTHER SPECIAL EFFECTS
Besides RDP functions i have added some maths to allow different visual effects (fget_angle, fget_dist, get_distx, get_disty).
Since i don't have yet raster effects (buffer) i had to use giant horizontally textures (256x4), so i can move the blocks separately.
![[IMG]](https://web.archive.org/web/2im_/https://i.imgur.com/MXDZigM.gif)
- Libdragon won't allow textures beyond 256 wide, they are repeated at this point or mirrored depending on the settings.
The effect is generated in real time (instead of tables) and can be edited:
C left / C right = wave
C up / C down = radius
A / B = Speed
R = hide text
A better gif (graphics sample from Last Blade 2):
![[IMG]](https://web.archive.org/web/2im_/https://i.imgur.com/UreFOYJ.gif)
DOWNLOAD
https://mega.nz/#!UpIBkJBb!TqZc9F3V8lZSpkxQoYp_T_QbyrhSNQcu29zsYVEpews
CASTLEVANIA: SOTN OST
The whole soundtrack converted into ogg 44KHz/Stereo/128kbps using libogg, 34 songs, fits on a 64MB cartridge, plays from start to end, can skip songs with c button.
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/wMRIbZj.png)
It slowdowns 25fps to sync with the audio (audio needs improvements), but since its static background there is no problem at all, colors of the background are specifically selected to minimize audio buzz on bad AV cables.
DOWNLOAD
https://mega.nz/#!k9hGEDqS!CR53Lh-wb07-2wiS-OLQgR1s_XtrRQzIAnxmr7k5kgE
RANDOM SNOW
RDP rectangles (non textured) of 4x4 with blue color, the random function was replaced by a new one since it was not working properly.
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/XYee0nh.gif)
Performance:
5600 rectangles at 60fps
7120 rectangles at 50fps
*Performance based on libdragon, not the system itfself.
DOWNLOAD
https://mega.nz/#!R9YEwBSD!_7jzjJd0UXLLDIgvKNxVt0pwtKhSdyJ46QhFRMG7EWA
TILEMAP / SCROLL
I made a scroll engine for N64, the performance is very dependant on the size of the texture and how many times is reloaded, besides all the basic functionality have 2 optimizations.
Discard areas
This map have 6 scroll layers, but mostly covered by the main layer:
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/0kDgDiR.gif)
Performance (same spot area):
- 90fps (main scroll - 16x16 tiles)
- 116fps (64x32 tiles)
Each tile checks a binary list to discard covered tiles..
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/Btox6eJ.gif)
Performance:
- 159fps (main scroll - 32x32 tiles)
- 178fps (64x32 tiles)
*These tests are currently old, the performance is higher in all them.
Controls
- Joystick
- Z disables main layer
DOWNLOAD
https://mega.nz/#!t4RSQCpT!gEQYQ_SJGDnqKV7h3TvAtZJybtj6mz_zEWrDE8DRDJQ
Texture sort
Drawing scroll in texture order with a display list, uses qsort for ordering.
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/QoMfu4Z.gif)
Test:
- 104fps (16x16 tiles)
- 169fps (with texture order)
DOWNLOAD
https://mega.nz/#!R9R2RAQC!vLy-XwgGz6lR2irvO7twmrgMxHaSw4zGinRSJCzG2y0
32BIT TEST
Textures on this mode had to be set to 1cycle to be displayed with the RDP or system crashes (they worked on software render on libdragon examples, but thats pretty slow).
32bit mode supports textures of 4,8,16 and 32bits.
16bit mode supports textures of 4,8,16 and 32bits too (they are converted on the fly)
This is a screen build with 32bit textures of 16x16 32bit mode in cen64.
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/aGnkmiY.png)
16bit mode with 32bit textures, the colors are lowered as you can see banding on the sky.
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/fvTysMQ.png)
The test uses 320x240 scroll to display that screen.
DOWNLOAD
https://mega.nz/#!w1IFWD4A!k4F3BoVzp1vQ-69SQ4Tfti1E5MTEotgGTYDrw-acxPM
--
I may upload the changes i did on libdragon once i fixed few bugs, to name some:
- Triple buffer is not working, you get full speed instead of sync video
- AA disabled causes glitches at 60hz (PAL seems fine)
- Fix loading speed, load 1200 tiles/files of 512bytes = 47 seconds
- 4, 8 textures can't use full 2KB of TMEM (this is top priority)
- Palette colors are sent in a different way, to upload 16 colors you have to send 64 instead (4 times more)
I've focused all my efforts on improving and expanding rdp.c, these are all the features added so far:
- Sprite flip (vertically, horizontally or both)
- Sprite zooming (Scale X, Scale Y, both)
- Virtual center align
- Alpha blending (32 levels on 16bit mode)
- Additive blending (somewhat)
- Intensify / Color Mask and other kind of effects using different color combiners
- 4 and 8bit texture support
- Set other modes options: enable copy / 1cycle, enable tlut, enable bilinear filter (useful for zooming), enable atomic prim, etc
- Bug fixes: RDP textures works now on 32bit mode
- Some other fixes
These features are tested on the following examples (used real hardware or CEN64):
FLIP (Iridion 3D sample)
Replicates a bit the effect of Iridion 3D (GBA) which indeed uses a small portion of the screen, then the tiles are mirrored.
![[IMG]](https://web.archive.org/web/2im_/https://i.imgur.com/yp0zBRb.png)
GBA uses a small area then scrolls, so i had to set 256x240 with black borders.
![[IMG]](https://web.archive.org/web/2im_/https://i.imgur.com/kUmXjpb.png)
Sprites are sets of 172x8 loaded only once on TMEM to be mirrored, it seems it takes a bit to load, they are 480 files and about 1,30MB for the full animation (16bit textures).
The example looks like this:
![[IMG]](https://web.archive.org/web/2im_/https://i.imgur.com/895bgkF.gif)
DOWNLOAD
https://mega.nz/#!NowTCZiR!zjdeRzSzBwgweoAUCFt4y_wRz-L9mxwA_fheN_Z8p1Q
ALIGN
The function brings a virtual center to X/Y coordinates plus support for multiple sprite joins, mirrored sprites are aligned, the scaled textures will attempt to align equally.
Textures on libdragon are 0,0 aligned, left pic, on the center the animation uses custom coords for X/Y axis, the right pic shows the number of rectangles, sometimes they can fit TMEM (32x64) or they are split in parts.
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/Hsez7Uy.gif)
Program example:
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/88bLlV5.gif)
CONTROLS
A - Mirror horizontally
B - Mirror vertically
Z - Delays animation 1 second
L - Stops animation for a while
C up/dowm - Scale Y
Dpad - Joysticks - Moves the reference pointer
DOWNLOAD
https://mega.nz/#!s0ATnZga!IdDcgNhDe8j1V2gM02LwLf3GJOo2xauhOFXlAFuXN_A
ALPHA BLENDING TEST
Small test that shows 32 levels of transparency in 1cycle mode (16bit mode / RDP).
![[IMG]](https://web.archive.org/web/2im_/https://i.imgur.com/WtJdl2K.png)
CONTROLS
A - Flip Sprite
Z - Enable/Disable Additive blending
L/R - Alpha control
Joy - Scroll
C buttons - X / Y Scale (zoom)
DOWNLOAD
https://mega.nz/#!g4ZlELCY!1Wbgx4wzpJalM798Ck0zXLHRK2Q6qNmYzyY9zFcOHvY
PALETTE EDITOR (4bit texture)
Uses a 4bit sprite (1cycle, 2x scaled), you can pick a color from the table (get pixel from the framebuffer) and replace any palette color.
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/QV1Pe3a.png)
By pressing L starts an automatic palette rotation, you can stop it at any time with R.
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/f7vCczU.gif)
CONTROLS
Joystick - Mouse
A - Pick color
L/R - Start/Stop palette rotation
Z - Reverse changes (only 1 slot)
Start - Default palette
DOWNLOAD
https://mega.nz/#!l4JFxIiB!jTS5TAQl8-0b5008yk7QQ392qOlYw0cbAK0QbAGOKSw
INTENSIFY
RGB from 0 (normal) to 255 (white), can do this:
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/o9qs6Pn.gif)
COLOR MASK
Shows the sprite silouette in 1 RGB color, can do this kind of effects:
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/HhtzC1G.gif)
OTHER SPECIAL EFFECTS
Besides RDP functions i have added some maths to allow different visual effects (fget_angle, fget_dist, get_distx, get_disty).
Since i don't have yet raster effects (buffer) i had to use giant horizontally textures (256x4), so i can move the blocks separately.
![[IMG]](https://web.archive.org/web/2im_/https://i.imgur.com/MXDZigM.gif)
- Libdragon won't allow textures beyond 256 wide, they are repeated at this point or mirrored depending on the settings.
The effect is generated in real time (instead of tables) and can be edited:
C left / C right = wave
C up / C down = radius
A / B = Speed
R = hide text
A better gif (graphics sample from Last Blade 2):
![[IMG]](https://web.archive.org/web/2im_/https://i.imgur.com/UreFOYJ.gif)
DOWNLOAD
https://mega.nz/#!UpIBkJBb!TqZc9F3V8lZSpkxQoYp_T_QbyrhSNQcu29zsYVEpews
CASTLEVANIA: SOTN OST
The whole soundtrack converted into ogg 44KHz/Stereo/128kbps using libogg, 34 songs, fits on a 64MB cartridge, plays from start to end, can skip songs with c button.
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/wMRIbZj.png)
It slowdowns 25fps to sync with the audio (audio needs improvements), but since its static background there is no problem at all, colors of the background are specifically selected to minimize audio buzz on bad AV cables.
DOWNLOAD
https://mega.nz/#!k9hGEDqS!CR53Lh-wb07-2wiS-OLQgR1s_XtrRQzIAnxmr7k5kgE
RANDOM SNOW
RDP rectangles (non textured) of 4x4 with blue color, the random function was replaced by a new one since it was not working properly.
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/XYee0nh.gif)
Performance:
5600 rectangles at 60fps
7120 rectangles at 50fps
*Performance based on libdragon, not the system itfself.
DOWNLOAD
https://mega.nz/#!R9YEwBSD!_7jzjJd0UXLLDIgvKNxVt0pwtKhSdyJ46QhFRMG7EWA
TILEMAP / SCROLL
I made a scroll engine for N64, the performance is very dependant on the size of the texture and how many times is reloaded, besides all the basic functionality have 2 optimizations.
Discard areas
This map have 6 scroll layers, but mostly covered by the main layer:
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/0kDgDiR.gif)
Performance (same spot area):
- 90fps (main scroll - 16x16 tiles)
- 116fps (64x32 tiles)
Each tile checks a binary list to discard covered tiles..
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/Btox6eJ.gif)
Performance:
- 159fps (main scroll - 32x32 tiles)
- 178fps (64x32 tiles)
*These tests are currently old, the performance is higher in all them.
Controls
- Joystick
- Z disables main layer
DOWNLOAD
https://mega.nz/#!t4RSQCpT!gEQYQ_SJGDnqKV7h3TvAtZJybtj6mz_zEWrDE8DRDJQ
Texture sort
Drawing scroll in texture order with a display list, uses qsort for ordering.
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/QoMfu4Z.gif)
Test:
- 104fps (16x16 tiles)
- 169fps (with texture order)
DOWNLOAD
https://mega.nz/#!R9R2RAQC!vLy-XwgGz6lR2irvO7twmrgMxHaSw4zGinRSJCzG2y0
32BIT TEST
Textures on this mode had to be set to 1cycle to be displayed with the RDP or system crashes (they worked on software render on libdragon examples, but thats pretty slow).
32bit mode supports textures of 4,8,16 and 32bits.
16bit mode supports textures of 4,8,16 and 32bits too (they are converted on the fly)
This is a screen build with 32bit textures of 16x16 32bit mode in cen64.
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/aGnkmiY.png)
16bit mode with 32bit textures, the colors are lowered as you can see banding on the sky.
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/fvTysMQ.png)
The test uses 320x240 scroll to display that screen.
DOWNLOAD
https://mega.nz/#!w1IFWD4A!k4F3BoVzp1vQ-69SQ4Tfti1E5MTEotgGTYDrw-acxPM
--
I may upload the changes i did on libdragon once i fixed few bugs, to name some:
- Triple buffer is not working, you get full speed instead of sync video
- AA disabled causes glitches at 60hz (PAL seems fine)
- Fix loading speed, load 1200 tiles/files of 512bytes = 47 seconds
- 4, 8 textures can't use full 2KB of TMEM (this is top priority)
- Palette colors are sent in a different way, to upload 16 colors you have to send 64 instead (4 times more)

![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/9uux3Xy.gif)
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/UBlUo10.png)
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/sy7yJ1c.png)
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/vQGtR8f.png)
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/7JLEr02.png)
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/glNFjQT.png)
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/7pTKqxj.png)
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/7Fp9jJv.png)
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/bzAyL3z.gif)
![[IMG]](https://web.archive.org/web/2im_/http://i.imgur.com/3QyVOni.png)