boskee / Minecraft

Simple Minecraft-inspired program using Python and Pyglet
MIT License
207 stars 33 forks source link

Use shader to render blocks #100

Open Jimx- opened 5 years ago

Jimx- commented 5 years ago

This makes it possible to create better visual effects like lighting

r58Playz commented 5 years ago

I'll try to test that.

r58Playz commented 5 years ago

Works great!

Nebual commented 5 years ago

Thanks for fixing the block cracking, that was bugging me :) 3D Block Icons seem to work well too! I've pulled those 4 commits into master (since you pushed them to my merged python3 branch).

Block shaders is a great addition! Though there's something odd going on with the time of day; the lighting doesn't seem to line up with where the sun image is positioned, with my world appearing to be in full shadow when the sun is at high 12:00. Also when I try flying (tab) into the sky, the world becomes much brighter, so there's something odd occurring with view occlusion...

Nebual commented 5 years ago

I tidied up + slowed down the passage of time to 20m/day cycle (matching Minecraft pacing), if you want it fast like before for testing shaders, you can use python main.py --fast which brings it up to 1m/day.

I also tweaked get_sun_position() so the shader appeared to follow the visual sun, let me know if I'm misinterpreting it!

Jimx- commented 5 years ago

Thanks for the comment! I'm not quite sure about the sun position because I used the same formula in sun_vertex() to calculate the sun position so the lighting should follow the visual sun... I guess there might be something wrong with the face normals passed to the shader and I'll check that.