Mithion / ArsMagica2

Ars Magica 2 Bug Tracker
126 stars 188 forks source link

Projectile earth spells break perspective #1387

Open d-baranowski opened 8 years ago

d-baranowski commented 8 years ago

Hi, great mod ;)

I found a bug. When you shoot a projectile earth spell while looking at water or nether portal block the spell particle (Ball which indicates the projectile), the water will display as if it's closer to player than the spell particle, resulting in a weird visual bug.

Also, (not sure if bug or feature :P) If you have 100% affinity earth levitation spell wont work.

Some screen shots: 2016-01-27_22 03 43 2016-01-27_22 03 44 2016-01-27_22 03 51 2016-01-27_22 03 51_2

I'm playing on Minecraft 1.7.10. Here is a list of mods I'm using: AM2-1.4.0.009 AnimationAPI-1.7.10-1.2.4 Aroma1997Core-1.7.10-1.0.2.13 AromaBackup-1.7.10-0.0.0.5 Baubles-1.7.10-1.0.1.10 BiblioCraft[v1.11.3][MC1.7.10] Botania r1.7-207 ChickenChunks-Mod-1.7.10 CodeChickenCore-1.7.10-1.0.6.43-universal CustomMainMenu-MC1.7.10-1.5 denseores-1.6.2 DynamicLights-1.7.10 EnchantingPlus-1.7.10-3.0.2-d FastLeafDecay-1.7.10-1.0 ForgeMultipart-1.7.10-1.1.2.332-universal HQM-The Journey (4.2.4) INpureCore-[1.7.10]1.0.0B9-62 InventoryTweaks-1.59-dev-152 Jabba-1.2.1a_1.7.10 LittleBlocks-2.2.4.4 MCA-1.7.10-5.1.1.1-universal Morpheus-1.7.10-1.6.4 MusicChoices-1.2_for_1.7.10 neiaddons-1.12.10.33-mc1.7.10 NEIIntegration-MC1.7.10-1.0.11 NotEnoughItems-1.7.10-1.0.4.107-universal NotEnoughResources-1.7.10-0.1.0.101 OptiFine_1.7.10_HD_U_C1 RadixCore-1.7.10-2.1.1-universal ResourceLoader-1.2 roguelike-1.7.10-1.4.4 SlimevoidLibrary-2.0.4.7 ttCore-MC1.7.10-0.1.1-78 Waila-1.5.10_1.7.10 WailaHarvestability-mc1.7.x-1.1.2 Wawla-1.3.1-1.7.10

TheIcyOne commented 8 years ago

Does this still occur without OptiFine installed?

d-baranowski commented 8 years ago

Just checked. Yes it does

jjtParadox commented 8 years ago

This is actually a limitation of the Minecraft engine itself. All particles render behind water, portals, and other certain blocks (Try breaking a block on top of a lake to see this yourself). This could possibly be "fixed" by rendering projectiles in an entirely different manor, but that would require a complete rewrite of the rendering and animation code.

d-baranowski commented 8 years ago

Yes, you're right. This only happens to projectile particles, but not to particles generated when casting a spell with shape self. Perhaps that can be used for projectiles as well ? Furthermore for frost spells the actual projectile is rendered behind water, however the particles that follow the projectile (snow flakes) are rendered correctly. 2016-01-28_19 17 48 2016-01-28_19 30 01

jjtParadox commented 8 years ago

That's... not what I expected. @Mithion do you have any clue why this is?

Mithion commented 8 years ago

They all use the same renderer code, so I highly doubt it's specific to the earth one alone

It has to do with Minecraft's water/portals rendering based on depth buffering. If I'm seeing this correctly, it should happen to any block that is semitransparent (I would also test with ice to see if it can be replicated there - it would narrow down the issue further).

Most other pfx/projectiles don't show it was well due to the fact that they have transparency inherent to the sprite. The earth one does not, so it's much more apparent. However, since some of them do have transparency, the code is necessary for them to render correctly. This however causes weirdness with water and other semitransparent blocks.

For reference, the renderer:

https://github.com/Mithion/ArsMagica2/blob/master/src/main/java/am2/entities/renderers/RenderSpellProjectile.java

jjtParadox commented 8 years ago

Just tested with ice and colored glass, and that "weirdness" did indeed happen.

With the trail effects, are those rendered properly because they don't have transparency?

Mithion commented 8 years ago

Trails are done by the particle renderer and not the projectile renderer. Particle rendering happens at a different time during the render cycle, and that could mean the GL flags/state is different than the projectile.

I took a quick look and don't see anything in the particle render code that would cause this to be different, but, IIRC the method:

@Override public int getFXLayer(){ return 2; }

causes them to render properly over other transparent blocks.

jjtParadox commented 8 years ago

Hm, getFXLayer() is from EntityFX, which is a little different from the Render class used for the actual ball'o'spell. Any good way to apply EntityFX to the SpellProjectile?

Mithion commented 8 years ago

Yes, though not necessarily easily. You need to recreate the GL state that exists when rendering FXLayer 2. What that entails, I'm not sure. You'd need to look at the way particles are rendered and go from there.