0
\$\begingroup\$

I am trying to make a 2D isometric RPG and I kind of hit a wall when it comes to lighting. I was thinking of using shaders, if I manage to understand them.The problem I am anticipating is the presence of light sources outside the screen.In order to calculate shadows and so on I'd still need to have those objects rendered even if they're offscreen or else light would pop in and out if I move the view around the map. I was thinking of drawing the entire level, not just what is seen, but that would mean drawing at negative and outside the view coordinates.Does that work or I should seek a better, more efficient alternative?

\$\endgroup\$
3
\$\begingroup\$

If you just want to know if drawing outside of the bounds is possible, yes it is. The GPU will cull what is not visible and keep what is onscreen. Really, you should be using a transform matrix on your spriteBatch calls though; draw everything via its world position and then transform it to view cordinates using a matrix transform.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.