gonetz / GLideN64

A new generation, open-source graphics plugin for N64 emulators.
Other
770 stars 177 forks source link

homebrew toonshading not working properly. #2644

Closed olivieryuyu closed 2 years ago

olivieryuyu commented 2 years ago

toonshading.zip

image

does not work under pj64 but ok with mupenplus and 1964.

here how it should look like:

image

explanation and source code here

https://github.com/lambertjamesd/n64graphicsdemo

gonetz commented 2 years ago

Hi Olivier!

Thanks for the info about this interesting demo. I checked how it works. Yes, as the author explains, the demo first renders the scene into 8bit color buffer. On the next step, this buffer is used as 8bit CI texture and rendered into the main buffer by texrects. GLideN64 needs special shader to emulate it properly, something similar to fog shader for BAR. Such a shader needs color palette loaded as texture, so it can build the output texel using the input frame buffer texel as the palette index. It can be done, but I'm not sure when I can find time for it.

There is another way though. If we don't need to have this effect in high-res, we can save 8bit buffer to RDRAM and then use it as a regular texture. The plugin already has "copy aux buffer to N64 memory" option, but it does not work here because color buffer considered as an auxiliary one if its size is less then size of the VI buffer. However, 8bit buffer is obviously auxiliary. I made a simple correction, and the demo started to work with "copy aux buffers" enabled, see #2651

gonetz commented 2 years ago

Fixed with "copy aux buffers" enabled.