Comments (3)
Each light is essentially a quad. Origin is the anchor point which marks the (0; 0) point on that quad (in local space). Depending if you are operating in SpriteBatch's screen space (y-axis runs from top to bottom) origin (0; 0) represents the light quad's top left corner while (1; 1) represents the bottom right corner. The reason its normalized to [0..1] is so that if you change the scale of your light, you wouldn't need to change the origin: an origin (0.5; 0.5) would still mark the center of the light. I see a source of confusion here because SpriteBatch's origin is not normalized. Perhaps an anchor would be a better name...
When it comes to the setter, there is no automatic normalization being done: it is expected to be set in its normalized form. The reason values outside [0..1] range are allowed is that it might be desirable for some weird rotation scenarios, though such usage should be rather uncommon.
Usually, for PointLight
and Spotlight
the default values are sufficient.
(0.5; 0.5) marks the origin for point light (since it emanates from the quad's center):
(0.0; 0.5) marks the origin for spotlight:
Main usage for the property is when you use a TexturedLight
with a custom texture where the light may emanate from whichever point on that texture (quad). For example, for the following texture you would set the origin to (0.5; 0.0):
I hope that helps :) Let me know if anything is still unclear.
from penumbra.
Thanks, it's clearer now :).
I don't think there were any details about how default spotlight are made (not as crystal clear as here at least), so the confusion.
I suggest to add some words and rephrasing a bit maybe as from my point of view, origin or anchor is very close to UV coordinates inside the texture. Example(s) with some random textured light, with screen capture of paint program showing light point and origin value used in code may be very helpful.
(Also, what could be done with textured light if origin is not on any of the edges).
from penumbra.
origin or anchor is very close to UV coordinates inside the texture
UV coordinates are a good analogy. In case of using the same transform as SpriteBatch (penumbra.SpriteBatchTransformEnabled = true;
), they match exactly. Otherwise it depends on the penumbra.Transform
being used: if the world's y-coordinate runs from bottom to top, then that is also the case for Origin.
Also, what could be done with textured light if origin is not on any of the edges
I guess you would just need to try out different origins until you find the sweet spot.
from penumbra.
Related Issues (20)
- Support for MonoGame 3.7.1 HOT 5
- No lights drawn on WindowsDX HOT 3
- Tweak color of unlit areas
- How to use it within a tileengine?
- [Question]: Is there a way to detect which hulls are affected by light? HOT 3
- Visual artifact
- Stretching viewport to window bounds
- Not Updating on Hull removal. HOT 8
- [Question]: Is there a way I can change the layer depth at which individual shadows are cast? HOT 2
- Support MonoGame 3.8 HOT 5
- Occluded ShadowType working incorrectly? HOT 2
- Installing Penumbra HOT 5
- Normal map support HOT 1
- Transforming Penumbra with Camera? HOT 2
- FNA-XNA Support?
- Smaller Render Targets
- Support for MonoGame 3.8.1 HOT 3
- Limit the penumbra effect to a specific area? HOT 2
- Drawing non-affected Elements like in HelloPenumbra doesn't seem to work
- NOT AN ISSUE - Thanks to project owner.
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 penumbra.