Getting started on a toon shader

Posted By: Keith B [Ambit]

Getting started on a toon shader - 12/07/03 22:51

Hi,

Having never played with shaders or advanced DirectX stuff before, I've been browsing this forum for tips on getting started on a toon shader, and I admit I am still at a loss. I have found the following cel chading examples on the old intraweb and would like to have a crack at using them in 3dgs:

Cartoon Shading in DirectX 8.0 Using Vertex Shaders (MSDN)

GameDev Cel-Shading Introduction

Cel Shading Torus Example

Frankly, I don't know where to begin - this is in a different league to normal C-scripting. Could anyone point me in the direction of a good basic tutorial on using/creating/converting shaders? Or is that plain impossible because of the complex nature of DirectX and shaders? (Just a shader example with a breakdown-guide to what all the code does and why it is needed etc would be a nice start.) Could anyone just give me some basic tips or help on where to begin with converting the above examples for use with DirectX?

This is like being a newbie again.

Many thanks,
Keith
Posted By: ventilator

Re: Getting started on a toon shader - 12/08/03 04:52

i would start with the shader fundamentals (follow the link) to get a basic understanding of shaders. -> http://www.shaderx.com/direct3d.net/index.html

btw. here is another nice toonshading tutorial -> http://www.gamedev.net/reference/programming/features/cartoon/ but i guess the inker part currently wouldn't work with a6...
Posted By: Nadester

Re: Getting started on a toon shader - 12/09/03 06:00

I am also doing some work on toon shaders. Check out "Biyu Biyu Rocket" in the Showcase II section to see a basic cel-vertex shader done in 3DGS. I am downloading that last example you posted... looks interesting. I actually did a conversion of the MSDN one, but its a really bad example because it does not display textures.... makes it nearly imposible to figure out how to.

Here is a shot of my MSDN toon conversion:
[image]http://axelgames.tripod.com/bumpmap.txt[/image]

Here is a shot of Alex Esslinger's toon shader for 3dgs:


Here is a shot of BBR using a modification of Alexander's shader in order to fit my game:


EDIT: I took a look at that 3rd example of toon shading that you posted. That really is a great one, plus he put in some nice doumentation of the actual shader. I am going to give the conversion a whirl, and if its something decent, I'll post it.

Good Luck!
Posted By: Drew

Re: Getting started on a toon shader - 12/09/03 11:17

thats cool looks great...please share it!!


Posted By: ello

Re: Getting started on a toon shader - 12/09/03 16:32

there is also information on:
http://www.codeworx.org/directx_tuts_dd6_3.php
Posted By: Nadester

Re: Getting started on a toon shader - 12/09/03 22:52

Oops! I gaveyou a link to my bump mapping instead of my MSDN shader conversion. Here it is:

[image]http://axelgames.tripod.com/cel.txt[/image]

That is also a very decent example ello. But it is in German, which may be a disadvantage for some of us. (Although the code can still be ripped from the page).
Posted By: Zerodin

Re: Getting started on a toon shader - 12/11/03 11:11

This all is sounding and more importantly looking VERY promising!

Posted By: Keith B [Ambit]

Re: Getting started on a toon shader - 12/12/03 02:59

Hi,

Thanks for the replies and all the information, I appreciate it muchly. Although I've never touched anything as advanced as shaders before, I'm going to go through what you've given me at the weekend and have a crack at it (any other info or examples are always welcome).

Nadester - I saw your game on Showcase II and meant to post over there that it looks excellent, but I must have forgot. In fact, that was what inspired me to try my hand at a cartoon shader. Until I saw that I hadn't even realised that it was possible as I know nothing about shaders - I was intending to fake the effect by painting shadows on the textures like in Fear Effect 2 - very old fashioned! If you manage to convert the above example before me, I'd love to see the results.

Is it currently not possible to create black lines around objects using shaders? (I know you can fake it using an extra model with inverted normals, but that doubles your polycount.)

Thanks!
Keith
Posted By: Captain_Kiyaku

Re: Getting started on a toon shader - 12/23/03 20:38

Hi,

i get A6 Com tommorow, and i have a question.

how can i use the cell shader code from this page http://www.paulsprojects.net/direct3d/celshading/celshading.html in 3DGS?


Bye
Posted By: Nadester

Re: Getting started on a toon shader - 01/01/04 03:20

Thank you Keith!

@Tsumi&Keith, As for that shader example, I am not quite sure if that renders the model's UV. If it doesn't, then that makes it a big problem because(like the MSDN example) it would most likelly be using the ot0 for the actual cartoon part. So then you would be stuck with using ot1 for the UV, which means you would have to use a pixel shader the blend ot0 and ot1 (the lighting and the texture). This is what I tried to do with teh example MSDN put out, but I was stuck because my comp is limited to vertex shaders. Btw, my example didn't use the fixed function pipeline. But anyways, Alexander Esslinger managed to make the shader w/o pixel shaders, and he shared it with me. His uses a 1D image for the lighting transition. This allows you to get any type of lighting effect you want, including a better realism. All you have to do is edit the image, and it can be colored as well. Not only does his work with the sunlight, but it also was scripted to have an additional dynamic light that can be set up. You should ask him about it!
© 2024 lite-C Forums