jonathanhogg / flitter

A functional programming language and declarative system for describing 2D and 3D visuals
https://flitter.readthedocs.io
BSD 2-Clause "Simplified" License
39 stars 1 forks source link

It would be great if point lights could have a radius #45

Closed jonathanhogg closed 7 months ago

jonathanhogg commented 7 months ago

This would improve the realism of specular reflections where a light is relatively large compared to the distance of it from a surface. At the moment it is treated as infinitely small (that would be the definition of a "point" then) and so the reflections will look like small dots at close distances.

jonathanhogg commented 7 months ago

Have been thinking about how to do this off-and-on and wondering about the following:

This ought to give more believable specular reflections while not being too complicated to calculate.

jonathanhogg commented 7 months ago

A second possibility is just offsetting the light by its radius towards the fragment. Might be worth trying this first to see what that looks like…

jonathanhogg commented 7 months ago

A second possibility is just offsetting the light by its radius towards the fragment. Might be worth trying this first to see what that looks like…

OK, yeah, tried that. It doesn't work.

jonathanhogg commented 7 months ago

The winning solution was the second comment above: offsetting the point towards the reflection ray by up to radius. I am not attenuating the light at all, however, as I realised this doesn't make any sense. It would affect all light falling on objects from point lights and mess up the diffuse calculations as well. At the moment this means that reflections of ball lights off of shiny surfaces are a little crisp – I can revisit perhaps in the future.