Sprite clipping with 3D & shader

Have a question, suggestion, or comment about Aleph One's features and functionality (Lua, MML, the engine itself, etc)? Post such topics here.

Sprite clipping with 3D & shader

Post Apr 30th '18, 03:01

I've long been bothered by an issue where sprites get clipped by walls and floors, especially explosion effects and corpses. Today, I did some testing and narrowed it down to occuring under the shader renderer when a 3D plugin is running.

Typical, all shots clip through the wall:

BiggerGunsNearby_0062.jpg


They also pass though corners:

BiggerGunsNearby_0065.jpg


This happens in the original, with all plugins disabled except 3D scenery, at minimum resolution:

TheRose_0017.jpg


This is using the Feb. 26 2017 build under Debian 8 on a Nvidia Quadro FX 1600M
User avatar

ravenshining
Hawai'i

Post Apr 30th '18, 06:25

Thanks for making this thread; I’d been noticing this happening and had been wondering what the hell was causing it. I’ve noticed several much more conspicuous examples in my own play; I may either take a screenshot or point to a specific frame in a YT video I’ve uploaded tomorrow.

Which option do I disable to stop this behaviour until it gets fixed? 3D models? Bump mapping? Something else?

(FWIW, it’s also happening in the most recent 2015 release as well, AFAICT.)
User avatar

The Man
Sarasota, FL

Post Apr 30th '18, 12:32

If you switch to the OpenGL (Classic) renderer and turn the Z-buffer off (this will cause clipping issues with 3D models, so disable those as well) it should look OK. If you want 3D models or the shader renderer, you're out of luck; we have to use the Z-buffer and it will cause projectiles to clip where they intersect with walls and models.
User avatar

treellama
Pittsburgh

Post Apr 30th '18, 20:39

There are probably a few ways to improve sprite rendering alongside 3D models, if anyone wanted to put in the effort. One might be to have a second depth target for the 3D model shader. That would permit sprites to be depth tested against models, but not walls or floors.
User avatar

TrajansRow

Post Apr 30th '18, 21:50

I was very tired when I posted and apparently forgot to mention that the Shader renderer works fine as long as a 3D-model plugin isn't loaded. I can set shader and enable 3D models, but it's not until the game actually has a 3D plugin to load does it start clipping.

I *could* use classic OpenGL, although it tends to make me nauseous, and means I can't have bump maps. Interesting, if I enable the Z-buffer under classic, all the sprites and models dissappear.

One problem I could see with your suggestion Trajan is when a sprite is partially covered by liquid, in that case you do want the liquid texture to intersect the sprite. Here's another idea, what if sprites that impact a surface were oriented along the surface? Might look weird at extreme angles but better than being clipped. Or, again specifically for impact effect sprites, what if the sprite was drawn at a distance away from the wall equal to, say, the first frame's x-offset?

Meanwhile for corpses and scenery items, on my end I could alter the frame data to avoid intersections with the floor. Won't solve the problem for any other scenarios and may again look weird at certain angles, but it's something I can do.
User avatar

ravenshining
Hawai'i

Post May 1st '18, 00:16

I’m pretty sure partially submerged sprites are drawn in two halves, so even that doesn’t need the depth test.

With z-buffering in classic, could you tell if a small portion of some sprites below the floor were visible?

What you might be thinking of is glPolygonOffset. That could solve the wall clipping problem by tweaking the depth test to favor more of the sprite. That could cause incorrect results if a sprite were near a 3D model, but may be better than clipping at every surface.


If you don’t care too much about perfect sorting relative to 3D objects, just set the depth function to GL_ALWAYS in that node sprite helper function (or whatever it is) and call it a day.
User avatar

TrajansRow

Post May 1st '18, 00:33

ravenshining wrote:I was very tired when I posted and apparently forgot to mention that the Shader renderer works fine as long as a 3D-model plugin isn't loaded. I can set shader and enable 3D models, but it's not until the game actually has a 3D plugin to load does it start clipping.

I thought we put in a hack to disable the depth test when 3D models were not in use, but I couldn't find it in the code when I went to reply. That was a long time ago. Sounds like you have your answer though.
User avatar

treellama
Pittsburgh


Return to Aleph One Discussion



Who is online

Users browsing this forum: No registered users

cron