Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
1 registered members (Grant), 999 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Newbie Creature Model Problems #93691
10/09/06 13:39
10/09/06 13:39
Joined: Apr 2006
Posts: 29
cvanniekerk Offline OP
Newbie
cvanniekerk  Offline OP
Newbie

Joined: Apr 2006
Posts: 29
Hi

I have recently finished a creature model that i plan on using in a demo project. but as is to be expected, things aren't quite what they're supposed to be.
The model is a subdivisions model converted to polygons built in Maya 4.
When the model is placed in WED the lighting on the model isnt quite what i expected.
I am using a shader to do phong lighting.

What could be the possible causes for the anomalies? See pics below:

[image]http://img2.freeimagehosting.net/image.php?87487c6f51.jpg[/image]
[image]http://img2.freeimagehosting.net/image.php?a2f0510331.jpg[/image]

also, here is the shader code, perhaps the problem is there?

Code:
  

float4x4 matView ;
float4x4 matWorldViewProj;
float4x4 matWorld;
float4 vecLightPos[8];
float4 vecLightColor[8];

struct VS_OUTPUT
{
float4 Pos : POSITION;
float3 Norm : TEXCOORD0;
float3 Light : TEXCOORD2;
float2 Tex : TEXCOORD4;
};
VS_OUTPUT Textured_Phong_Illumination_Single_Pass_Vertex_Shader_main(
float4 inPos : POSITION,
float3 inNorm : NORMAL,
float2 inTex : TEXCOORD0 )
{
VS_OUTPUT Out = (VS_OUTPUT) 0;

Out.Pos = mul( inPos, matWorldViewProj );

Out.Tex = inTex;

float3 Pview = mul( inPos, matWorld );

float3 llight = Pview-vecLightPos[1];

Out.Light = normalize( -llight);

Out.Norm = normalize( mul( inNorm, matWorld ) );

return Out;
}

float4 ambient = ( 0.93, 0.94, 0.94, 1.00 );
float4 diffuse = ( 0.84, 0.86, 0.89, 1.00 );
float4 specular = ( 1.00, 0.96, 0.67, 1.00 );
float n_specular = 7.00;
float Ka = 0.10;
float Ks = 1.00;
float Kd = 4.00;

texture entSkin1;
sampler baseMap = sampler_state
{
Texture = (entSkin1);
MAGFILTER = LINEAR;
MINFILTER = LINEAR;
};
float4 Textured_Phong_Illumination_Single_Pass_Pixel_Shader_main( float4 Diff : COLOR0,
float3 Normal : TEXCOORD0,
float3 View : TEXCOORD1,
float3 Light : TEXCOORD2,
float2 Tex : TEXCOORD4 ) : COLOR
{
float3 vReflect = normalize( 2 * dot( Normal, Light) * Normal - Light );

float4 AmbientColor = ambient * Ka;

float4 DiffuseColor = vecLightColor[1] * Kd * max( 0, dot( Normal, Light ));

float4 SpecularColor = specular * Ks * pow( max( 0, dot(vReflect, View)), n_specular );

float4 FinalColor;
float4 ad = (AmbientColor + DiffuseColor) * tex2D( baseMap, Tex) + SpecularColor;
FinalColor = ad;

float DFactor;
float D = length(vecLightPos[1].xyz)/vecLightPos[1].w;
if (D < 0.0)
DFactor = 1.0 - D;

FinalColor *= DFactor;

return FinalColor;
}

technique Textured_Phong_Illumination
{
pass Single_Pass
{
VertexShader = compile vs_1_1 Textured_Phong_Illumination_Single_Pass_Vertex_Shader_main();
PixelShader = compile ps_2_0 Textured_Phong_Illumination_Single_Pass_Pixel_Shader_main();
}

}




Last edited by cvanniekerk; 10/09/06 13:53.
Re: Newbie Creature Model Problems [Re: cvanniekerk] #93692
10/09/06 14:03
10/09/06 14:03
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
User

Joined: Jan 2006
Posts: 968
I dont think this belongs in the showcase


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: Newbie Creature Model Problems [Re: EpsiloN] #93693
10/09/06 14:11
10/09/06 14:11
Joined: Oct 2005
Posts: 4,771
Bay City, MI
lostclimate Offline
Expert
lostclimate  Offline
Expert

Joined: Oct 2005
Posts: 4,771
Bay City, MI
well it could be one of two things tho.... your virtices arent welded, or that is just a stencil shadow, in that case turn my.cast on and it wont self-shadow with hard edges

Re: Newbie Creature Model Problems [Re: lostclimate] #93694
10/09/06 14:13
10/09/06 14:13
Joined: Apr 2006
Posts: 29
cvanniekerk Offline OP
Newbie
cvanniekerk  Offline OP
Newbie

Joined: Apr 2006
Posts: 29
that screenshot is with my.cast = OFF. but i know what you mean about the shadows.

Re: Newbie Creature Model Problems [Re: cvanniekerk] #93695
10/09/06 14:19
10/09/06 14:19
Joined: Oct 2005
Posts: 4,771
Bay City, MI
lostclimate Offline
Expert
lostclimate  Offline
Expert

Joined: Oct 2005
Posts: 4,771
Bay City, MI
try it with cast on, cast on makes it so it will leave a shadow on the ground but not self light, useful for lights and such so a light wont have a large shadow across it.

Re: Newbie Creature Model Problems [Re: lostclimate] #93696
10/10/06 06:41
10/10/06 06:41
Joined: Apr 2006
Posts: 29
cvanniekerk Offline OP
Newbie
cvanniekerk  Offline OP
Newbie

Joined: Apr 2006
Posts: 29
i turned cast = ON. Others are also saying the vertices in the model need to be welded. Thanks for the help.

Re: Newbie Creature Model Problems [Re: cvanniekerk] #93697
10/10/06 07:03
10/10/06 07:03
Joined: Oct 2005
Posts: 4,771
Bay City, MI
lostclimate Offline
Expert
lostclimate  Offline
Expert

Joined: Oct 2005
Posts: 4,771
Bay City, MI
anytime


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