Cubemap to light a character

Miscellaneous Forums/General Discussion/Cubemap to light a character

Ok, firstly, this IS a general subject, as it must be done in other programming languages, so please don't move it to the blitz3d forums :o) Not as many of the users read that anymore, and i'm desperate for help on this.

I am using a cubemap to light my character correctly, taking all the lighting that around him so he picks it all up. Now, the main issues i'm having, is the cubemap i'm applying to him, is FAR too shiney. Anyone who has seen the thread in the blitzshwcase, under KidX and The Fiction Machine, can see from the screenshots.

I use:

A texture with the details of the character, backpack, face, goggles.

A cubemap, updated to capture his surrounding.

I've used multiple blend. Too dark, and still suffers from the shinyness issues.

I've used add mode. Nope, way too bright...

I've used mod2 blend mode. Again, far to shiney.

I'm looking to apply the cubemap in such a way, that the light is somewhat matted.

Now, in the respect i've tried using sswifts blur texture. It does blur the texture alright, but not enough. The more i blur it, the more slowdown i get. I don't think i could blur it anymore actually.

I've also tried a smaller cubemap, all the way down to 2x2. Now, it somewhat achieves what i'm after, BUT, it's just not detailed enough, in that the light flickers in and out, because of the extremely low texture resolution.

I'm frankly out of ideas now. Does anyone have any other suggestions about using cubemaps for lighting? Mind i'm after a more matt finish.

Thanks for reading.

EDIT - forgot to mention, i have multiple light sources, so the cubemaps seem the easiest way to get as many as light sources as they are, without worrying about finding out how many there are.

Have you tried AmbientLight?

My entire level is lit via lightmaps. So, any dark bits are picked up.

Plus, he will be lit from multiple directions. I really don't want to fall back on vertex lights on my character :o)

the simplest way with lightmaps is entitycolor and vertically picking the lightmap below the character.
Getting the color can be done by using Fredborgs PickedU / PickedV to get the UV coords

Cubemaps potentially could work but would be quite some performance you will have to waste to get it. So you hopefully only have <5 objects that are meant to be done like that.

It looks pretty naff tbh, i've tried this as well thanks. Keep 'em coming :o)

On another topic of lighting, i never knew you could use hardware lights along side normal maps. Very interesting...

you can not use them. They don't general normal colors on the vertices which means that it will be wrong on potentially 5 if not all 6 of 6 axis directions.

Well, if you generate a tangent based normal map, texture your entity, and make all your lights blue, it produces a decent enough effect. The edges aren't correct, but it might pass for me...

Try it out. Arrow keys move the camera around the sphere. I don't really notice much difference using the cubemap colour normals too much.

http://www.rosscrooks.pwp.blueyonder.co.uk/kid-08.zip

I think I've figured out a way for you to do a fast blur, of any blur strength.

1. Render the scene you want at a large size. Say 256x256.
2. Copy this to a texture.
3. Render this texture on a polygon of a smaller size, say 16x16.
4. Copy that to a texture.
5. Use that texture as the blurred version.

This should work because the texture will have mipmaps generarted automatically for it, and rendering the larger texture on the smaller polygon will allow you to grab one of those mipmaps.

Oh, and actually, in both cases the polygon is the same size. It fills the window. You just need to change the viewport size from 256x256 to 16x16.

AND, if you're really clever, you can probably stick several of these textures side by side and render them all at once, but I don't know if that would actually be faster or not, and it would certainly be less generalized and usable in all situations where you need a blurred texture.

I did a little test in photoshop to see if the above would work well, and the results aren't as smooth as a real box blur, since you see the pixels when you scale the image back up, whereas even a box blur will give you pretty smooth results normally, but for your purpouses, it should be sufficient, since what you're mainly worried about is light sources being missed and left out entirely because they're between pixels at extremely low reoslutions, and not whether the lightmap is super smooth.

I'm pretty sure there is a way to do a real box blur in hardware though. Requires two passes like the above, but instead of drawing one copy of the texture, you draw many like my original blur, but only horizontally or vertically for each pass.

Thanks sswift. I'll give that a shot too. I'm currently using vertex lighting for my character. SInce it's only the character that needs lit, i'm managing the hardware lights and moving them to where they are closest, and hiding them if they are not see-able from the players perspective.

Thanks for the suggestion though. I might still use the cubemaps, just for shadowing though only.