Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How hard would be to implement a “light” object? #11

Open
davibarreira opened this issue Feb 10, 2022 · 4 comments
Open

How hard would be to implement a “light” object? #11

davibarreira opened this issue Feb 10, 2022 · 4 comments

Comments

@davibarreira
Copy link

I saw that in the example of the Julia like spheres, you’ve coded in a way that the spheres have shadow. I was wondering how hard would be to implement a sort of “light pole” such that a shadow could be caste in the correct direction. For example, if I wish to perceive a sphere, I’d need a shadow like the one you hard coded.

@cormullion
Copy link
Owner

Hi Davi! Thebes isn't really 3D, more 2.5D, and it's a bit of a con, really 😃 By changing the colours of 3D planes according to the angles of their surface normals, we can give the illusion of lighter and darker surfaces. Using the eyepoint as the basis for measuring these angles works for this example ... so if you had a different point other than the eyepoint for calculating the colours, the illusion would work for that point, I think, but you would keep the calculations for hidden-surface removal the same. It might work.

But "casting shadows" suggests that there's some interaction between different objects - at the moment, everything is completely independent of everything else.

I sometimes wonder whether developing some kind of output function to Makie or Blender would be more productive than pursuing realistic images: making shapes is easier than developing a ray-tracing rendering function. But then, why not go straight to Makie or Blender? 😃

@davibarreira
Copy link
Author

Hmm, now I understand the idea a bit better. I didn't actually thought about "casting shadows", only about the color gradient stuff you just described, in order to give the illusion of 3D.
As for why using Thebes. First, cause is awesomely easy :D Second, the fact that it's all Luxor makes 2D and 2.5D sort of one thing. So, everything is very light weight, which is great.

So, is the gradient functionality already implemented under the hood for the eyepoint? I mean, do I need to personally implement the gradient functionality if I wish to plot a sphere?

@davibarreira
Copy link
Author

I realized that my question was wrongly posed for what I actually meant. I'm not interested in actually having a light that creates shadows, but in this nifty implementation of rendering according to eyeypoint, in order to perceive objects are 3D.

@cormullion
Copy link
Owner

do I need to personally implement the gradient functionality if I wish to plot a sphere?

Yes, you’d have to write a rendering function that determines how you want to draw the faces. The default ones are quite basic. If you just want to colour them with random Julia colours, that’s fine 😂 - but you still have to work out which ones are hidden… If you also want to adjust the colours according to the angle the surface points in, then that example code should be a good start. Ray-tracing - why not!?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants