lightsprite

Blitz3D Forums/Blitz3D Programming/lightsprite

Neochrome(Posted 2003) [#1]
i have noticed in some games that a torch can be uses as if there was a Lightmap being use at real time..

Can any body give me any pointers about how i would go about doing this??


jhocking(Posted 2003) [#2]
You'll have to explain the effect in more detail. I have no idea what you are referring to.


Ross C(Posted 2003) [#3]
are u refering to the way the lights in blitz only light whole polygons? apposed to the way lightmap show a more accurate lighting


Neochrome(Posted 2003) [#4]
actualy, think of a touch, and its a narrow beam light. Police torch if you will..

if you shine it at the wall, it will light up the circular spot.. like unreal 2 does


jhocking(Posted 2003) [#5]
See, this is exactly why you needed to explain in more detail. What you call a "torch" I call a flashlight.

I don't know if this would be the best way but one approach which comes to mind is basically a reverse shadow casting. You have a texture of a white circle on a black background and use that as a sprite set to "add" blend mode. This could be used to illuminate a circle on surfaces in your game. The actual cone of light could be done with alpha transparent geometry.


Neochrome(Posted 2003) [#6]
cool. i'll try that right now.. Sorry for the miss understanding


Neochrome(Posted 2003) [#7]
no, just getting a white circle nothing else


jhocking(Posted 2003) [#8]
I don't know what I was thinking but a white circle is way too bright. Additive blending white with anything results in white. Experiment with different shades of grey to see how that turns out.


_PJ_(Posted 2003) [#9]
Dunno if this is relevant, and to be honest I am not very good with this texture/blending stuff and lighting is something I have yet to investigate and learn properly... but...

On my laptop which has inferior graphics capabilities, textures often appear white when blended even though they show OK on my desktop PC.


Neochrome(Posted 2003) [#10]
iv done the white circle in alpha .5 and it does work, but in the dark area's it only brighten the dark bits.. its not "lighting" up the textures is if there where a light map behind it...

this is not a big plan, just would be nice to see if it where possible


jhocking(Posted 2003) [#11]
"On my laptop which has inferior graphics capabilities, textures often appear white when blended even though they show OK on my desktop PC."

You may need to correct gamma. I used to have a similar problem on my PC with its older hardware (ie. ATI Rage Fury Pro.) It wasn't just blending either; in general brighter parts of the scene were blown out, as though everything above a certain brightness was just clamped to white. I fixed the problem with the following code right after the call to Graphics3D:

SetGamma 255,255,255,255,255,255
UpdateGamma


Neochrome(Posted 2003) [#12]
thats not helping my problem..
has anyone got any idea's


MADJON76(Posted 2003) [#13]
perhaps im missing something .. but why dont you use a spotlight in blitz since this has the effect u want. to make sure you get a nice round light effect make sure u subdivide (split) your polygon walls up into a number of pieces per side. the more polys the smoother the circular shape.


_PJ_(Posted 2003) [#14]
cool thanks jhocking!

I will try that!


Sunteam Software(Posted 2003) [#15]
hehe ok I might be being stupid but your white circle should actually be something more like grey i.e. say 100,100,100. Then used with additive blending it should look ok, you shouldn't need to alpha it at all.


jhocking(Posted 2003) [#16]
"I don't know what I was thinking but a white circle is way too bright... Experiment with different shades of grey..."

That is what I amended my suggestion to. I don't know where he came up with that alpha .5 thing. Use a grey circle on black background as an "add" blend mode sprite.


Neochrome(Posted 2003) [#17]
i guess i just found its limit.. its not working.. i'll just have to accept it


Rob Farley(Posted 2003) [#18]
The reason why it's not working is that your are trying to brighten dark colours, if the light map makes an area black the best you're going to get is grey with this method. The only way round this is to dynamically update the lightmap which I think will be way too much like hard work (and probably slow as hell)


_PJ_(Posted 2003) [#19]
maybe a lighter AmbientLight would brighten the overall lights (?)