Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (Kingware, AndrewAMD, AemStones, RealSerious3D, degenerate_762), 837 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Problem w/ toon shader outline #179621
01/24/08 05:37
01/24/08 05:37
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline OP
User
MrCode  Offline OP
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
For some odd reason, when I use the toon shader (used with my own (very simple) material code, copied from the templates directory), The outline changes color depending on the angle of the camera and model.

I'm really no good at (writing) shaders (at least not yet), so could one of you gurus out there help me fix this problem?

(I'm thinking maybe it has something to do with that little bit of asm at the end that does the outline, but I have no idea which parameter changes the color of the outline.)


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Re: Problem w/ toon shader outline [Re: MrCode] #179622
01/24/08 19:53
01/24/08 19:53
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
frazzle Offline
Expert
frazzle  Offline
Expert

Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
Maybe posting the asm snippet would be handy so that users who know asm can guide you in the correct direction But I think you can solve the problem by making the outline dependant to a view like in a Blinn-Phong effect.

Cheers

Frazzle


Antec® Case
Intel® X58 Chipset
Intel® i7 975 Quad Core
8 GB RAM DDR3
SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB
NVIDIA® GeForce GTX 295 Memory 1795GB
Re: Problem w/ toon shader outline [Re: frazzle] #179623
01/25/08 05:21
01/25/08 05:21
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline OP
User
MrCode  Offline OP
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
OK, Check:

Code:

technique toon
{
pass one
{
VertexShader = compile vs_1_1 toonVS();
PixelShader = compile ps_1_4 toonPS();
}
pass two
{
CULLMODE=CW;
vertexShaderConstant[0] = <matWorldViewProj>;
vertexShaderConstant[16] = <10/20.>;

VertexShader = asm
{
vs_1_0
dcl_position v0
dcl_normal v3
dcl_texcoord v7
mov r0,v0
mul r1,c16.x,v3
// Scale the normal
add r0.xyz,r0.xyz,r1.xyz
m4x4 oPos,r0,c0
// Transorm position to clip space
mov oD0, c0
mov r0,c0
};
}
}



That's the whole technique, in case the problem may be more than just the asm.


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Re: Problem w/ toon shader outline [Re: MrCode] #179624
01/25/08 07:18
01/25/08 07:18
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
maybe you'll give hlsl a chance?

here you'll find my ready2use toon shader
http://www.earthcontrol.de/main.php?loc=...p;aktion=listit

and in this thread you'll find the solution to use only the outline:
http://www.coniserver.net/ubbthreads/showflat.php/Cat/0/Number/813095/Main/811388/#Post813095

Re: Problem w/ toon shader outline [Re: MrCode] #179625
01/25/08 19:24
01/25/08 19:24
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
frazzle Offline
Expert
frazzle  Offline
Expert

Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
That's exactly the reason why HLSL was developed, to make code reuse look more structured and readable
Try ello's suggestions since HLSL is more flexible than asm IMHO

Cheers

Frazzle


Antec® Case
Intel® X58 Chipset
Intel® i7 975 Quad Core
8 GB RAM DDR3
SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB
NVIDIA® GeForce GTX 295 Memory 1795GB
Re: Problem w/ toon shader outline [Re: frazzle] #179626
01/26/08 04:06
01/26/08 04:06
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline OP
User
MrCode  Offline OP
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
@ello:

Thanks! One thing, though. Your shader works, but I'm not getting any rough shading fx, like you show in the screenshot on your website. Maybe I could fix this by doing something with the PS_OUTPUT function?


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Re: Problem w/ toon shader outline [Re: MrCode] #179627
01/27/08 06:45
01/27/08 06:45
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline OP
User
MrCode  Offline OP
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
Actually, nvr mind. I improvised: I used the outline_vs and ps functions from your shader, and then copied and pasted them into the other shader code.

(please excuse the bump, my edit time ran out)


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}

Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1