Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
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
1 registered members (Ayumi), 900 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Toon shader & fog colors? #373855
06/13/11 18:06
06/13/11 18:06
Joined: Apr 2011
Posts: 67
Balkan
Pavle Offline OP
Junior Member
Pavle  Offline OP
Junior Member

Joined: Apr 2011
Posts: 67
Balkan
Does anyone knows how I can prevent toon shader outlines from taking the color of the active fog?


>>Demos free3DModels Tutorials<<
>>>>>>> by Pavle Nikolic <<<<<<<
Re: Toon shader & fog colors? [Re: Pavle] #373857
06/13/11 18:21
06/13/11 18:21
Joined: Mar 2006
Posts: 2,252
Hummel Offline
Expert
Hummel  Offline
Expert

Joined: Mar 2006
Posts: 2,252
Modify the shader.

Re: Toon shader & fog colors? [Re: Hummel] #373861
06/13/11 19:19
06/13/11 19:19
Joined: Apr 2011
Posts: 67
Balkan
Pavle Offline OP
Junior Member
Pavle  Offline OP
Junior Member

Joined: Apr 2011
Posts: 67
Balkan
I tried excluding everything but transform from it but it didn't work. The color changing was still happening:(

Is it possible to sett manually outline color to 0,0,0 directly in shader?

Last edited by Pavle; 06/13/11 19:20.

>>Demos free3DModels Tutorials<<
>>>>>>> by Pavle Nikolic <<<<<<<
Re: Toon shader & fog colors? [Re: Pavle] #373873
06/13/11 20:52
06/13/11 20:52
Joined: Mar 2006
Posts: 2,252
Hummel Offline
Expert
Hummel  Offline
Expert

Joined: Mar 2006
Posts: 2,252
It is.

Re: Toon shader & fog colors? [Re: Hummel] #373879
06/13/11 21:07
06/13/11 21:07
Joined: Apr 2011
Posts: 67
Balkan
Pavle Offline OP
Junior Member
Pavle  Offline OP
Junior Member

Joined: Apr 2011
Posts: 67
Balkan
Ha,ha, great:) So if it's not a secret that could endanger my life or a life of another person involved, and if the knowledge of these things can be passed in a form of a text, could you perhaps help out?:):)


>>Demos free3DModels Tutorials<<
>>>>>>> by Pavle Nikolic <<<<<<<
Re: Toon shader & fog colors? [Re: Pavle] #373884
06/13/11 21:38
06/13/11 21:38
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
color = float4(0.0f, 0.0f, 0.0f, 1.0f);
laugh

Re: Toon shader & fog colors? [Re: Slin] #373885
06/13/11 21:49
06/13/11 21:49
Joined: Apr 2011
Posts: 67
Balkan
Pavle Offline OP
Junior Member
Pavle  Offline OP
Junior Member

Joined: Apr 2011
Posts: 67
Balkan
Thanx, I'll try that:)


>>Demos free3DModels Tutorials<<
>>>>>>> by Pavle Nikolic <<<<<<<
Re: Toon shader & fog colors? [Re: Pavle] #373888
06/13/11 22:10
06/13/11 22:10
Joined: Mar 2006
Posts: 2,252
Hummel Offline
Expert
Hummel  Offline
Expert

Joined: Mar 2006
Posts: 2,252
The easiest way would has been if you had posted the shader code you are using together with your first question.

Re: Toon shader & fog colors? [Re: Hummel] #373890
06/13/11 22:22
06/13/11 22:22
Joined: Apr 2011
Posts: 67
Balkan
Pavle Offline OP
Junior Member
Pavle  Offline OP
Junior Member

Joined: Apr 2011
Posts: 67
Balkan
It seems that I'm still doing something wrong because it didn't work:(

This is the standard toon fx with the modification marked in red:
Click to reveal..
#include <transform>
#include <fog>
#include <pos>
#include <normal>
#include <tangent>
#include <light>

float4 vecLight;

float4 vecSkill41;
float4 COLOR = float4(0.0f, 0.0f, 0.0f, 1.0f);
texture entSkin1; // texture
sampler sBaseTex = sampler_state { Texture = <entSkin1>; MipFilter = Linear; };

struct toonOut
{
float4 Pos: POSITION;
float Fog: FOG;
float4 Color: COLOR;
float4 Ambient:COLOR1;
float2 Tex: TEXCOORD0;
float3 Normal: TEXCOORD1;
float3 Light: TEXCOORD2;
};

toonOut toonVS(
in float4 inPos: POSITION,
in float3 inNormal: NORMAL,
in float2 inTex: TEXCOORD0,
in float3 inTangent: TEXCOORD2)
{
toonOut Out;
Out.Pos = DoTransform(inPos);
Out.Tex = inTex;
Out.Fog = DoFog(inPos);

float facAmbient = vecSkill41.x / 100.;
Out.Ambient = facAmbient*vecLight;

CreateTangents(inNormal,inTangent);
float3 P = DoPos(inPos);

float3 lightVec;
lightVec = normalize(vecLightPos[0].xyz - P);
Out.Color = vecLightColor[0];

Out.Light = DoTangent(lightVec) * 0.5 + 0.5;
Out.Normal = DoTangent(DoPos(inNormal)) * 0.5 + 0.5;

return Out;
}

float4 toonPS(toonOut In): COLOR
{
float4 base = tex2D(sBaseTex,In.Tex);

float intensity = dot(In.Light*2 - 1,In.Normal*2 - 1);

float light;
if (intensity > 0.85 )
light = 1.;
else if (intensity > 0.35 )
light = 0.55;
else
light = 0.05;

return base * (light*In.Color + In.Ambient);
}

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] = <vecSkill41.y/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
};
}
}

technique fallback { pass one { } }


..and the shorter version (your suggestion) that I'm also using:
Click to reveal..
#include <transform>

float4 vecSkill41;

technique toon
{

pass outlines
{
CULLMODE=CW;
vertexShaderConstant[0] = <matWorldViewProj>;
vertexShaderConstant[16] = <vecSkill41.y/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
};
}
}



>>Demos free3DModels Tutorials<<
>>>>>>> by Pavle Nikolic <<<<<<<
Re: Toon shader & fog colors? [Re: Pavle] #373895
06/13/11 23:01
06/13/11 23:01
Joined: Mar 2006
Posts: 2,252
Hummel Offline
Expert
Hummel  Offline
Expert

Joined: Mar 2006
Posts: 2,252
hm strange, try to modfiy it this way:
Click to reveal..
pass two
{
CULLMODE=CW;
vertexShaderConstant[0] = <matWorldViewProj>;
vertexShaderConstant[16] = <vecSkill41.y/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
};

PixelShader = null;
}


Page 1 of 2 1 2

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