Gamestudio Links
Zorro Links
Newest Posts
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
2 registered members (AbrahamR, 1 invisible), 858 guests, and 6 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
float4x4 projTM : WorldViewProjection; #34453
10/05/04 17:33
10/05/04 17:33
Joined: Aug 2001
Posts: 426
USA
Homey Offline OP
Senior Member
Homey  Offline OP
Senior Member

Joined: Aug 2001
Posts: 426
USA
Code:
 
float4x4 projTM : WorldViewProjection;
float4x4 worldTM : World;
float4x4 worldITTM : WorldIT;
float4 eyePos : WorldEyePosition;



How world these defines translate to Gamestudio, I'm assuming the first two must be:
float4x4 matWorldViewProj;
float4x4 matWorld;
Mabey??

How would the other two be written?
Even a better question I guess is how would all four be written to work with Gamestudio?

Thanks in advance

Re: float4x4 projTM : WorldViewProjection; [Re: Homey] #34454
10/06/04 03:34
10/06/04 03:34
Joined: Oct 2004
Posts: 2
godlikemouse Offline
Guest
godlikemouse  Offline
Guest

Joined: Oct 2004
Posts: 2
float4x4 projTM : WorldViewProjection;
float4x4 worldTM : World;
float4x4 worldITTM : WorldIT;
float4 eyePos : WorldEyePosition;

should translate in GStudio6 to:

matrix projTM;
matrix worldTM;
matrix worldITTM;
vector eyePos;

I believe that's right, hope it helps...
-GodLikeMouse

Re: float4x4 projTM : WorldViewProjection; [Re: godlikemouse] #34455
10/06/04 04:08
10/06/04 04:08
Joined: Dec 2003
Posts: 1,097
Maryland, USA
Steempipe Offline
Serious User
Steempipe  Offline
Serious User

Joined: Dec 2003
Posts: 1,097
Maryland, USA
// Gstudio format matrices

float4x4 matWorldViewProj;
float4x4 matWorld;
float4x4 matMtl; // inverse transpose of matWorld (WorldIT)
float4 vecViewPos;


matrix matWorldViewProj;
matrix matWorld;
matrix matMtl; // see above
vector vecViewPos;


Note: To aquire the <WorldIT> you will have to do some matrix operations.

Last edited by Steempipe; 10/06/04 04:11.
Re: float4x4 projTM : WorldViewProjection; [Re: Steempipe] #34456
10/06/04 11:26
10/06/04 11:26
Joined: Aug 2001
Posts: 426
USA
Homey Offline OP
Senior Member
Homey  Offline OP
Senior Member

Joined: Aug 2001
Posts: 426
USA
Thanks for the response guys.

What I'm trying to figure out is just how much conversion
is needed to get an HLSL shader from say rendermonkey to GS.

Here's an example of a simple shader that places a texture on a model:

Code:
  

bmap tilemap = <tile033.tga>;

Material mat_hlsltest
{
skin1 = tilemap;

effect = "

// Uniform Parameters
float4x4 matWorldViewProj : WorldViewProjection;
texture mtlSkin1;
//float4x4 matWorldViewProj;

struct Technique1_Pass1_VS_OUT
{
float4 position : POSITION;
float2 uv0 : TEXCOORD0;
};

struct Technique1_Pass1_PS_OUT
{
float4 color : COLOR0;
};

// Samplers
sampler2D TextureSampler = sampler_state
{
Texture = (mtlSkin1);
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = LINEAR;
};


// Functions
Technique1_Pass1_VS_OUT Technique1_Pass1_VS(
float3 pos : POSITION,
float2 uv0 : TEXCOORD0,
uniform float4x4 matWorldViewProj)
{
Technique1_Pass1_VS_OUT OUT;
OUT.position = mul(float4(pos.xyz, 1), matWorldViewProj);
OUT.uv0 = uv0;
return OUT;
}

Technique1_Pass1_PS_OUT Technique1_Pass1_PS(
float2 uv0 : TEXCOORD0,
uniform sampler2D TextureSampler)
{
Technique1_Pass1_PS_OUT OUT;
OUT.color = tex2D(TextureSampler, uv0.xy);
return OUT;
}


// Techniques
technique Technique1
{
pass P0
{
VertexShader = compile vs_2_0 Technique1_Pass1_VS(matWorldViewProj);
PixelShader = compile ps_2_0 Technique1_Pass1_PS(TextureSampler);
ZEnable = true;
ZWriteEnable = true;
CullMode = CW;
}
}


";

}


action hlsl_tests
{

my.material = mat_hlsltest;

}



While this compiles just fine, the model it is assigned to always shows black. How much conversion would even this very simple example need to get working in Gamestudio?

Thanks
Homey

Re: float4x4 projTM : WorldViewProjection; [Re: Homey] #34457
10/07/04 09:16
10/07/04 09:16
Joined: Dec 2003
Posts: 1,097
Maryland, USA
Steempipe Offline
Serious User
Steempipe  Offline
Serious User

Joined: Dec 2003
Posts: 1,097
Maryland, USA
Ran fine as a material effect on a terrain of mine with no changes after I set <Cullmode=None;> and disabled the entity fog (nofog set true).

First, set the cullmode to None to see what happens, unless you really think you need it.

If still no luck, then goto the entities properties and select "nofog". If the material effect shows, then you will need to:
A). either forget fog all together.
B). Look at my HLSL Cubemapping example to see how you would handle the fog.

Re: float4x4 projTM : WorldViewProjection; [Re: Steempipe] #34458
10/07/04 09:51
10/07/04 09:51
Joined: Aug 2001
Posts: 426
USA
Homey Offline OP
Senior Member
Homey  Offline OP
Senior Member

Joined: Aug 2001
Posts: 426
USA
That works great.
Thanks

Hopfully this will get me started on converting even more complex HLSL, although I'm guessing it gets much more difficult as the shaders get more in depth.

Thanks again


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