Help : Proper cubemap for static lighting

Community Forums/General Help/Help : Proper cubemap for static lighting

RifRaf(Posted 2009) [#1]
Im trying to find a free cubemap, or a guide to make a cubemap for static toon lighting. Ive hacked one of my own together that works on all curved surfaces, but fails on sharp , 90 degree corners.

If anyone can help, or point me to a useful article on drawing such a cubemap I would appreciate it. Ive googled for hours and found nothing that can help. Most ppl just use shaders, wich I cant do in B3D.

What I really want to acheive is this
click image link.
http://wili.cc/softography/3d-engine/toon_shade.jpg?


my hacked together cubemap


The results im getting with my cubemap aligned with the lightsource is



Ross C(Posted 2009) [#2]
Have you tried the old spheremap trick for toon shading? Basically a black square, with a white circle, ALMOST touching the edges?


RifRaf(Posted 2009) [#3]
old spheremap trick for toon shading? Basically a black square, with a white circle


Ross,

Isnt that for simulating outlines? I want to use a cubemap because fastext lets me align the cubemap to a light to simulate shading from the proper direction.


Ross C(Posted 2009) [#4]
Ah right, sorry, i though you were after the outline for the toon shading :S

I will have a play about with this though, i'm sure i can get what you need.


Ross C(Posted 2009) [#5]
Have you read this thread?

http://www.blitzbasic.com/Community/posts.php?topic=34792

sswift decribes a way to use a cubemap for cell shading.


Ross C(Posted 2009) [#6]
Ok, after much messing about and releasing i have lost the fastlibs..., and using the above websites i posted, i am wondering why you have the highlight part of the light, on the right side of your cubemap. Surely if you can align the cubemap to a particular direction, then you should have the hightlight, and the solid shades on the front of the cubemap?


Ross C(Posted 2009) [#7]
Hey, i think i might have it now. Can you provide me with a model to test? I have my own models, but i guess it needs to be suitable for your's. I'm still tweaking it, but it looks like this so far:




Ross C(Posted 2009) [#8]
Also, what blend mode are you using for the cubemap? Again, it effects how dark the colours need to be. I looks like your using textureblend mode 2?


Ross C(Posted 2009) [#9]
Ok, i think i got what you need. I'm not entirely sure, as i don't have any models you use, and i've tried to use the same colours as your orginal one you posted.

The cubemap mode is set to mode 1, but, i think for lighting, you'd probably want mode 2, so it doesn't look so shiney. I dunno :) Texture blend on the cubemap is set to normal multiply mode.

http://www.rosscrooks.pwp.blueyonder.co.uk/toon_shade.zip

TBH though, i'd be happy if the shading was more rounded, but i'm finding it hard to curve the shading, to fit on the cube.


RifRaf(Posted 2009) [#10]
ross, sorry for not responding. sheesh my browser didnt show a new hit on the topic until today.. ill check that out. thank you !


RifRaf(Posted 2009) [#11]
You nailed it!
I havent put in in tiny tanks yet, but that is one sweet toony teapot, thanks again


RifRaf(Posted 2009) [#12]
hmm. been fiddling with it, but I cant seem to edit it properly to have the light from straight above in the cubemap. :)

edit:
Disregard my ramblings, the one you have made will work great, thanks.


Ross C(Posted 2009) [#13]
Sorry, i just made it from straight on, as i thought you could rotate the cubemap. I'm glad it works though :) How does it look in the game?


RifRaf(Posted 2009) [#14]
Looks great Ross, ill post a shot once ive tweaked it some, I also allow vertex lighting via dx lights , so the combo is hard to get right.


RifRaf(Posted 2009) [#15]
ok, still tweaking but here it is now. you can see the cubemap on the tank, scenery, and crosshair



Ross C(Posted 2009) [#16]
Seems to work ok there. I can tweak the cubemap further, if you need more bands of colours, or less, or you need them further apart. Gfx looking sweet btw!


RifRaf(Posted 2009) [#17]
thanks, I think the cubemap is ok as it is, but if you have other variations I wouldnt mind taking a peek