7

Minecraft has shadows in some of the shaders, and the shadows are obviously created via the positon of the sun or by timing. So is there a way to actually get this angle of elevation from the ground of specific coordinates to the sun? Or, is it possible to get the shadow length of a block?

2
  • 2
    I think your assumption might be wrong. I could see that it doesn't take into consideration the position of the sun, but actually the current game time and if the block is within sunlight. (For the default shader). Been a while since I played Minecraft, but I would guess that if it was really calculating a shadow from the placement of the sun, it could calculate a shadow with a torch, which, if I remember right it doesnt. But I'm very much out of my depth and might be totally wrong.
    – Fredy31
    Apr 7 at 14:17
  • @Fredy31 in computer graphics, calculating shadows from a number of different lights is substantially harder than just calculating shadows from just one light, and calculating shadow from a sun-style light (directional, no location) is also easier.
    – user253751
    Apr 8 at 12:20

1 Answer 1

9

If you are talking about shaders as in shadermod/Iris/OptiFine shaders, those talk to the OpenGL graphics library directly and get the angle from their respective mod like this from the Iris mod. There is currently no direct way to fetch the sun's angle with a command in the vanilla game.

1
  • 10
    As far as I'm aware the sun's position is based entirely on the time of day, so you could possibly use time query daytime (with execute store) and some scoreboard players operations to calculate it in vanilla. Apr 8 at 3:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .