Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Working Cartoon Shader - from UT Shader Thread

Author
Message
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 19th Sep 2006 14:29 Edited at: 19th Sep 2006 14:53
First off note that Im not saying I made this shader, this shader is Neophytes, I only fixed something to get it working and am posting my findings here.

So, the fx file source code;



The problem with Neophytes was where he said "add this new technique underneath the first technique to make it accept textured objects". Instead, just replace the first technique with Neophytes texture-accepting version and it'll work.

Here's some simple source code (you'll need to supply a texture);



And here's the images I use; (they're bitmaps but really small so it shouldnt be too bad)

Edge Image:



To make the black outline around the object bigger, increase the length of black in the edge.bmp.

Shade Image:



Note: The more black you use in the shade image, the better the outcome. In most cases I recommend just using a completely black image, which can be 1px X 1px. However if you'd like an overlay effect, then use some colour starting frmo the right and going to the left as far as you think is good. IMO the more black the better the outcome, however this is only if you're using a textured object, if not then go ahead and throw on any colours you want.


And the base.bmp is whatever texture you'd like.

Using the code above, my own uv mapped object and a texture I threw together, I got this;



I havent changed the lighting so it can look better than that, but its an example.


ALSO:

Cartoon Shading doesnt work well on "hard" objects, things like cubes and plains mainly. To fix this, you have 2 options.

A) Dont use rectangular models

B) Subdivide your models and move them out, sort of "inflating them", the more inflated/sphereical an object is the better the outcome.

HOWEVER: The polycount of the model bares no effect if it's hard, so using a 30000 poly cube will look the same as using a 24 poly cube.

Goodluck,
- RUC'

Your signature has been erased by a mod because it's larger than 600x120...
Nicholas Thompson
19
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 19th Sep 2006 14:37
Looks good! How would you make the line thicker/more pronounced?

[center]
Kentaree
21
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 19th Sep 2006 14:42
I dont have DBP here to test, but try and modify the edge.bmp image to change the outline

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 19th Sep 2006 14:52 Edited at: 19th Sep 2006 15:05
Yep, to make the edge thicker you modify the edge.bmp. Just increase the amount of black (make it go farther right) for a thicker outline;


Ofcourse thats a bit overkill...

<EDIT>

Added tip to main post.

<EDIT 2>

You can get a really cool Sin City effect with the shader along side some nifty rain, Ill post a movie up later if I have time.

Your signature has been erased by a mod because it's larger than 600x120...
Crazy Ninja
18
Years of Service
User Offline
Joined: 27th Aug 2005
Location: Awesometon
Posted: 19th Sep 2006 15:01
cool ruccus! i'll try it out later. Home work calls(and its not a very nice one).

____ ____ ____ ___ _ _ __ _ _ __ _ _ ____
|___ |--< |--| /__ Y | \| | | \| ___| |--|
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 20th Sep 2006 05:42
Ive been trying to get the shader to accept a pre-textured model, whereby you dont have to use the "TEXTURE OBJECT" command in the code since the texture file is saved with the model. This'd make life a lot easier IMO...

I havent gotten it yet, Im trying to understand the texture levels. im pretty sure post-textured objects use the texture on index layer 1, or atleast max does, if anyone can spread some light how how texture layers work, or maybe if someone could give a hint as to how to set an object's current texture to a different level, that'd be great.

Your signature has been erased by a mod because it's larger than 600x120...
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 20th Sep 2006 06:23
For multiple textures basically, layer 0 is the base layer and any texture you use on that is like using texture object, then you can add more layers like 1,2,3 as you have done, then you can use the 'Set Blend Mapping On' command, so set properties as to how each layer interacts with one another, I don't know if you have used photoshop before but this is very similar to the layer styles, if you look at the F1 help file it tells you what they do, though I find the list rather useless and I often make a loop where i press spacebar to pick the next texture mode untill i reach the desired result, to get some effects such as alpha masking you will need to make 2 extra layer and lots of fancy fiddling around, the results can be pretty nice tough, just wish tgc added support for multiple uv layer editing .

Hallowed are the ori.
dab
19
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 20th Sep 2006 17:46
Wow. Thanks. Now I can work on that "top secret" cartoon project we talked about in Game Design Theory Foum.

Your mom has been erased by a mod from you telling too many "your mom" jokes.
Keemo1000
18
Years of Service
User Offline
Joined: 26th May 2005
Location: 28th Dimension
Posted: 22nd Sep 2006 23:18
Sweet. So the FX file is included with my source code? Or is it just a file in my project's folder?


http://forum.thegamecreators.com/?m=forum_view&t=82195&b=8
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 23rd Sep 2006 05:22
The fx file is just like any other media file, keep it where you see fit, just make sure you can access it from the code with the LOAD EFFECT command.

Your signature has been erased by a mod because it's larger than 600x120...
Pus In Boots
18
Years of Service
User Offline
Joined: 5th Nov 2005
Location: S.M.I.L.E. industries
Posted: 1st Nov 2006 21:25
this is just what I need for my cartoon game. The shader has sort of a fur fighters look for it. Thanks

You don't have to be insane to answer my questions, but it helps

visit www.gameshell.tk

Login to post a reply

Server time is: 2024-04-19 17:57:29
Your offset time is: 2024-04-19 17:57:29