Help with Lights
Blitz3D Forums/Blitz3D Programming/Help with Lights
| ||
I recently added lights to go along with a lens flare effect I am working on in my game and I got a most unwelcome surprise. The lights seem to make my hud completely black. My hud is made with quad's that are textured, but it seems that the light is causing them to be completely black. Is there any way I can make it so that lights won't affect a particular entity? I thought this was what the FX fullbright did, but apparently I was wrong. I'll give my code here, excuse my formatting its been awhile since I posted anything and I forget the formatting labels. ----------HUD CODE--------- Global nWinWid=800,nWinHit=600 Global nCameraZoom# = 1 Type hud Field mesh Field surface Field x# Field y# Field w# Field h# Field ScaleSpeed# ;for any guages, this records the speed at which the guage can scale itself Field CurrentValue# ;this variable stores what value the guage is currently displaying Field Brush Field Alpha End Type ;------------------------------------------ Function CreateHud.hud(Brush, ScaleSpeed# = 0) ;------------------------------------------ Hud.Hud = New Hud Hud\ScaleSpeed# = ScaleSpeed# Hud\mesh=CreateMesh() Hud\surface=CreateSurface(Hud\mesh) AddVertex Hud\surface,-1,+1,-1,0,0 : AddVertex Hud\surface,+1,+1,-1,1,0 AddVertex Hud\surface,+1,-1,-1,1,1 : AddVertex Hud\surface,-1,-1,-1,0,1 AddTriangle Hud\surface,0,1,2 : AddTriangle Hud\surface,0,2,3 EntityOrder(Hud\mesh, -1) ; ensure the sprite is drawn after everything else EntityBlend(Hud\mesh, 1) ; alphamode, use 1 or 3 EntityFX(Hud\mesh, 1) If Brush > 0 Then PaintEntity(Hud\mesh, Brush) Hud\Brush = Brush Return Hud End Function ;----------------------------- Function HudParent(Display.hud,camera) ;----------------------------- EntityParent(Display\mesh,camera) End Function ;------------------------------------------ Function PlaceHud(Display.hud,x#,y#,w#,h#) ;------------------------------------------ Display\x# = x# Display\y# = y# Display\w# = w# Display\h# = h# Local cx#,cy#,px#,py# cx# = x#+(w#/2) cy# = y#+(h#/2) px# = 2*(cx#-(Float(nWinWid)/Float(2))) py# = -2*(cy#-(Float(nWinHit)/Float(2))) ScaleEntity(Display\mesh,w#,h#,1) PositionEntity(Display\mesh,px#,py#,nCameraZoom# * nWinWid) End Function ;------------------------------------------ Function FreeHud(Hud.Hud) ;------------------------------------------ FreeEntity Hud\mesh Delete Hud End Function ---------LIGHT CODE------------- B\HandleNum = CreateLight(1, User\EnvironHandle) RotateEntity B\HandleNum, -Pitch#, WrapAngle(Yaw#-180), 0 LightColor B\HandleNum, B\Red, B\Green, B\Blue |
| ||
Does not go black here, but I am having to guess how you are creating your texture and brush. Are you sure the light is making them black? I do not think so. |
| ||
Have you set brushfx brush,1 in your brush creation routine? Not sure if the entityfx,1 affects a surface painted with a specific brush. |
| ||
Good idea. Something else you might want to disable fx wise is fogging, just in case you decide to add some, you will not want it to effect your hud. |
| ||
Tsk, tsk, Black Hydra - it wou;ld be nice if you credited other people when you post code like this ;) |
| ||
Also dude, use UpdateNormals on it, i used to get that. I assmue you have the latest b3d? |
| ||
The light definitely is the problem, however I'll go over the things you said. Sorry, I was shown the code from a guy in another post. It isn't mine but I couldn't remember who it was. If it was yours then I can make a note of it in my code. I'm not trying to look ungrateful, I really am ;) . |
| ||
Okay I managed to fix it by adding the fullbright to the brush and adding an update normals. Thanks you guys. Oh, and to Blackledge, if you can tell me who made this code (either yourself or someone you know...) then I'll make note of it in my code and give them credit when my game is done, sorry for my faux-pas (if thats how you spell it...) |
| ||
No, I can't, coz I've forgotten who I got ir from! Arrgghh! But there are so many of us working on similar problems (thank goodness, so help yourself) but I just wish that we could somehow create a separate forum, or maybe put in a request to Blitz Support to make one when they agree it's justified, maybe called 'Mesh-HUDs', then instead of bits of code in different threads it would all be in one place. I guess what I'm asking for is something like the Tools Section, but with headings like 'Mesh-HUDs', 'Physics', 'Collisions', 'B3D-format' - you know, discreet areas where discussions and code can be shared on a specific problem without bothering other people in the more general area. Probably too much to ask for in terms of moderation/web-site restructuring? |