Gamestudio Links
Zorro Links
Newest Posts
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 (7th_zorro), 1,390 guests, and 2 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
Copy TEXCOORDS ???? #54616
09/10/05 14:47
09/10/05 14:47
Joined: May 2003
Posts: 609
Rattenfängerstadt
Rigoletto Offline OP
Developer
Rigoletto  Offline OP
Developer

Joined: May 2003
Posts: 609
Rattenfängerstadt
Hi,

i wan´t to copy TEXCOORD from my base texture to 2 other textures. But i can´t copy it in a PS (I have to do this in VS):

float2 temp;

temp = In.Base.xy; //<- the compiler won´t copy it

color = tex2D( sBase, temp );
shadow = tex2D( sShadow, In.Shadow.xy );
alpha = tex2D( sAlpha, temp );
grass = tex2D( sGrass, temp );

same error as

color = tex2D( sBase, In.Base.xy );
shadow = tex2D( sShadow, In.Shadow.xy );
alpha = tex2D( sAlpha, In.Base.xy );
grass = tex2D( sGrass, In.Base.xy );

I got error X4516, that every sample must have an unique texcoord. (With 2.0 PS it works, 1.0 won´t.)

Is there a special way to really copy a value?

Re: Copy TEXCOORDS ???? [Re: Rigoletto] #54617
09/10/05 16:14
09/10/05 16:14
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
i dont get your question , exactly?? do you mean this:

Out.texCoord0 =In.texCoord;
Out.texCoord1 =Out.texCoord0;


www.earthcontrol.de
quoted: We want to maintain a clean, decent, American family suited forum look... which means you may post zombies or chainsaw massacres, but no erotic.
Re: Copy TEXCOORDS ???? [Re: ello] #54618
09/10/05 16:46
09/10/05 16:46
Joined: May 2003
Posts: 609
Rattenfängerstadt
Rigoletto Offline OP
Developer
Rigoletto  Offline OP
Developer

Joined: May 2003
Posts: 609
Rattenfängerstadt
Yes, i do this in my VS because it did not work in PS.
Why can´t use a temp var to copy and apply that in PS?


Code:


struct PS_IN
{
float2 Shadow : TEXCOORD0;
float2 Base : TEXCOORD1;
float2 Alpha : TEXCOORD2;
float2 Grass : TEXCOORD3;
};

struct VS_OUT
{
float4 Pos : POSITION;
float2 Shadow : TEXCOORD0;
float2 Base : TEXCOORD1;
float2 Alpha : TEXCOORD2;
float2 Grass : TEXCOORD3;
};

//simple vertex shader calculates the vertex position and tex coords
VS_OUT vs( float4 Pos : POSITION,
float2 Shadow : TEXCOORD0,
float2 Base : TEXCOORD1,
float2 Alpha : TEXCOORD2,
float2 Grass : TEXCOORD3 )
{
VS_OUT Out = ( VS_OUT ) 0;
Out.Pos = mul( Pos, matWorldViewProj );

Out.Shadow = Shadow;
Out.Base = Base;
Out.Alpha = Base; //using base, must be done cause they have no coords (they not applied to level geo, only at runtime)
Out.Grass = Base;
return Out;
}

float4 ps( PS_IN In ) : COLOR
{
float4 color;
float4 shadow;
float4 alpha;
float4 grass;

color = tex2D( sBase, In.Base.xy );
shadow = tex2D( sShadow, In.Shadow.xy );
alpha = tex2D( sAlpha, In.Alpha.xy );
grass = tex2D( sGrass, In.Grass.xy );

color = lerp( color, grass, alpha );
color = color * shadow;

return color;
}




Re: Copy TEXCOORDS ???? [Re: Rigoletto] #54619
09/10/05 18:54
09/10/05 18:54
Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Rhuarc Offline
Expert
Rhuarc  Offline
Expert

Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Because PS 1.0-1.3 cannot do dependant texture reads. Basically, you simply cannot change the texture coordinates in the PS, it's just not supported. On the ASM level, all texture reads must be performed on unmodified texture coordinates.

-Rhuarc


I no longer post on these forums, keep in touch with me via:
Linkedin.com
My MSDN blog
Re: Copy TEXCOORDS ???? [Re: Rhuarc] #54620
09/13/05 18:07
09/13/05 18:07
Joined: Aug 2002
Posts: 44
Panama City, FL
S
Specterdragon Offline
Newbie
Specterdragon  Offline
Newbie
S

Joined: Aug 2002
Posts: 44
Panama City, FL
Quote:


Because PS 1.0-1.3 cannot do dependant texture reads. Basically, you simply cannot change the texture coordinates in the PS, it's just not supported. On the ASM level, all texture reads must be performed on unmodified texture coordinates.

-Rhuarc




Correct me if I'm wrong, but wasn't that issue corrected in PS2.0 and higher? I'm (unfortunatly) not at home and can't look at my shader codes, but it seems I had done something like this with a higher version.


Just thinking out loud, Specterdragon
Re: Copy TEXCOORDS ???? [Re: Specterdragon] #54621
09/14/05 01:57
09/14/05 01:57
Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Rhuarc Offline
Expert
Rhuarc  Offline
Expert

Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Quote:

Quote:


Because PS 1.0-1.3 cannot do dependant texture reads. Basically, you simply cannot change the texture coordinates in the PS, it's just not supported. On the ASM level, all texture reads must be performed on unmodified texture coordinates.

-Rhuarc




Correct me if I'm wrong, but wasn't that issue corrected in PS2.0 and higher? I'm (unfortunatly) not at home and can't look at my shader codes, but it seems I had done something like this with a higher version.




That's what I just said... "Because PS 1.0-1.3 cannot do dependant texture reads. " Thus, implying that 1.4+ all support it
-Rhuarc


I no longer post on these forums, keep in touch with me via:
Linkedin.com
My MSDN blog

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