Red-Studio-Ragnarok / Fancier-Block-Particles

Turn boring particles into fancier particles!
https://www.curseforge.com/minecraft/mc-mods/fbp
GNU General Public License v3.0
10 stars 4 forks source link

Add renderer specifically designed for fast cube rendering #19

Closed Meldexun closed 1 year ago

Meldexun commented 1 year ago

This PR completely overhauls the particle rendering system. The biggest changes are that all particles are now batched and that the vertex data uploading has been drastically improved. Though the mod now includes MatrixUtil (which does not make use of any Minecraft code anymore).

Desoroxxx commented 1 year ago

After quickly testing your changes, the particles are not being properly lit. They appear way brighter than they should

Meldexun commented 1 year ago

I didn't notice that during my testing but I can retest and maybe also make some screenshots tomorrow.

Desoroxxx commented 1 year ago

Nice the main difference between your machine and mine might be AMD/NVIDIA and if that is the case it is gonna be a nightmare

Meldexun commented 1 year ago

I fixed the issue now. The problem was that I didn't notice that digging and snow particles are also rendered with item lighting enabled.

Desoroxxx commented 1 year ago

Okay so after testing I found another problem.

Snow is not touching the ground and moving in an erratic way they "blink" and move weirdly. And when they approach the ground, they disappear quickly. Also, they are missing textures.

Also, this is a problem that is here since 0.7 with the batching system, but now might be the rightest time to fix it with this revamp:

Particles ignore water: image

That is will all particles digging, rain, block, fire etc... They are darker only because technically they are under/in a "block"

So if you could fix the first issue everything seems good, fixing the second issue would be a lifesaver and fix one of the most prominent issue with both the old and your new rendering system.

Meldexun commented 1 year ago

That snow particles are vanishing too early and moving weirdly actually isn't a problem of this PR. This line changes the rotStep vector which results in the vector to become something like (-infinity, infinity, infinity) after a few ticks. https://github.com/Red-Studio-Ragnarok/Fancier-Block-Particles/blob/0.8-Refractor-%26-Cleanup/src/main/java/io/redstudioragnarok/FBP/particle/FBPParticleSnow.java#L97-L98 In the original FBP the rotStep vector is not changed and instead the multiply method created a new vector instance.

I also noticed that the restOnFloor setting was removed but the code for it is now always active even if the particle is not on the ground (at least for snow particles): https://github.com/Red-Studio-Ragnarok/Fancier-Block-Particles/blob/0.8-Refractor-%26-Cleanup/src/main/java/io/redstudioragnarok/FBP/particle/FBPParticleSnow.java#L144-L145

The snow particle texture looks alright for me: 2023-01-25_16 53 54

Particles being visible through translucent blocks is caused by particles being rendered after the translucent block render pass. This could be fixed with a simple ASM or Mixin but I don't know if you want to make use of coremodding and if you prefer ASM or Mixin.

Desoroxxx commented 1 year ago

When talking about snow particles I was talking about the snow weather, which in the 0.8 branch works perfectly fine but in this pr they are broken.

As for ASM or Mixin, I think mixin might be better even if performant is not as good, in this case performance is already excellent, so the added flexibility is better.

Meldexun commented 1 year ago

Yes I was also talking about the snow weather particle. Have you debugged the lines that I mentioned in my last comment? The 0.8 branch just happens to not break when receiving infinity or NaN as rotation.

The biggest problem with ASM/Mixin is the setup. First of all I don't know how to setup ASM/Mixin with ForgeGradle 2.3 (I'm always using ForgeGradle 5.1). And afaik using Mixin requires you to either depend on MixinBooter/MixinBootstrap or include Mixin in your mod.

Desoroxxx commented 1 year ago

So, I am not sure I understand what could cause the vector to become infinite, but I will investigate that.

As for ASM/Mixin I would prefer MixinBooter.

The setup in this readme should work on FG2.3 https://github.com/LoliKingdom/MixinBooter

And as an example, CensoredASM uses MixinBooter https://github.com/LoliKingdom/LoliASM/blob/master/build.gradle

Desoroxxx commented 1 year ago

The snow particles are now fixed in 41216eeaf5121d643945761e7a3f949e72af76c8

Meldexun commented 1 year ago

I rebased the PR and I also added a mixin to fix particles being rendered after translucent things like blocks and entities.

Desoroxxx commented 1 year ago

Okay so, I have fixed the problems with Mixin while staying on FG 2.3.

After testing everything is working perfectly.

I will merge this once I finish rewriting the config system.

Desoroxxx commented 1 year ago

Just verified, and as a nice bonus this pr also fix #11