wizzo

04-20-2004, 12:15 PM

hi ! i tried to set up vertex_program lighting for the first time, and as i am very much a beginner in vertex program, i took slug production's tutorial to start :

!!ARBvp1.0\

#\n\

# This is a sample ARB Vertex Program\n\

#\n\

ATTRIB iPos = vertex.position;\

ATTRIB iColor = vertex.color;\

# We need 2 texture units to perform the PPL\n\

ATTRIB iTex0 = vertex.texcoord[0];\

ATTRIB iTex1 = vertex.texcoord[1];\

PARAM mvp[4] = { state.matrix.mvp };\

PARAM lightpos = program.env[69];\

PARAM Radiusfactor = program.env[70];\

TEMP tmp;\

OUTPUT oPos = result.position;\

OUTPUT oColor = result.color;\

OUTPUT oTex0 = result.texcoord[0];\

OUTPUT oTex1 = result.texcoord[1];\

# This just does out vertex transform by the modelview projection matrix\n\

DP4 oPos.x, mvp[0], iPos;\

DP4 oPos.y, mvp[1], iPos;\

DP4 oPos.z, mvp[2], iPos;\

DP4 oPos.w, mvp[3], iPos;\

# Write our color out directly\n\

MOV oColor, iColor;\

# Temp Vector from the Light to the Vertex\n\

SUB tmp, vertex.position,lightpos;\

# Scale the light\n\

MUL oTex0, tmp, Radiusfactor;\

# Write out the 1 texture coordinates directly\n\

MOV oTex1, iTex1;\

END

the vertex program works fine : when i render only the lighting pass, it is correct; the same with only the base textured rendering... but when i render both, zfighting artifacts appear

i tried to put some polygon offset on the second pass, and part of the artifact disapeared, but some are still here....

i checked the old post and found the OPTION thingy, but it didnt work for me (the sphere on which i was applying my vp became transparent)

here is a shot of the problem : http://www.ece.fr/~miffre/public/tmp.jpg

if anyone can help, thanks in advance

wizzo

!!ARBvp1.0\

#\n\

# This is a sample ARB Vertex Program\n\

#\n\

ATTRIB iPos = vertex.position;\

ATTRIB iColor = vertex.color;\

# We need 2 texture units to perform the PPL\n\

ATTRIB iTex0 = vertex.texcoord[0];\

ATTRIB iTex1 = vertex.texcoord[1];\

PARAM mvp[4] = { state.matrix.mvp };\

PARAM lightpos = program.env[69];\

PARAM Radiusfactor = program.env[70];\

TEMP tmp;\

OUTPUT oPos = result.position;\

OUTPUT oColor = result.color;\

OUTPUT oTex0 = result.texcoord[0];\

OUTPUT oTex1 = result.texcoord[1];\

# This just does out vertex transform by the modelview projection matrix\n\

DP4 oPos.x, mvp[0], iPos;\

DP4 oPos.y, mvp[1], iPos;\

DP4 oPos.z, mvp[2], iPos;\

DP4 oPos.w, mvp[3], iPos;\

# Write our color out directly\n\

MOV oColor, iColor;\

# Temp Vector from the Light to the Vertex\n\

SUB tmp, vertex.position,lightpos;\

# Scale the light\n\

MUL oTex0, tmp, Radiusfactor;\

# Write out the 1 texture coordinates directly\n\

MOV oTex1, iTex1;\

END

the vertex program works fine : when i render only the lighting pass, it is correct; the same with only the base textured rendering... but when i render both, zfighting artifacts appear

i tried to put some polygon offset on the second pass, and part of the artifact disapeared, but some are still here....

i checked the old post and found the OPTION thingy, but it didnt work for me (the sphere on which i was applying my vp became transparent)

here is a shot of the problem : http://www.ece.fr/~miffre/public/tmp.jpg

if anyone can help, thanks in advance

wizzo