Comments (8)
Thanks for feedback!
This is quite a complex feature. In theory, you could use some edge detection algorithm on the sprite image and feed the output polygon into a hull. That might work for simpler sprites where edge contours are well defined. However, once the edges are no longer solid and transparency comes into play, these algorithms tend to produce a lot of noise and overly complex polygons which then would need to be simplified in order not to take up too much performance (mainly from casting shadows).
from penumbra.
Thanks for the response. I feel that using complex polygons for a lot of sprites will perform really bad (havent tested it) I came across a different solution, that uses a Buffer where you draw your sprites in black and white, and this is combined with your lights, but I couldn´t make it work on monogame The XNA version works fine :(. [http://funhazardgames.blogspot.com.es/2012/10/2d-shadows-part-2-manual.html]
from penumbra.
Maybe Farseer (see Convex decomposition) contains some clue and good algorithms to do something closer.
from penumbra.
@bernardoGM you used a outdated link, he created a monogame compatible version here http://www.funhazard.com/xna-resources.html
from penumbra.
@captkirk88 Even the updated MonoGame version will not work with higher MonoGame Framework versions.
I worked with this shadow system in the past and I needed to exchange it.
I got the shadow sample working with MonoGame 3.6 though, but there were no lights or shadows in the scene and I didn't know why.
Several people tried to port it over to a newer MonoGame version, but so far no one was able to do it (as far as I know).
I still have the visual studio solution on my hard drive if someone is interested. At least the sample project will run and you can see what changes I did in the shaders so they become compile correctly. But you will need a good knowledge about shaders to make the last changes needed to make everything work I think.
Maybe it's even neccessary to create a complete new shadow system based on the approach of Catalin Zima / Funhazard.
from penumbra.
@bernardoGM that is a pity. I was looking into it myself because I need a way to disable updates on entities that are completely engulfed in shadow. I have no way of detecting that with Penumbra. Unless I missed something.
from penumbra.
You could use the LightMap of the PenumbraComponent and use it for the "light detection".
Then draw all your entities on top of it (seperate RenderTarget) and check how much (percentual) light is on an entity. If it's around 0% or 5% -> deactivate the entity.
I think you need to wirte your own litle shader for this. Maybe a kind of a mask shader.
This is just a spontaneous thought. A built-in solution is not available I think.
Edit: A second thought on this: Maybe it's even simpler to use lights with the "Occluded" shadow type and then just check the brightness of an entity.
from penumbra.
Could do that using OpenCL instead. I'll look into it. Just started wrapping my head around OpenCL kernels.
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.