Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, exile, Ayumi), 1,085 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
texture lookups problem #62381
01/20/06 14:20
01/20/06 14:20
Joined: Mar 2002
Posts: 221
USA
zefor Offline OP
Member
zefor  Offline OP
Member

Joined: Mar 2002
Posts: 221
USA
what does this mean when converting shaders?

vs1_1 target does not support texture lookups

And is there a work around for it?

Re: texture lookups problem [Re: zefor] #62382
01/20/06 14:25
01/20/06 14:25
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
you mean ps1_1?? well using ps1_4 is a workaround;)


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: texture lookups problem [Re: ello] #62383
01/20/06 14:48
01/20/06 14:48
Joined: Mar 2002
Posts: 221
USA
zefor Offline OP
Member
zefor  Offline OP
Member

Joined: Mar 2002
Posts: 221
USA
This is what I have at the bottom, ps is 2.0

VertexShader = compile vs_1_1 main();
PixelShader = compile ps_2_0 main();

it doesnt like the vertexshader compile line for some reason

Last edited by zefor; 01/20/06 14:49.
Re: texture lookups problem [Re: zefor] #62384
01/20/06 14:49
01/20/06 14:49
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
well, then dont try a texture lookup in the vertexshader. i think this requires shadermodel3.0


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: texture lookups problem [Re: ello] #62385
01/20/06 15:22
01/20/06 15:22
Joined: Mar 2002
Posts: 221
USA
zefor Offline OP
Member
zefor  Offline OP
Member

Joined: Mar 2002
Posts: 221
USA
Would the texture lookup be in the lines that say
Code:

Out.texCoord.x = Pos.x * 0.0065 + 0.46;
Out.texCoord.y = Pos.z * 0.0065 + 0.46;



In this code

Code:

//float4x4 matWorldViewProj;
//float4x4 matWorld;

float4x4 view_proj_matrix: register(c0);
float4x4 view_matrix: register(c4);

texture entSkin1;
texture entSkin2;

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


sampler BumpMapSampler = sampler_state
{
Texture = <entSkin2>;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = Linear;
AddressU = wrap;
AddressV = wrap;
};

struct VS_OUTPUT {
float4 Pos: POSITION;
float2 texCoord: TEXCOORD0;
float3 lightVec: TEXCOORD1;
};

VS_OUTPUT main(float4 Pos: POSITION, float3 normal: NORMAL, float3 tangent: TANGENT, float3 binormal: BINORMAL) {
VS_OUTPUT Out;

Out.Pos = mul(view_proj_matrix, Pos);
//Out.Pos = mul(matWorldViewProj, Pos);

// Some object-linear texgen, specific for this particular model
Out.texCoord.x = Pos.x * 0.0065 + 0.46;
Out.texCoord.y = Pos.z * 0.0065 + 0.46;

float3 Pview = -mul(view_matrix, Pos);
//float3 Pview = -mul(matworld, Pos);

// Move our tangent-space into eye-space
float3 vtang = mul(view_matrix, tangent);
float3 vbinorm = mul(view_matrix, binormal);
float3 vnorm = mul(view_matrix, normal);


// We use lightVec = viewVec, that is, the camera is also the light.
float3 lightVec = Pview;

// Transform light vector from eye-space to tangent-soace
Out.lightVec.x = dot(lightVec, vtang);
Out.lightVec.y = dot(lightVec, vbinorm);
Out.lightVec.z = dot(lightVec, vnorm);

return Out;
}

/////////////////////Pixel Shader
float4 Gold: register(c0);
sampler BaseMap: register(s0);
sampler BumpMap: register(s1);
float4 main(float2 texCoord: TEXCOORD0, float3 lightVec: TEXCOORD1) : COLOR {
float4 base = tex2D(BaseMap, texCoord);
float3 bump = tex2D(BumpMap, texCoord) * 2.0 - 1.0;

// shine = diffuse and specular
float shine = saturate(dot(normalize(lightVec), normalize(bump)));
return (shine * 0.2) * base + pow(shine, 64) * Gold;
}

technique Gold_shine
{
pass p0
{
VertexShader = compile vs_1_1 main();
PixelShader = compile ps_2_0 main();
}
}





Sorry, I am very, Very much a NOOB trying to learn.

Re: texture lookups problem [Re: zefor] #62386
01/20/06 15:36
01/20/06 15:36
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
try:

/////////////////////Pixel Shader
float4 Gold: register(c0);
//sampler BaseMap: register(s0);
//sampler BumpMap: register(s1);
float4 main(float2 texCoord: TEXCOORD0, float3 lightVec: TEXCOORD1) : COLOR {
float4 base = tex2D(ColorMapSampler , texCoord);
float3 bump = tex2D(BumpMapSampler , texCoord) * 2.0 - 1.0;

// shine = diffuse and specular
float shine = saturate(dot(normalize(lightVec), normalize(bump)));
return (shine * 0.2) * base + pow(shine, 64) * Gold;
}


maybe thats the cause for your error. well i am at work and cant check nothing;)


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: texture lookups problem [Re: ello] #62387
01/20/06 19:18
01/20/06 19:18
Joined: Mar 2002
Posts: 221
USA
zefor Offline OP
Member
zefor  Offline OP
Member

Joined: Mar 2002
Posts: 221
USA
Unfortunately, still get the texture lookup error, but thanks for trying.

Re: texture lookups problem [Re: zefor] #62388
01/21/06 04:31
01/21/06 04:31
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
Haha, after stareing at forever I figured out what your problem is...

VertexShader = compile vs_1_1 main();
PixelShader = compile ps_2_0 main();

notice that both your shaders have the same name "main" ..you have to change the names of them to differetn thing like vs_main and ps_main ... you must change them in the technique and also at the actual function decalration like here:
VS_OUTPUT vs_main

this is should solve your problems with compiling.. although i dont think this shader will work right.. you need to change some other things i think..

First, you should go back to the correct matrix names instead of these others.. you need matView, matWorldViewProj etc...
also, i really think A6 doesnt pass in a correct binormal under the BINORMAL coord.. i dont know why, but it doesnt seem to.. in that case you must generate the binormal using a crossproduct.. like cross(tangent,normal)

let me how it works out..


Sphere Engine--the premier A6 graphics plugin.
Re: texture lookups problem [Re: Matt_Aufderheide] #62389
01/21/06 12:44
01/21/06 12:44
Joined: Mar 2002
Posts: 221
USA
zefor Offline OP
Member
zefor  Offline OP
Member

Joined: Mar 2002
Posts: 221
USA
Thank you mat, and I am glad you didnt post the proper "fixed" code for me as I am trying to learn shaders, like how you said you did. I had already changed the matworlviewproj and such, but I did not know I could not have a double "main" technique. I learned something new I also was staring at that BINORMAL and pondering because I had not seen it in other shaders but I didnt know what to do with it. I will let you know how it goes and ask help if I really need it. I'll post the finished product when I am done. This is the "gold shine" shader from rendermonkey, but without the gold. If somebody has already posted this code, please dont tell me
Many Thanks

Re: texture lookups problem [Re: zefor] #62390
01/21/06 13:47
01/21/06 13:47
Joined: Mar 2002
Posts: 221
USA
zefor Offline OP
Member
zefor  Offline OP
Member

Joined: Mar 2002
Posts: 221
USA
the models dissapear and appear right in front of the camera blocking most of your visibility when you point it where the models should be. They are black, but I guess thats because I have not added light yet??? anyway, the lighting effect on the black models looks cool unless it is just a fluke. I will keep banging away at it. feel free to give a pointer, I'm frustrated already

Here is what I have so far:
Code:
 
float4x4 matWorldViewProj: register(c0);
float4x4 matView: register(c4);



texture entSkin1;
texture entSkin2;

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


sampler BumpMapSampler = sampler_state
{
Texture = <entSkin2>;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = Linear;
AddressU = wrap;
AddressV = wrap;
};

struct VS_OUTPUT {
float4 Pos: POSITION;
float2 texCoord: TEXCOORD0;
float3 lightvec: TEXCOORD1;
};

//VS_OUTPUT VS1(float4 Pos: POSITION, float3 normal: NORMAL, float3 tangent: TANGENT, float3 binormal: BINORMAL) {
VS_OUTPUT VS1(float4 Pos: POSITION, float3 normal: NORMAL, float3 tangent: TANGENT) {
VS_OUTPUT Out;

//Out.Pos = mul(view_proj_matrix, Pos);
Out.Pos = mul(matWorldViewProj, Pos);



// Some object-linear texgen, specific for this particular model
Out.texCoord.x = Pos.x * 0.0065 + 0.46;
Out.texCoord.y = Pos.z * 0.0065 + 0.46;



//float3 Pview = -mul(view_matrix, Pos);
float3 Pview = -mul(matView, Pos);

// Move our tangent-space into eye-space

float3 vtang = mul(matView, tangent);
float3 vbinorm = mul(matView, cross(tangent, normal));
float3 vnorm = mul(matView, normal);


// We use lightVec = viewVec, that is, the camera is also the light.
float3 lightvec = Pview;

// Transform light vector from eye-space to tangent-soace
Out.lightvec.x = dot(lightvec, vtang);
Out.lightvec.y = dot(lightvec, vbinorm);
Out.lightvec.z = dot(lightvec, vnorm);

return Out;
}

/////////////////////Pixel Shader


float4 Gold: register(c0);
sampler ColorMap: register(s0);
sampler BumpMap: register(s1);

float4 PS1(float2 texCoord: TEXCOORD0, float3 lightvec: TEXCOORD1) : COLOR {
float4 base = tex2D(ColorMapSampler, texCoord);
float3 bump = tex2D(BumpMapSampler, texCoord) * 2.0 - 1.0;

// shine = diffuse and specular
float shine = saturate(dot(normalize(lightvec), normalize(bump)));
return (shine * 0.2) * base + pow(shine, 64) * Gold;
}


technique Gold_shine
{
pass p0
{
VertexShader = compile vs_1_1 VS1();
PixelShader = compile ps_2_0 PS1();
}
}





I think the lines below this comment are whats messing it up as far as the camera.
// Move our tangent-space into eye-space

Last edited by zefor; 01/21/06 13:48.
Page 1 of 3 1 2 3

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