Hello, sorry if i sound obnoxious,but could someone point me the right direction or words to search?
I want to make cartoony FX to use in BGE… but those lineworks…
I don’t know how to generate them but in brute modelling…
I wonder if there’s something more intuitive for these kinds of effects?
Than toon shading.
Can i turn, say, grease pencil into mesh, and draw it frame by frame?
Can i also say, fill in the grease pencil into a flat polygon, like flames or water effects? And then make it appear or disappear for each frames?
Two hacks that are somewhat common (I think) are having lines in the texture itself (for stuff that is seen head-on), and having a copy of the mesh slightly inflated and with reversed normals (so it is inside out, and only the “inside” is seen).
The inside out thing doesn’t always work well though; you gotta test with your models; and obviously, there is a performance hit due to doubling the polycount.
For that first one, I think you might be able to fade the lines based on camera angles; I’m not too familiarized with BGE though.
There is another way to make outlines, but except in some ideal circumstances it doesn’t look quite like classic cartoon outlines; it is based on having a hard change of material when a surface is close to 90 degrees from the view direction (the problem is, that depending on the geometry and view angle, lines will get fatter or thinner, and sometimes even blobby).
But maybe BGE might have a way for you to extract, manipulate and compose silhouettes in real time, I’m not sure. Something like “screen space z-buffer edge detection” or whatever, dunno really.
edit: for this last one, I think a combination of both z-buffer and normal edge detections would be necessary
Ok, seems there is functionality for that last thing (before the quote). It’s called “filter 2d”, and it involves writing GLSL shaders.
I’m not familiar enough with GLSL; but, I think, roughly speaking what you have to do is the following:
Read from the depth buffer (aka z-buffer), and mark all pixels that differ from any of their neighbours by more than a certain threshold with black, and leave the rest white (on a new buffer or whatever, don’t overwrite the depth buffer).
Similarly mark all pixels based on the normal map that differ from it’s neighbors by more than a certain amount (using dot-product I think).
Combine those two images by multiplying one by the other.
Blur the resulting image by an amount equivalent to the thickness of the lines you want.
Use threshold (pixel color > a value) to make all pixels of that image that are not 100% white be 100% black.
Optionally do some antialiasing on that result.
And finally, use it as a mask, the white parts showing the regular rendering, and the black parts your line color.
(things could get complicated if you want more than one line color or thickness though)
Can anyone with GLSL knowledge tell me if that makes sense?