reading colour from lightmap for lighting entity?
Blitz3D Forums/Blitz3D Programming/reading colour from lightmap for lighting entity?
| ||
I'm sure a while ago someone posted a routine to read the colour at an entity's position from the lightmap and then set the entity's colour, to enable it to darken when in shadow. Does anyone have this routine? My attempt is very slow it seems. Thanks James |
| ||
yeah the dudes email that wrote the example for what your asking is kusanagi@... I coudnt find the example though |
| ||
Is this it?: danjeruz.servegame.com/DSS/vollight.zip |
| ||
Sorry Puki, my server has been shut down by my ISP. i will email Vorderman as i still have the file though. |
| ||
I'm not sure if it is the one. Hey, "Vorderman" - is it the one in this thread?: http://www.blitzbasic.com/Community/posts.php?topic=38107 |
| ||
I've sent the file to him via Email. |
| ||
Thanks very much Cygnus - I'll have a look at it and see whether it's the thing I was after. I think there was a simple code example posted by someone somewhere, just posted up as normal in a [code] box - the forum search is next to useless though and I still can't find it... by the way, how do you know my email :) ??? |
| ||
Anyone know who "kusanagi@..." is? I shall email him to see if he has the code example around still. Thanks ckob. |
| ||
"Cygnus" knows and, if not, I can find out - the original for the above zip was posted at Blitzcoder - I think the guy is Russian or something - I can get the info. Is the zip file the code you wanted? If not, tell us everything you remember about the posted code you saw - names of people that posted in the thread - was it the code for an actual lightmapper routine or something else - any more info, will help me locate the code for you. |
| ||
How about Fredborgs PickedU() & PickedV() commands? http://www.blitzbasic.com/codearcs/codearcs.php?code=515 Linepick down Get the Picked U & V Read that pixel color from the lightmap. Rough & Fast :) |
| ||
Freelance 3D Artist, full time dad (note: 'Dad' services not for hire!) :) I could use "full time 3D Artist & dad" - but I too wouldn't want to be a rent-a-dad for anyone else, it's too tough, one kid is more than enough... |
| ||
The volume light code was done by "DSS" (that is what he is called on Blitzcoder). I don't think he posts here. He lives in the UK and his email is mailto:dmitry.smirnov@... |
| ||
yes, DSS is the coder for the volume lightmap program. my server is down but providing im not flooded with requests, il send the code via email. |
| ||
Hmm, I'm not sure that volume lightmap program is the correct one - what I saw was a small routine to just return the colour from the lightmap at the position of an entity. I've done this myself with just a few lines, but for some reason reading the pixel colour from the lightmap is very very slow - even a single read every render loop drops the framerate, and I've tried using lockbuffer and readpixelfast - I must be doing something wrong somewhere - any ideas anyone? |
| ||
With certain NVidia drivers, I've noticed slow downs with textures using the flag 256 (vram), is your lightmap using this flag? |
| ||
for some reason reading the pixel colour from the lightmap is very very slow - even a single read every render loop drops the framerate, and I've tried using lockbuffer and readpixelfast - I must be doing something wrong somewhere - any ideas anyone? The size of the lightmap matters greatly - make it as small as you can bear to see. (EDIT: I'm basing this advice on my experience with kusanagi's technique.) |
| ||
I'm not using texture flag 256, the LM is just loaded as normal and set to blend in the second UV channel. It is 1024x1024 though - I might try reducing it to 256 or 512 and see what happens. Thanks. |
| ||
Hmm, I'm not sure that volume lightmap program is the correct one - what I saw was a small routine to just return the colour from the lightmap at the position of an entity. I've done this myself with just a few lines, but for some reason reading the pixel colour from the lightmap is very very slow - even a single read every render loop drops the framerate, and I've tried using lockbuffer and readpixelfast - I must be doing something wrong somewhere - any ideas anyone? Upon loading the lightmap, make and store a copy of it in a bank or array...read the colors from there, NOT the lightmap stored in video memory. |
| ||
Upon loading the lightmap, make and store a copy of it in a bank or array...read the colors from there, NOT the lightmap stored in video memory. I 2nd that! You don't want to be reading texture data directly - oh no! In addition, if you're dealing with a character running around a level you only need to store the lightmaps on surfaces the character can walk over. For example, you could only take copies of the lightmaps from polygons with normals that point upwards - this saves quite a lot of memory. To save even more, you don't have to have these 'memory copy' of the textures at the same resolution, you could store them at a lower resolution and interpolate the results. |