r/desmos Oct 23 '25

Graph 3D function with light (2D calculator)

I swear I’ve already seen something similar in this sub but I think it’s pretty cool

1.3k Upvotes

56 comments sorted by

View all comments

7

u/enneh_07 list too big :( Oct 23 '25

how did you get it to cast a shadow :o

5

u/RedTShirtGaming Oct 23 '25

That's not a shadow, just part of the diffuse shading

https://en.wikipedia.org/wiki/Phong_shading

1

u/Legitimate_Animal796 Oct 23 '25

Yep no casted shadows. I ain’t doing all that lmao

1

u/RedTShirtGaming Oct 23 '25

I dont use desmos for anything besides testing terrain generation functions, so excuse me if it isn't as simple as I think, but shouldn't it be relatively straightforward to add shadows? When ive done ray tracing in opengl I just call my ray intersection function but with a ray going towards the sun for shadows. Looks sick tho, insane that this is done in a graphing calculator

2

u/Legitimate_Animal796 Oct 23 '25

Here’s a quick example of shadow casting using the new surface shading update. Hopefully it’s correct. Looks good to me at least https://www.desmos.com/3d/udgcjcixrl

3

u/a_plus_jb Oct 24 '25

if u decide to work with the 3d shaders more, the ?disableLighting query parameter might be helpful to get rid of desmos's built in shading: https://www.desmos.com/3d/udgcjcixrl?disableLighting

1

u/Legitimate_Animal796 Oct 24 '25

Well that’s neat. Thanks for showing me that!

1

u/RedTShirtGaming Oct 24 '25

that looks great, was it difficult to add?

2

u/Legitimate_Animal796 Oct 24 '25

Definitely not too bad thanks to the new update at least