2 registered members (AndrewAMD, 7th_zorro),
1,285
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Copy TEXCOORDS ????
#54616
09/10/05 14:47
09/10/05 14:47
|
Joined: May 2003
Posts: 609 Rattenfängerstadt
Rigoletto
OP
Developer
|
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: ello]
#54618
09/10/05 16:46
09/10/05 16:46
|
Joined: May 2003
Posts: 609 Rattenfängerstadt
Rigoletto
OP
Developer
|
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: Specterdragon]
#54621
09/14/05 01:57
09/14/05 01:57
|
Joined: Mar 2001
Posts: 3,298 Beverly, Massachusetts
Rhuarc
Expert
|
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
|
|
|
|