How, that is the question.ĭo I draw shadows first and than lights on shadowed main surface? I will try to light up dark area with a white light. I have a light without shadows and have a shadow without lights. My only concern here is: What is up with resulting alpha? Should I make it 1.0 again? How? So in the end it is like I am multiplying every color of surface by (1-alpha) of my black rectangle. And I draw it on 100% opaque main game surface. I found out, that to create even a bit of darkness I must use very opaque black rectangle. So, what do we have here? Bm_normal calculates color as following: (bm_src_alpha, bm_inv_src_alpha) (Rs,Gs,Bs,As) * (As, As, As, As) + (Rd,Gd,Bd,Ad) * (1–As, 1–As, 1–As, 1–As) Every youtuber and his grandmother suggests to draw a transparent black rectangle over my view with bm_normal. I heard that some people use bm_multiply for lights, but I do not know what it is and how it works.Īnother useful thing I figured out with lights is that I should draw all the lights on one surface with blend mode mb_max. That's a problem, but I can keep my brightnes low enough and have a good light. If I add too much light resulting color will be white. So, as result, all the colors will be brighter (cool!) and closer to white color (not cool!). With this I can draw a light on black canvas like this: And than draw it in game like this: draw_set_blend_mode(bm_add) ĭraw_sprite(spr_test_light,1,obj_camera.x,obj_camera.y) īm_add calculates color as following: (bm_src_alpha, bm_one) (Rs,Gs,Bs,As)*(As,As,As,As)+(Rd,Gd,Bd,Ad)*(1,1,1,1) = (R,G,B,A) ![]() (I am realy a noob though.)įirst of all, I figured out, that the best way to draw lights is to use bm_add blend mode. You will tell me: hei, noob! there is a ton of information and youtube tutorials! I read all of that tutorials, but I still do not understand something important. Thanks to all of you.īut I could not find usefull information about creating lights and shadows in games. I've been reading manuals here for a long time, and found a lot of usefull information.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |