spheremapped celshading

Blitz3D Forums/Blitz3D Programming/spheremapped celshading

Lilprog(Posted 2003) [#1]
How is it done and does anybody have any tutorials / sample code?

Rob


DrakeX(Posted 2003) [#2]
make an image in paint. color it grey (128,128,128). then draw a white circle in the top left. it'll like this

.............###
.............###
............####
............####
...........#####
...........#####
........########
.....###########
################
################


where . is white and # is grey.

then save it, and in B3D, loat it like this

celshade=loadtexture("celshade.bmp".1+64)

and texture your objects like this

entitytexture <entity>,celshade,1

and make sure you

entityfx entity,1

and now it'll look celshaded.


jhocking(Posted 2003) [#3]
I don't know about the white circle; never tried that. What I do is similar but the texture image is simply white for the top two-thirds and grey for the bottom third. Furthermore this is layered on top of a normal main texture and set to multiply blend. In other words create a model and texture it normally, create a white-top grey-bottom image for the shading, load the model and set it to fullbright, load the shading image as a spherical environment map, set the shading image to multiply blend, and apply the shading to the model as another layer of texture.


Lilprog(Posted 2003) [#4]
Im sorry, having trouble with this he comes out all white, ive got the image the way you said, here is my code::

; Load md2 texture
orion_tex=LoadTexture( "Models\orionskin.jpg" )
celshade=LoadTexture("Models\celshade.jpg",1+64)

; Apply md2 texture to md2
EntityTexture orion,orion_tex,1,0
EntityTexture orion,celshade,1,1
EntityFX orion,1


Thoughts?


DrakeX(Posted 2003) [#5]
" don't know about the white circle; never tried that. What I do is similar but the texture image is simply white for the top two-thirds and grey for the bottom third."

i've tried that but all i get is a little bit of shading on the bottom of the object and it doesn't look all that great.

lilprog -- change the third param of your entitytexture commands to 0. sorry about that. the third param is the frame of the texture if it's an animated texture, and since they aren't, it comes out all white.


sswift(Posted 2003) [#6]
I've decided to release my cel shading system for free.

It's not the sort of thing which is large or compelx enough for me to actually sell, so lucky you. :-)

DT Smash Test

The system takes 1d textures as imput, basically 1 pixel wide vertical gradients, and turns them into proper spherical maps with correct distortion.

Note that when you use this system, the direction of the light will be in realtion to the orientation of the camera.

In other words, if your light is not directly overhead, and you turn the camera left or right, the apparent direction of the light source will change.

This is a limitation of doing cel shading with spherical maps.

If your light is directly overhead then you can rotate the camera left and right and the ligh's direction will remain consistent. However, this is only true as long as you do not pan the camera up and down.

If you want a camera that points down at an angle, then you will need to transform the light's position by the camera's pitch so that the top of the shading map points more towards the front of the sphere map.

It is hard to explain how to do this, so if you don't understand, don't worry about it. Just tweak the location of the light source until it looks right.

In case you're wondering, the demo above shows a character from something I'm working on with the fellow who does this online comic: http://www.dragon-tails.com/

There's only one model at the moment and he's not animated, but you can see the nice cel shading maps I created. At first I tried to use cel shading maps that just modulated the colors of the underlying model. That would have been the simpler solution. But the result of that was HIDEOUS looking.

My goal was to match the look of the following image:
Dragon Group

As you can see, I succeeded in getting the models to look almost exactly like this hand drawn image, right down to the way the metallic dragons have a special sort of sheen to them.

Of course to see that effect I suppose you'll need to know how to control the demo...

The controls are:
Arrows rotate model
A+Z zoom in and out
1-8 select different textures.

So anyhow, this demo will show you exactly what you need to do to use this cel shading system of mine. It's still a bit of a work in progress, but at this point it's more than adequate for a game.


Skitchy(Posted 2003) [#7]
That is DAMN good sswift. And mightily good of you to release it for free as well. :)


DrakeX(Posted 2003) [#8]
wow that's awesome shawn :) i love your work except for thhe fact that you have to pay for most of it, which really isn't possible if you're not old enough to have a credit card and you have to get permission from your parents to use it online and you only make $7 a week in allowance. no offense but while i would agree that most of your stuff is worth paying for, you have to remember who your audience is..


Anthony Flack(Posted 2003) [#9]
Not young 'uns with no income, for the most part, I guess.


DrakeX(Posted 2003) [#10]
..


sswift(Posted 2003) [#11]
As I've said before, I love to give stuff away. I just am in a bad spot right now and I need the money. :-)


DrakeX(Posted 2003) [#12]
oh well then i can understand :) i wouldn't mind making stuff for some extra money (so i can pick up more than $7 a week hehe), but i don't have l33t skillz like you.


DarkEagle(Posted 2003) [#13]
much like rome wasnt built in a day, sswift didnt have "l33t skillz" when he first started.


Miracle(Posted 2003) [#14]
Dig dig dig dig dig ... ah, here it is:

http://members.cox.net/mirage106/toonshadow.zip

From an ancient discussion. One camera renders an image of a two- or three-tone sphere to a texture, which is applied spheremap-style to another object. If you want to move the lightsource, you just have to rotate the sphere.


sswift(Posted 2003) [#15]
"much like rome wasnt built in a day, sswift didnt have "l33t skillz" when he first started"


I did too!

Yep my first game was a Quake clone on the Ti99/4a.


Michael Reitzenstein(Posted 2003) [#16]
sswift was born chanting the general quadratic formula.


sswift(Posted 2003) [#17]
sswift doesn't even KNOW the general quadratic formula.


ashmantle(Posted 2003) [#18]
even more impressive ;)


Gabriel(Posted 2003) [#19]
sswift doesn't even KNOW the general quadratic formula.


Sure you do. It's just built into your dna, like a genetic memory. So you know it, you just don't know you know it.