I’m trying to design a game that has a hand drawn cartoony feel. I don’t believe standard Toon Shaders from Maya will work in Unity iPhone, so is there a way to convert imported 2D art into controllable game objects? Thanks!
Are you trying to use 3D models which have a toon shader?
Or cartoony 2D images as game objects? You could always put the image on a plane with alpha channel transparency, and the plane would be your game object, which you could then add components to.
I would like to use 3d models with toon shaders, but the shaders don’t import. If I have to I can use alpha textures, but is there a different way?
good texturing is your best guess
shaders don’t exist on the iphone, so the short answer is: there is no way (the regular way with dublicate geometry, invert faces and just draw it black is no option due to the polygon budget you have)
Does the iPhone version of Unity support multiple cameras? Maybe there’s a way to use depth layering to facilitate the generation of object outlining by displaying a normally textured object over a slightly larger all-black object with it’s animation synced with the normal object.
Also, a trick you could use would be to make the shading part of the texture itself. I’ve noticed in anime, the implied lighting position is always kept to the front of the characters and slightly above the head, regardless of that characters actual position relative to the rest of the environment.
Like one say the only good way is the inverted normal way.
Apart from raising the polygcount. It’s very good on the iPhone PovVR chip as the deferred renderer will render it with no extra fillrate consumtion which is very good.
I would in that case opt for a more stylized (which it still probalby is with cartoon stlye) hard edged polygon models to keep polycount low.
" Maybe there’s a way to use depth layering to facilitate the generation of object outlining by displaying a normally textured object over a slightly larger all-black object with it’s animation synced with the normal object."
Why do that? it’s esential the same as the inverted normal vay but seems much more complicated?
"
Also, a trick you could use would be to make the shading part of the texture itself. I’ve noticed in anime, the implied lighting position is always kept to the front of the characters and slightly above the head, regardless of that characters actual position relative to the rest of the environment."
I don’t think the problem is lighting baking. Which indeed is the way to “light” cartoon style gfx. But I feel the problem is he wants edge outline (please confirm) and that can be painted on typical har edge object (like boxes drawers etc) but impossible with inkonvex objects.
I would to like this.
Try to build the background with konvex object. And bake the edge ouline and lighting into the texture.
On the animated (presumable character) I would keep it VERY light in polycount, make a slightly larger copy of it. Invert its normal. and attach and skin it.
Make that object with now texture to further increase performance. If you want the outline to be the more elegant typiycally darker verision of the mesh color, just shade it with baked VC.
Also do some performance stress test with object with baked outlines and inverted normals.
In fact it could be quicker to have double meshes with shared textures and group them together reducing draw calls.
I am also going to do a 2D cell style game when the one I am working on is done so it would be nice to hear you results.
Good Luck.
I was initially going for a 2D cartoon feel. What I tried was a basic toon shader in Maya with really hard outlines to bring out the “hand drawn” look. Unfortunately iPhone doesn’t like this
I toyed around with the alpha texture idea and that seems to work out pretty good. I’ll probably end up drawing all the graphics in Photoshop and then applying the transparency to the models. Thanks for the help, I’ll be sure to let you guys know how this goes!
Along these lines, based on the work you guys have done so far, how realistic would it be to get a zelda ‘phantom hourglass’ quality and style on the iphone? They use a toon shading (of sorts) in that game. Would iPhone Unity be capable of such a look?
Thanks!
With some very talented artists and good optimization in your world setup to work within the restricted polygon budget, yupp doable.
the NDS is slower and has the weaker GPU but nintendo likely has a dozen to a tousand times more talent at its hand for such a project than we do.
You can achieve toon-like shading on iPhone by using spherical environment maps. Start with single colored envmap texture and put a white circle in the center, then texture your object using SphereMap texture generation mode. You can experiment with the texture to achieve desired effect.
Shader "EnvMap" {
Properties {
_EnvMap ("EnvMap", 2D) = "black" { TexGen SphereMap }
}
SubShader {
Pass {
Name "BASE"
BindChannels {
Bind "Vertex", vertex
Bind "normal", normal
}
SetTexture [_EnvMap] {
combine texture
}
}
}
Fallback off
}
Now getting toon outlines can be harder. There is an old presentation from nVidia describing technique doable on the iPhone: http://developer.nvidia.com/object/toon_shading_geforce256.html. But it would take single pass (2 texture combiners) to achieve just an outline.
However if you could render your characters in orthographic or close to orthographic projection (small FOV angle), then outline, shading and texturing is achievable in 1 pass.
Thanks for all the help guys, I’m slowly but surely getting the effect I’m after. I’m now having trouble scripting a side scroller camera :roll: any ideas?
Awesome. The ‘outline’ part isn’t such a big component in the Phantom Hourglass / Windwaker style anyway. It’s mainly expressed by using primary colors and simple textures:
Look at link in the first pic - no outline - just simple shading:
Hey, ReJ… I know this is question is late to the thread, but I’m hoping you’re still around.
In your example, what exactly would the resulting “look” be? I am looking to get a harder edged and more granular shading effect on my objects for my iPhone project, would the example you posted achieve that?
I’m basically just trying to get objects to appear like this:
http://www.whitespacecg.com/content/TSTest.mov
This will give you some idea of how it would look. forgive the crappy focus and cracked iphone glass
Depending on how you edit the environment map, you can make the shading harder or softer, add a fake specular hilight, etc. You could easily make something like the pic above.
We did outlines in Rebolt. We just manually did what the standard toon shader does–we modeled the outlines in the source assets (duplicate the faces, extrude, flip the normals) and mapped them to a dark space on the texture map.
Pluses: You can selectively remove detail of outlines in some high-detail areas (so you have less than 2x as many vertices).
Minuses: Line thickness will change based on distance to object, since it is part of the mesh.
A better example with environment mapping and duplicated geometry:
Very nice noradninja and all
Could you maybe post a project or package with an example of how to achieve that?
Sure thing.
A lot of it comes down to having a good environment map for what you want to do, and having a good model to make the outline. This model is not optimized at all for iPhone use, (like 9 FPS) so beware.
If you press play in the Editor, the model will turn 360 degrees.
IMHO, in this instance, you don’t need the outline, it looks more like the original game art without it.
143507–5235–$tstest_115.unitypackage (1.39 MB)
I am a bit late but have you had the opportunity to upload this example? Wanna apply this to a 2D game that is being planned…
I am a bit late but have you had the opportunity to upload this example? Wanna apply this to a 2D game that is being planned…
If you download the link above you can import the package into Unity to see how I put this together.