Toon shading without shaders?
BlitzMax Forums/MiniB3D Module/Toon shading without shaders?
| ||
Using latest MiniB3B version, is it possible to get a good toon effect without shaders? (I'm not speaking about the black lines around a model, I'm on about the shades/lightning) Something like this: There are lots of tutorials about this, but since I'm new to 3D AND BlitzMax/MiniB3D I find them very hard to follow. >_> Here's one for example: http://www.gamedev.net/reference/programming/features/celshading/ So does anyone have any example of this and is it even possible? :S |
| ||
I've never used MiniB3d, but cubemaps can give you the effect that you're looking for in Blitz3d. |
| ||
You got any examples of that? I might be able to convert it to MiniB3D/BlitzMax. |
| ||
Try this: This is a more advanced version of something I used for my Bongo game. It's based on some code by sswift. Call the CelShader() function to setup cel shading (or change the number of shades your using) then use CelShade() or AnimatedCelShade() functions to apply it to your models. For debugging, just call the LinearGradient() function after RenderWorld to see the texture used in the Cel Shading functions. Hope that all makes sense, been awhile since I used it :) |
| ||
Cheers mate! Now I just have to convert it to BlitzMax and I'm terrible at Blitz3D code lol -_- |
| ||
Note: that's Blitz3D code. |
| ||
Yep should have mentioned that it is Blitz3D code. It shouldn't be too hard to convert over to BlitzMax/MiniB3D tho... |
| ||
Yeah I got it working, thanks a lot mate! :D |
| ||
You're welcome :) |
| ||
Would you care to post the ported code? I could convert it to BMax as well, but if you've already done it... |
| ||
I guess that's a "no." Share the wealth... |
| ||
I started converting it too. I've gotten the outlining bit of the code to work, but not the shading effect. (Everything compiles and works but the texture that is created and mapped to my objects doesn't seem to work right yet.) If I get it working fully I will post it but since it didn't take long to get this much going you might be able to get it all going yourself faster than waiting. |
| ||
Sorry I've been having computer problems lately... I didn't convert the texture generating code, I made it simple for me and just loaded a premade texture instead. Also I didn't need it for animated objects, so I simplified the code a lot. |
| ||
No prob... looks like I'll be diving in then.... |
| ||
Huh... I can't get it to work on B3D, much less MiniB3D. I must be doing something wrong. Do I need to call CelShader() outside the main loop, then AnimatedCelShade(model) in the loop before RenderWorld? |
| ||
Only call AnimatedCelShade() before the main loop (after CelShader() is used) or when you have changed the number of shades used in CelShader(). AnimatedCelShade() is used for models loaded with LoadAnimMesh but don't use models with bone animation (play my Bongo game and watch closely to see why). |
| ||
I have done some very basic looking toon shading in NSS4 using cube maps... http://www.blitzbasic.com/Community/posts.php?topic=77969 |