Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 20:05
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 (AndrewAMD, kzhao), 901 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Move skin/material #328293
06/11/10 17:18
06/11/10 17:18
Joined: Apr 2007
Posts: 141
Germany
Timothy Offline OP
Member
Timothy  Offline OP
Member

Joined: Apr 2007
Posts: 141
Germany
Hi,

I want to move one out of 3 skins/materials of my model via u,v.
Since using "my.v += 20;" or "my.u += 20;" moves every 3 skins/materials, I have to find another solution to only move skin2 to a certain direction.
Is this possible and if yes, how?
I already searched in the manual and the forum, but couldn't find anything similar.

Thanks in advance,

Timothy

Re: Move skin/material [Re: Timothy] #328297
06/11/10 17:35
06/11/10 17:35
Joined: Apr 2010
Posts: 265
V
Vinous_Beret Offline
Member
Vinous_Beret  Offline
Member
V

Joined: Apr 2010
Posts: 265
I think this is only possible via SHADERS.
but sorry ,am not a shader programer frown

Re: Move skin/material [Re: Vinous_Beret] #328298
06/11/10 17:42
06/11/10 17:42
Joined: Apr 2007
Posts: 141
Germany
Timothy Offline OP
Member
Timothy  Offline OP
Member

Joined: Apr 2007
Posts: 141
Germany
Thanks for your answer! I searched and found skin-shift shader in the shader library. Maybe I can modify it to work the way I want it.

Re: Move skin/material [Re: Timothy] #328300
06/11/10 18:06
06/11/10 18:06
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
In the shader you want to use the 'entSkin2' (entity skin 2) or 'mtlSkin2' (material skin 2) texture.

The way to scroll/shift the texture is to change the texture coordinates.

In the pixel shader there will probably be something like this...
Code:
return tex2D(sampler,inTex);


...so just modify the 'inTex' parameter...
Code:
float2 coords = float2(inTex.x + 0.5, inTex.y); // example shift in x
return tex2D(sampler,coords);



Last edited by DJBMASTER; 06/11/10 18:42.
Re: Move skin/material [Re: DJBMASTER] #328304
06/11/10 18:32
06/11/10 18:32
Joined: Apr 2007
Posts: 141
Germany
Timothy Offline OP
Member
Timothy  Offline OP
Member

Joined: Apr 2007
Posts: 141
Germany
Also thank you for your suggestion! But how should I use your given code parts? Are they for a new shader or for an existing one? I only know small parts about the shader basics.

I think I have to define "texture mtlSkin2;", the technique and one pass?

Re: Move skin/material [Re: Timothy] #328305
06/11/10 18:49
06/11/10 18:49
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Here, try this simple shader. Play around with the values of the 'coords' variable to shift the texture...
Code:
const matrix<float,4,4> matWorldViewProj;

texture entSkin2;

sampler map_sampler = sampler_state
{
Texture = <entSkin2>;
};

void ShiftPass_VS
(
in float4 inPos : POSITION0,in float2 inTex : TEXCOORD0,
out float4 outPos : POSITION0,out float2 outTex : TEXCOORD0
)
{
outPos = mul(inPos, matWorldViewProj);
outTex = inTex;
}

float4 ShiftPass_PS(in float2 inTex : TEXCOORD0) : COLOR
{
// play with these values
float2 coords = float2(inTex.x + 0.5,inTex.y);

return tex2D(map_sampler,coords);
}

technique ShaderTechnique 
{
pass ShiftPass
{
VertexShader = compile vs_2_0 ShiftPass_VS();
PixelShader = compile ps_2_0 ShiftPass_PS();
}
}

technique fallback { pass one { } }


Texture coordinates lie within the range 0..1.

Last edited by DJBMASTER; 06/11/10 18:52.
Re: Move skin/material [Re: DJBMASTER] #328307
06/11/10 19:17
06/11/10 19:17
Joined: Apr 2007
Posts: 141
Germany
Timothy Offline OP
Member
Timothy  Offline OP
Member

Joined: Apr 2007
Posts: 141
Germany
Thank you very very much! smile


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