Skip to main content
gamedev.net
🔒 Locked

A Simple Corona Problem

Started by DisKordCoder 0 replies 400+ views
Original Post
DisKordCoder
DisKordCoder
Coronas can be easy to draw, but ive got a problem with when to draw them. How can i tell if the light can be seen, or if its hidden? How can i tell if there is a polygon in front of my light, so that i dont draw the corona?? Thanks!
MothaBrain
MothaBrain
I think there are 2 ways to solve your problem.
I didnt do it for my game yet, but I think it''s the way like this:

1. If your coronas are applied at the end of your rendering process, you should be able to check the z-value of your light against the current zbuffer value at the transformed point of the light. If there''s another (a nearer) z value in the zbuffer
your light will be hidden. Then the corona wouldnt be visible.
(Dont know if its slow to check the zbuffer for every light)

2. You can trace a ray from the viewers point to the light (in "real" 3D)
If the line hits any geometry you corona wont be visible

Hope this helps


Have a look at our game "Crashday" at www.moonbyte.de

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.