Hi,
I'm using the toon shader from the GS wiki but when the camera moves away from the models the outline scales smaller (as is to be expected) and as a result looks very ugly and pixelated. Is there a way to adapt the shader to keep the outline thickness a constant size on screen (based on camera distance perhaps)?
By the way, I'm using A6.
Thanks!
cartoon_baboon
Posted By: ello
Re: Toon shader distance scale - 04/30/08 12:46
yes, you could use
this shader, but instead of using material skilly you could use entity skills and create a function to pass a outline scale value based onto the distance
should be easy to do
Posted By: cartoon_baboon
Re: Toon shader distance scale - 04/30/08 15:47
Hi, thanks for the speedy reply^^.
Sounds like it could work - problem is, I've really got no experience with c-script. Don't suppose I could impose a little more and ask how one would have to adjust the code to get that working?
Thanks
cartoon_baboon
Posted By: Joey
Re: Toon shader distance scale - 04/30/08 17:11
do you know at least *some* c-script?
Posted By: cartoon_baboon
Re: Toon shader distance scale - 05/01/08 07:36
Hi, well I have some experience with c-script and a few years ago I gave it a little try but never got very far - I also know a little of a few other languages but nothing that would let me sort this out^^.
Here's the part that lets you adjust the thickness of the outlines
function dunkelblauedickereLinie()
{
mtl.skill1 = float(0.0);
mtl.skill2 = float(0.0);
mtl.skill3 = float(0.1);
mtl.skill4 = float(1.0);
}
The formula to calculate the scale of something as it gets further away is scale=focallength/(focallength+depth). Once you know how much a model is scaled you just have to multiply the line thickness by (1/scale). But how do I do this in c-script? And what would also be required is to limit the scaling - else when the model get's very far away it'll turn into a weird blob as the lines will start obscuring the model.
Hope someone can help me with this?