Player model sinking into the ground when the player Y<0

Player model sinking into the ground when the player Y<0

EDIT: FOUND IT... there some misterious bug with the depthbuffer? If i switch the rendering order to render my player first everything is fine... what is going on. Doest anyone know how to fix that bug without changing the render order?

EDIT2: FINALLLY FIXED:I found how to fix it while keeping the draw order intact. The real bug is that i have quads at Y=0 that are transparent with a thin red line around for debug purpose... and its screwing the deptbuffer. I added DepthStencilState = DepthStencilState.DepthRead; for those debug quads and everything is fine now... Thanks for the help

Simple heightmap with cubes as terrain. Every thing is positioned from the same source : terrain.GetHeight(x,z). Everything on the map is placed right even when the Y of the heightmap is below 0. The player looks right when hes on a tile Y>0 but sink more and more the lower the tile is. My character is 2unit tall and when the tile is Y<-2 it totally disapear. If Y is below 0 and higher than -2 its partially hidden... Ive logged the height of my character AND the ground IN the draw function and they are exactly the same. Im using basicEffect. On the tiles y>0 the character look fine... Any lead apreciated. Ive tested changing to a new basiceffect and many other things but no success.

https://preview.redd.it/pe0u7trfwhbh1.png?width=1920&format=png&auto=webp&s=b4e0d4c2dc9b6e9f8b415379cbdf6fee609ed466

https://preview.redd.it/7w5nqtrfwhbh1.png?width=1920&format=png&auto=webp&s=620c4777f6254f6fd86e39346f9b044560242205

https://preview.redd.it/jcsthvrfwhbh1.png?width=1920&format=png&auto=webp&s=7959bc041f582485bab05da22006867a0bb8164a

https://preview.redd.it/liva2urfwhbh1.png?width=1920&format=png&auto=webp&s=b66ba94693158af867b705b8646872462afb2715

https://preview.redd.it/zf4n1vrfwhbh1.png?width=1920&format=png&auto=webp&s=e485daf45085da35dccf198efc1d17e93db5e540

reddit.com
u/LEGROSJAMBONDEV — 23 hours ago
▲ 31 r/monogame+6 crossposts

Early WIP on OSRS-like game in monogame (no external libs or assets, everything generated in code)

This is an early throwaway prototype of terrain generation for my OSRS-like game to have a base to build on for my other systems (crafting, combat, etc..)

-Once those prototypes validated ill restart from scratch to build the game cleanly.

-I got some help from DeepSeek for the terrain generation since i have absolutely no experience with terrain generation and noises... and I needed a base to build my other systems... I plan on fully learning the techniques once Im done with prototyping the rest.

-Everything is generated in code , no external libs other than monogame, no external assets and I plan on keeping it that way (other than a font file)

-I know there are flaws... biomes transitions with holes and slope issues and performances since its not optimised but thats just a proof of concept throwaway, ill rebuild from scratch once im done with all the systems.

u/LEGROSJAMBONDEV — 7 days ago
▲ 52 r/monogame+4 crossposts

The Last Harvest - Chopping trees with handcoded physics in MonoGame

Cut height is variable — chop low, mid or high and watch it fall. No physics engine, all coded from scratch. 🌲🪓

u/LEGROSJAMBONDEV — 13 days ago
▲ 22 r/monogame+1 crossposts

The Last Harvest — First-person farming game in MonoGame, everything generated in code

After years of engine hopping, MonoGame finally clicked for me.

First person camera, tiled farmland, tile selector, click to plow. Zero PNGs — all textures generated in code.

Next: crops, trees, cows and archery 🌾🪓🐄

Feedback welcome!

u/LEGROSJAMBONDEV — 16 days ago