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
3 registered members (AndrewAMD, Grant, Neb), 908 guests, and 6 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
Frage zu Shader Textur offset #405953
08/11/12 12:18
08/11/12 12:18
Joined: Mar 2010
Posts: 6
I
ich Offline OP
Newbie
ich  Offline OP
Newbie
I

Joined: Mar 2010
Posts: 6
Hallo ihr lieben,

kurze frage. Wie bekommt man es hin eine textur mittels HLSL Shader den offset zu verschieben. Ein kurzes code beispiel liegt bei aber das funktioniert nicht!

Hoffe ihr könnt mir helfen danke im vorraus!

float4x4 matWorldViewProj;



Texture entSkin1;

sampler gColorSampler = sampler_state {
Texture = <entSkin1>;
MinFilter = Linear;
MipFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};

struct appdata {
float3 Position : POSITION;
float4 UV : TEXCOORD0;
float4 Normal : NORMAL0;
};

struct texposVertexOutput
{
float4 HPosition : POSITION;
float2 UV : TEXCOORD0;
};


texposVertexOutput DiffTexVS(appdata IN, uniform float4x4 matWorldViewProj)
{
texposVertexOutput OUT = (texposVertexOutput)0;
float4 Po = float4(IN.Position.xyz,1.0);
float4 Nn = normalize(IN.Normal);
OUT.HPosition = mul(Po,matWorldViewProj);
float2 nuv = IN.UV.xy;
OUT.UV = float2(nuv.x + 5.00, nuv.y + 6.00);

return OUT;
}

float4 DiffTexPS(texposVertexOutput IN,uniform sampler2D ColorSampler) : COLOR
{
return tex2D(ColorSampler,IN.UV);
}

technique maine
{
pass p0
{
VertexShader = compile vs_3_0 DiffTexVS(matWorldViewProj);

PixelShader = compile ps_3_0 DiffTexPS(gColorSampler);
}
}


Last edited by ich; 08/11/12 12:25.
Re: Frage zu Shader Textur offset [Re: ich] #405954
08/11/12 12:47
08/11/12 12:47
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Inwiefern funktioniert es denn nicht? Du verschiebst die UV Koordinaten, welche sich im Intervall [0,1] befinden, um ganzzahlige Werte, sprich 0.45 + 5.00 = 5.45 entspricht 0.45. Setze andere Werte ein, testweise bspw. auch vecSkill41 oder vecTime.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Frage zu Shader Textur offset [Re: Superku] #405965
08/11/12 17:47
08/11/12 17:47
Joined: Mar 2010
Posts: 6
I
ich Offline OP
Newbie
ich  Offline OP
Newbie
I

Joined: Mar 2010
Posts: 6
hat sich erledigt, habe es hinbekommen ein logischer denkfehler 5 oder 6 usw geht ja nicht wie du schon sagtes der wert geht ja nur bis 1.00 hier nochmal die richtige darstellung des codes

////////////////////////////////////////////
// lite c - Datei
////////////////////////////////////////////
#include <acknex.h>
#include <default.c>


action test()
{
MATERIAL* mate =
{
effect = "f.fx";
}
my.material = mate;
}

function main()
{

level_load("");

my = ent_create("wuerfel.mdl",vector(0,0,0),test);

}
////////////////////////////////////////////////////
// FX _ Datei
////////////////////////////////////////////////////
float4x4 matWorldViewProj;

Texture entSkin1;

sampler gColorSampler = sampler_state {
Texture = <entSkin1>;
MinFilter = Linear;
MipFilter = Linear;
MagFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};

struct appdata {
float3 Position : POSITION;
float4 UV : TEXCOORD0;
float4 Normal : NORMAL0;
};

struct texposVertexOutput
{
float4 HPosition : POSITION;
float2 UV : TEXCOORD0;
};


texposVertexOutput DiffTexVS(appdata IN, uniform float4x4 matWorldViewProj)
{
texposVertexOutput OUT = (texposVertexOutput)0;
float4 Po = float4(IN.Position.xyz,1.0);
float4 Nn = normalize(IN.Normal);
OUT.HPosition = mul(Po,matWorldViewProj);
float2 nuv = IN.UV.xy;
nuv.x += 0.2; // max 0.00 bis 1.00
nuv.y += 0.9; // max 0.00 bis 1.00
OUT.UV = float2(nuv.x, nuv.y);

return OUT;
}

float4 DiffTexPS(texposVertexOutput IN,uniform sampler2D ColorSampler) : COLOR
{
return tex2D(ColorSampler,IN.UV);
}

technique maine
{
pass p0
{
VertexShader = compile vs_3_0 DiffTexVS(matWorldViewProj);

PixelShader = compile ps_3_0 DiffTexPS(gColorSampler);
}
}


Last edited by ich; 08/11/12 18:07.

Moderated by  adoado, checkbutton, mk_1, Perro 

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