Giter VIP home page Giter VIP logo

Comments (8)

discosultan avatar discosultan commented on May 25, 2024

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.

bernardoGM avatar bernardoGM commented on May 25, 2024

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.

InfiniteProductions avatar InfiniteProductions commented on May 25, 2024

Maybe Farseer (see Convex decomposition) contains some clue and good algorithms to do something closer.

from penumbra.

captkirk88 avatar captkirk88 commented on May 25, 2024

@bernardoGM you used a outdated link, he created a monogame compatible version here http://www.funhazard.com/xna-resources.html

from penumbra.

BlizzCrafter avatar BlizzCrafter commented on May 25, 2024

@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.

captkirk88 avatar captkirk88 commented on May 25, 2024

@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.

BlizzCrafter avatar BlizzCrafter commented on May 25, 2024

@captkirk88

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.

captkirk88 avatar captkirk88 commented on May 25, 2024

Could do that using OpenCL instead. I'll look into it. Just started wrapping my head around OpenCL kernels.

from penumbra.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.