• Create Account

### #Actualblueshogun96

Posted 05 January 2014 - 05:55 AM

Okay, sorry for bumping this old thread, but I think I *almost* got it.  Sadly, at one point, I was even closer, and I didn't realize what I had changed, and ended up losing that progress.

But this is it now.  I'm beginning to wonder if it has anything to do with the w component.  I thought converting an assembly shader would be straight forward, but I guess it's not.

[attachment=19294:Screen Shot 2014-01-05 at 1.23.26 AM.png]

[attachment=19295:Screen Shot 2014-01-05 at 1.24.48 AM.png]

The reason I'm so dedicated to this is because I need to get this done by January 18th.

I changed much of my original GLSL converted shader, and it should be much cleaner now.  It's probably some little detail I'm overlooking.  Everything looks warped, as if the perspective is wrong...

/* Vertex attributes */
attribute vec4 v_pos;
attribute vec4 v_normal;
varying float v_tex;

/* Texture sampler */
uniform sampler1D texture;

/* General purpose vectors */
vec4 R0, R1, R2, R3, R4, R5, R6;

/* Constants */
uniform vec4 c8;
uniform vec4 c9;
uniform vec4 c10;
uniform vec4 c11;
uniform vec4 c12;
uniform vec4 c13;
uniform vec4 c14;
uniform vec4 c15;
uniform vec4 c16;
uniform vec4 c17;

/* Matrices */
mat4 mvp = gl_ModelViewProjectionMatrix;
mat3 itmm = gl_NormalMatrix;

void main()
{
R0 = R1 = R2 = R3 = R4 = R5 = R6 = vec4( 0, 0, 0, 1 );
R0.x = ( v_pos.y * c16.x ) + c16.z;

R0.x *= c11.w;
R0.y = exp( R0.x );
R2.x = ( R0.y < c11.y ) ? 1.0 : 0.0;
R2.y = ( R0.y >= c11.y ) ? 1.0 : 0.0;
R2.z = ( R0.y >= c11.y ) ? 1.0 : 0.0;
R2.y = dot( R2, c14.zwzw );
R5 = -R0.y + c10;
R5 = R5 * R5;
R0 = ( c12.xyxy * R5 ) + c12.zwzw;
R0 = ( R0 * R5 ) + c13.xyxy;
R0 = ( R0 * R5 ) + c13.zwzw;
R0 = ( R0 * R5 ) + c14.xyxy;
R0 = ( R0 * R5 ) + c14.zwzw;
R1.x = dot( R0.xyz, -R2.xyz );
//R1.x = cos(R0.x);

R2.x = ( R1.x * c10.w ) + c10.z;

R2.yw = c16.yw;
R3 = v_pos * R2.xyxw;
R4.xyz = v_normal.xyz * R2.yxy;

gl_Position = R3 * mvp;

R5.xyz = R4.xyz * itmm;
R5.xyz = normalize(R5.xyz);
R6.xyz = normalize( c8.xyz + v_pos.xyz );
R6 = R6 * c10.y;

v_tex = dot( R5.xyz, R6.xyz );

gl_FrontColor = gl_Color;
}


Lastly, I read an article about someone who write an ARB_vertex_program -> GLSL converter for Mesa.  I've seen many cross compilers to convert various shader languages, but none for my case so far.  I'm also at the point where I'm considering paying someone \$100 USD to do it due to the sheer frustration I've been having for many months.

Any more ideas?  Thanks.

Shogun.

### #1blueshogun96

Posted 05 January 2014 - 05:53 AM

Okay, sorry for bumping this old thread, but I think I *almost* got it.  Sadly, at one point, I was even closer, and I didn't realize what I had changed, and ended up losing that progress.

But this is it now.  I'm beginning to wonder if it has anything to do with the w component.  I thought converting an assembly shader would be straight forward, but I guess it's not.

[attachment=19294:Screen Shot 2014-01-05 at 1.23.26 AM.png]

[attachment=19295:Screen Shot 2014-01-05 at 1.24.48 AM.png]

The reason I'm so dedicated to this is because I need to get this done by January 18th.

I changed much of my original GLSL converted shader, and it should be much cleaner now.  It's probably some little detail I'm overlooking.  Everything looks warped, as if the perspective is wrong...

/* Vertex attributes */
attribute vec4 v_pos;
attribute vec4 v_normal;
varying float v_tex;

/* Texture sampler */
uniform sampler1D texture;

/* General purpose vectors */
vec4 R0, R1, R2, R3, R4, R5, R6;

/* Constants */
uniform vec4 c8;
uniform vec4 c9;
uniform vec4 c10;
uniform vec4 c11;
uniform vec4 c12;
uniform vec4 c13;
uniform vec4 c14;
uniform vec4 c15;
uniform vec4 c16;
uniform vec4 c17;

/* Matrices */
mat4 mvp = gl_ModelViewProjectionMatrix;
mat3 itmm = gl_NormalMatrix;

void main()
{
R0 = R1 = R2 = R3 = R4 = R5 = R6 = vec4( 0, 0, 0, 1 );
R0.x = ( v_pos.y * c16.x ) + c16.z;

R0.x *= c11.w;
R0.y = exp( R0.x );
R2.x = ( R0.y < c11.y ) ? 1.0 : 0.0;
R2.y = ( R0.y >= c11.y ) ? 1.0 : 0.0;
R2.z = ( R0.y >= c11.y ) ? 1.0 : 0.0;
R2.y = dot( R2, c14.zwzw );
R5 = -R0.y + c10;
R5 = R5 * R5;
R0 = ( c12.xyxy * R5 ) + c12.zwzw;
R0 = ( R0 * R5 ) + c13.xyxy;
R0 = ( R0 * R5 ) + c13.zwzw;
R0 = ( R0 * R5 ) + c14.xyxy;
R0 = ( R0 * R5 ) + c14.zwzw;
R1.x = dot( R0.xyz, -R2.xyz );
//R1.x = cos(R0.x);

R2.x = ( R1.x * c10.w ) + c10.z;

R2.yw = c16.yw;
R3 = v_pos * R2.xyxw;
R4.xyz = v_normal.xyz * R2.yxy;

gl_Position = R3 * mvp;

R5.xyz = R4.xyz * itmm;
R5.xyz = normalize(R5.xyz);
R6.xyz = normalize( c8.xyz + v_pos.xyz );
R6 = R6 * c10.y;

v_tex = dot( R5.xyz, R6.xyz );

gl_FrontColor = gl_Color;
}


Lastly, I read an article about someone who write an ARB_vertex_program -> GLSL converter for Mesa.  I've seen many cross compilers to convert various shader languages, but none for my case so far.

Any more ideas?  Thanks.

Shogun.

PARTNERS