Need help with ello's simplegold shader

Posted By: Specterdragon

Need help with ello's simplegold shader - 08/07/05 03:15

Hey all (and ello if your listening),

I'm trying to get ello's simplegold shader to function. Sadly, the assembly looses me when I try to use the FX file (or even hardcode it for that matter) I get a string of errors about "uninitialized component(*)"... ok, I've gathered from looking at this that it may need an upgrade from DX8 to DX9 as I've heard there are differences in the ASM code.

Does anyone have a working DX9 version of this shader and or the equivilent shader in HLSL format (which I'd prefer so that I can play with settings and understand better what I'm looking at)? This is a nice simple shader with great impact and I'd love to be able to use it.
Posted By: Matt_Aufderheide

Re: Need help with ello's simplegold shader - 08/07/05 06:52

post the code.. it shouldnt be hard to convert to hlsl
Posted By: Specterdragon

Re: Need help with ello's simplegold shader - 08/07/05 12:23

Here is the code I downloaded off of ello's website:

Code:
 
//simple gold
// uses a grey randomnoise texture
//created by ello 2004
//visit www.earthcontrol.de
//its kinda easy to change the material color and shinyness

texture mtlSkin1;
matrix matWorldViewProj;
matrix matWorld;
vector vecViewDir;
vector vecViewPos;
vector vecSunDir;
technique secondset{
pass p0 {
// Cullmode=0;
texture[0]=<mtlSkin1>;
AlphaBlendEnable=1;
BlendOp=1;
VertexShaderConstant[0]=<matWorldViewProj>;
VertexShaderConstant[4]=<matWorld>;
VertexShaderConstant[12]=<vecViewPos>;
VertexShaderConstant[13]=<vecSunDir>;
VertexShaderConstant[14]=<vecViewDir>;
VertexShaderConstant[20]={1,3,2,2};
VertexShader=
decl {
stream 0;
float v0[3];
float v1[3];
float v2[3];
}
asm {
vs.1.1
m4x4 oPos,v0,c0

m3x3 r0,v1,c4
m4x4 oT1,r0,c14
mul oD0,r0,c14
mul r0,r0,c20
mul oT0,v2,r0

};

PixelShaderConstant[0]={0.67,0.58,0.06,1.0}; //gold

PixelShader=
asm {
ps.1.4
texld r0,t0
texcrd r1.xyz,t1.xyz
dp3 r2,r1_bx2,r0 //use r0_bx2 for brighter reflex
add r0,r0,r0
add_sat r3,r0,r2
lrp r0,r2,1-r3,r0
add_x2 r0,r0_bias,v0
dp3 r0.b,r0,r0
mul r0,r0,c0
};
}

}



Posted By: Lion_Ts

Re: Need help with ello's simplegold shader - 08/08/05 13:57

remove decl{} section and add this in asm {} section:
Code:

vs.1.1
dcl_position v0;
dcl_tangent v1;
dcl_binormal v2;
m4x4 oPos, v0,c0;
.
.
.


May be You need to redefine constants {1,3,2,2} -> {1.0f,3.0f,2.0f,2.0f}
and add Fog calculations if You have it in your game.
Posted By: Specterdragon

Re: Need help with ello's simplegold shader - 08/08/05 22:23

Tried that already, but for what it's worth, here's the code snippit as it is now from the decl{}

Code:
 
VertexShaderConstant[20]={1.0f,3.0f,2.0f,2.0f};
VertexShader=
decl {
vs.1.1
dcl_position v0;
dcl_tangent v1;
dcl_binormal v2;
m4x4 oPos, v0,c0;
}
asm {
vs.1.1
m4x4 oPos,v0,c0

m3x3 r0,v1,c4
m4x4 oT1,r0,c14
mul oD0,r0,c14
mul r0,r0,c20
mul oT0,v2,r0

};



Still receiving
"error X5326: Read of uninitialized component(*) in v0: *x/0 *y/1 *z/2 *w/3"

And this error repeats for at least 6 more lines with various registers until the error warning window runs out of room.
Posted By: Rhuarc

Re: Need help with ello's simplegold shader - 08/08/05 22:56

Like this:
Code:
 
VertexShaderConstant[20]={1.0f,3.0f,2.0f,2.0f};
VertexShader=
asm {
vs.1.1
dcl_position v0;
dcl_tangent v1;
dcl_binormal v2;
m4x4 oPos, v0,c0;

m3x3 r0,v1,c4
m4x4 oT1,r0,c14
mul oD0,r0,c14
mul r0,r0,c20
mul oT0,v2,r0

};



-Rhuarc
Posted By: Nadester

Re: Need help with ello's simplegold shader - 08/09/05 19:01

Still might not work (though I could be wrong). We were trying to convert another one of his similiar shaders, and me nor him were able to get the DX9 version to work. Was quite strange
Posted By: Specterdragon

Re: Need help with ello's simplegold shader - 08/10/05 00:32

Perhaps...

I've made the sugested changes, but I'm still getting the same error (though not as many now) plus a new error about the lrp command.

Starting to think I may have to learn the ASM and convert it to HLSL unless someone here is ambisious enough to assist me with that?
Posted By: ello

Re: Need help with ello's simplegold shader - 08/10/05 06:44

try:
Code:

//simple gold
// uses a grey randomnoise texture
//created by ello 2004
//visit www.earthcontrol.de
//its kinda easy to change the material color and shinyness

texture mtlSkin1;
matrix matWorldViewProj;
matrix matWorld;
vector vecViewDir;
vector vecViewPos;
vector vecSunDir;
technique secondset{
pass p0 {
texture[0]=<mtlSkin1>;
VertexShaderConstant[0]=<matWorldViewProj>;
VertexShaderConstant[4]=<matWorld>;
VertexShaderConstant[12]=<vecViewPos>;
VertexShaderConstant[13]=<vecSunDir>;
VertexShaderConstant[14]=<vecViewDir>;
VertexShaderConstant[20]={1,3,2,2};
VertexShaderConstant[24]={0.1,0.05,0.01,0.005};
VertexShader=
asm {
vs_1_1
dcl_position v0
dcl_normal v3
dcl_texcoord v7

m4x4 oPos,v0,c0

m3x3 r0,v3,c4
m4x4 oT1,r0.xyz,c14
mul oD0,r0.xyz,c14
mul r0,r0.xyz,c20
mul r1,v7,r0
mul oT0,r1,c24.x

};

PixelShaderConstant[0]={0.67,0.58,0.06,1.0}; //gold

PixelShader=
asm {
ps_1_4
texld r0,t0
texcrd r1.xyz,t1.xyz
dp3 r2,r1,r0 //use r0_bx2 for brighter reflex
add r0,r0,r0
add_sat r3,r0,r2
lrp r0,r2,1-r3,r0
add_x2 r0,r0,v0
dp3 r0.b,r0,r0
mul r0,r0,c0
};
}

}



i made some changes which i dont know why i had to do so, but its at least looking nearly like it should and get you into the right direction.
it hardly depends on a seamless uv_map for your model
Posted By: Lion_Ts

Re: Need help with ello's simplegold shader - 08/10/05 11:55

Thanks, ELLO !
You find free time to help us. You are good guy. Like a Robin
Posted By: Specterdragon

Re: Need help with ello's simplegold shader - 08/10/05 17:43

Quote:

i made some changes which i dont know why i had to do so, but its at least looking nearly like it should and get you into the right direction.
it hardly depends on a seamless uv_map for your model




I apreciate the assist because I really liked the pics of the effect. OK, so I've coppied this into an FX file and tried it through that. Now I have a completely black image, so I was thinking that it could be a fog related issue and added enablefog=false to the beginning of the technique. that improved the look by adding dark reds and greens to the extrema verticle surfaces.

By "seamless UV_map" does that mean that the UV for the model's verts has to be alligned so that it covers the entire surface as a single mesh? If so, how do you get around more complex objects that would be hard to unwrap into a single plane?
Posted By: ello

Re: Need help with ello's simplegold shader - 08/11/05 06:28

if you like to, you can send me a link for your model and i can try to create the goldshader for you.
just dont give me a deadline
Posted By: Specterdragon

Re: Need help with ello's simplegold shader - 08/11/05 11:43

Well, to be honest, I didn't have a spcific model in mind. I was trying it on EVERYTHING LOL... terrain, buildings I downloaded from the net, simple polyhedrons, etc. So any working example would be sufficient becuaes I have failed to make one that works *chuchles*

As to deadlines?? I definetly know how that goes... I'm supposed to be working with the MySQL plugin, getting the basics of that down and instead I'm here trying to turn lead into gold.
© 2024 lite-C Forums