Lighting

Blitz3D Forums/Blitz3D Programming/Lighting

Ben(t)(Posted 2007) [#1]
I have no idea what happened to my other post but here is my question. is there some way to use the lightmap that a level uses to color entities in my game depending on where they are?


Stevie G(Posted 2007) [#2]
Yes. There's a pickedu / v function in the archives. Once you have them you can get the argb of the pixel on the lightmap texture by reading the pixel at u* texturewidth() and v* textureheight(). Convert this to r,g,b and use that as a basis to colour your entities.

Stevie


Ben(t)(Posted 2007) [#3]
do you happen to know what it is called? if not thats fine


Matty(Posted 2007) [#4]
Picked U/Picked V/Picked W command is here:

http://www.blitzbasic.com/codearcs/codearcs.php?code=515


Ben(t)(Posted 2007) [#5]
okay I have the code but it seems to only work for picking a object and getting it's texture. how would I use this for my entities if they are not pointing at the floor below them?


ShadowTurtle(Posted 2007) [#6]
Make a looooong scan-line.. from players hight to -10000000. This will make every a collision on the floor.

With the getted texture color you're can calculate a black&white point wich meant to be used as object color (black color = shadow = black object)

So long i known this makes the effect:
Black & White = (Red + Green + Blue) / 3


Ben(t)(Posted 2007) [#7]
I'm still a beginner with programing, could you explain it me again?


Ben(t)(Posted 2007) [#8]
I still need help I'm confused what Turtle was trying to tell me.


Vertigo(Posted 2007) [#9]
Use the above mentioned source found in the archives.

http://www.blitzbasic.com/codearcs/codearcs.php?code=515

You need to perform a line pick straight down from the entity that you want to color. Shadow Turtle was saying to make it a long pick, IE the distance goes way down on the Y from your entity.

Use this pick and the function from that code to get the color value on the light map baked into your level.

Use the entitycolor() command in blitz to set the color of the entity to whatever color value you retrieved from that function above.

Keep looking around the forums, there was some demo source a long time ago that does just what you are asking and its commented very well.

Good luck,
Scott


Ben(t)(Posted 2007) [#10]
okay now I get it, thanks!