Comments (4)
Have been thinking about how to do this off-and-on and wondering about the following:
- Reflect the view ray off the surface normal to get a (normalised) reflection direction
- Calculate closest point on this ray to the position of the light: dot product of fragment-to-light vector and reflection direction, multiplied by reflection direction, plus fragment position
- Offset light along vector towards closest point by a maximum of the light radius
- Attenuate light by some amount based on offset (not sure what the calculation for this should be)
This ought to give more believable specular reflections while not being too complicated to calculate.
from flitter.
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…
from flitter.
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.
from flitter.
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.
from flitter.
Related Issues (20)
- Why aren't `Context` and `StateDict` part of the model?
- Windowed mode not working on macOS Sonoma (Apple Silicon) HOT 16
- OpenGL render bug on Apple Silicon HOT 16
- Forcing use of unsupported recursion causes kind of horrible errors expected of using recursion HOT 1
- Physics can easily leak state HOT 1
- It would be useful to have distinct camera support in `!canvas3d` HOT 4
- Rewrite `!physics` computation code as an OpenGL compute shader?
- Add unit/regression tests for language simplifier
- What if symbols became numbers instead of strings? HOT 3
- Add support for offscreen GL contexts HOT 2
- Add some basic functional testing HOT 4
- Functions and function calling needs a cleanup
- What if `Context` objects became the interface between the engine and rendering? HOT 1
- A rounded box primitive would be a nice thing HOT 2
- Should indexing wrap? HOT 4
- Flitter needs a Pygments syntax highlighter HOT 2
- Can I come up with a decent model of translucency? HOT 3
- Counters annoy me
- Either fix or pull simplification on state HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flitter.