Projective Texures on older Radeon cards

Started by
5 comments, last by MARS_999 17 years, 9 months ago
I am working on supporting older Radeon (8500 - 9200) and I have run into a problem when doing projective texturing. The problem is also that I don't own a card so testing is quite tedious. I am doing texturing like this. First I am using this vertex program:

void main(	float4 position : POSITION,
			float3 normal : NORMAL,
			float3 uv	   : TEXCOORD0,
			float4 tangent : TEXCOORD1,
					  
			out float4 oPosition	: POSITION,
			out float4 oLightColor	: COLOR,
			
			out float3 oUv			: TEXCOORD0,
			out float4 oSpotlightUv	: TEXCOORD1,
			out float oRejectUv		: TEXCOORD2,
		  				
			uniform float4x4 worldViewProj,
			uniform float4x4 spotViewProj,
			
			uniform float3 LightPos,
			uniform float4 LightColor,
			uniform float3 LightDirMul)
{
	oPosition = mul(worldViewProj, position);

	oUv = uv;
	oSpotlightUv = mul(spotViewProj,position);
	oRejectUv.x = oSpotlightUv.z + 0.5;

	oLightColor = LightColor;
}



and I am using a modulative texture enviroment (no fragment shader used). This is how it looks on my comp (GF 6800GT): and here is how it looks on a Radeon 9200 The thing is that this works on Geforce 4Ti and if I change the vertex program to: out float3 oSpotlightUv : TEXCOORD1, [...] oUv = uv; oSpotlightUv = uv; It all works as predicted, ie the normal texture get modulated with the spotlight but without any projection. My idea is that the Radeon for some reason does not divide the x,y and z coords of oSpotlightUv before getting the color from the projective texture. But I have no idea why that is so. It seems like I reproduce the error on my own card if I write: out float3 oSpotlightUv : TEXCOORD1, I am in bad need of help with this. Thanks in advance!
Advertisement
So I have dwelved further into this problem and now I am 99% what the problem is.

In the images below I have set wrap mode to repeat and turned off lighting.

A screen from Radeon 9200

In the screen below
"out float4 oSpotlightUv : TEXCOORD1,"
is replaced with
"out float2 oSpotlightUv : TEXCOORD1,"

A screen from GF 6800GT

This means that the problem must be that texture coords are not diveded by z.

Does anyone know if there is some special ATI TexEnv(..) state to set for this to work?
I am not sure if you are using a fragment shader which I am assuming no due to you are on a 9200 which doens't support FS. You can look into ati_text_fragmentshader? it is assembly, but you could modify your texture coordinates there. If not on the FS then I would guess you need to upload the correct values to your texture coordinates before sending them to openGL...
It will not be very easy to implement Ati_fragment_shader since I don't have an ATI card :(

And it is not possible to calculate the values in the vertex shader since the values are not linear and not possible to interpolate (as far as I know at least).
Quote:Original post by Hardguy
It will not be very easy to implement Ati_fragment_shader since I don't have an ATI card :(

And it is not possible to calculate the values in the vertex shader since the values are not linear and not possible to interpolate (as far as I know at least).


Sure you do Radeon 9200 is made by ATI last time I checked...
The images from Radeon 9200 is not from my computer :) Having some other people testing if older Radeons are supported.
Quote:Original post by Hardguy
The images from Radeon 9200 is not from my computer :) Having some other people testing if older Radeons are supported.


Ok, that makes sense. ;)

This topic is closed to new replies.

Advertisement