News:

One Minute Game Review by The Happy Friar: https://ugetube.com/@OneMinteGameReviews
Also on Rumble: https://rumble.com/c/c-1115371

idTech 4 (aka Doom 3 tech) Discord Server! https://discord.gg/9wtCGHa

Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Bladeghost

#31
glprogs:
interaction.vfp and test.vfp posted below:

interaction.vfp
###==============================================================================
# Doom 3 Interaction Vertex/Fragment Program
#
# Cook-Torrance Lighting Model w/ Relief Mapping (Isotropic)
###==============================================================================
#
# --------------------------------------
# input:
#
# attrib[8] = texture coordinates
# attrib[9] = global tangent
# attrib[10] = global bitangent
# attrib[11] = global normal
#
# env[0]  = diffuse modifier
# env[1]  = specular modifier
# env[2]  = ?
# env[3]  = ?
# env[4]  = localLightOrigin
# env[5] = localViewOrigin
# env[6] = lightProjection S
# env[7] = lightProjection T
# env[8] = lightProjection Q
# env[9] = lightFalloff S
# env[10] = bumpMatrix S
# env[11] = bumpMatrix T
# env[12] = diffuseMatrix S
# env[13] = diffuseMatrix T
# env[14] = specularMatrix S
# env[15] = specularMatrix T
# env[16] = vertex color modulate
# env[17] = vertex color add
#
#--------------------------------------
# output:
#
# texture 0 = normalization cube map
# texture 1 = per-surface normal map
# texture 2 = 1D light falloff texture
# texture 3 = 2D light projection texture
# texture 4 = per-surface diffuse map
# texture 5 = per-surface specular map
# texture 6 = specular lookup table
#
#--------------------------------------
###==============================================================================

!!ARBvp1.0
OPTION ARB_position_invariant;

# Instruction Count: 25

PARAM defaultTexCoord = { 0.0, 0.5, 0.0, 1.0 };
PARAM projMatrix[4] = { state.matrix.projection };

TEMP R0;

# calculate vector to light in R0
SUB R0, program.env[4], vertex.position;

# put into texture space for TEX0
DP3 result.texcoord[0].x, vertex.attrib[9], R0;
DP3 result.texcoord[0].y, vertex.attrib[10], R0;
DP3 result.texcoord[0].z, vertex.attrib[11], R0;

# texture 1 takes the base coordinates by the texture matrix
MOV result.texcoord[1], defaultTexCoord;
DP4 result.texcoord[1].x, vertex.attrib[8], program.env[10];
DP4 result.texcoord[1].y, vertex.attrib[8], program.env[11];

# texture 2 has one texgen
MOV result.texcoord[2], defaultTexCoord;
DP4 result.texcoord[2].x, vertex.position, program.env[9];

# texture 3 has three texgens
DP4 result.texcoord[3].x, vertex.position, program.env[6];
DP4 result.texcoord[3].y, vertex.position, program.env[7];
DP4 result.texcoord[3].w, vertex.position, program.env[8];

# texture 4 takes the base coordinates by the texture matrix
MOV result.texcoord[4], defaultTexCoord;
DP4 result.texcoord[4].x, vertex.attrib[8], program.env[12];
DP4 result.texcoord[4].y, vertex.attrib[8], program.env[13];

# texture 5 takes the base coordinates by the texture matrix
MOV result.texcoord[5], defaultTexCoord;
DP4 result.texcoord[5].x, vertex.attrib[8], program.env[14];
DP4 result.texcoord[5].y, vertex.attrib[8], program.env[15];

# calculate vector to viewer in R0
SUB R0, program.env[5], vertex.position;

# put into texture space for TEX6
DP3 result.texcoord[6].x, vertex.attrib[9], R0;
DP3 result.texcoord[6].y, vertex.attrib[10], R0;
DP3 result.texcoord[6].z, vertex.attrib[11], R0;

# transform world space normal vector
DP3 result.texcoord[7].x, vertex.attrib[9], projMatrix[2];
DP3 result.texcoord[7].y, vertex.attrib[10], projMatrix[2];
DP3 result.texcoord[7].z, vertex.attrib[11], projMatrix[2];

# generate the vertex color, which can be 1.0, color, or 1.0 - color
# for 1.0 : env[16] =  0.0, env[17] = 1.0
# for color : env[16] =  1.0, env[17] = 0.0
# for 1.0 - color : env[16] = -1.0, env[17] = 1.0
MAD result.color, vertex.color, program.env[16], program.env[17];

END

#==================================================================================

!!ARBfp1.0
OPTION ARB_precision_hint_fastest;

# Instruction Count: ALU: 145 TEX: 27 Total: 172

OUTPUT oColor = result.color;
ATTRIB vColor = fragment.color;

ATTRIB lightVecTC = fragment.texcoord[0];
ATTRIB normalTC = fragment.texcoord[1];
ATTRIB lightFallTC = fragment.texcoord[2];
ATTRIB lightProjTC = fragment.texcoord[3];
ATTRIB diffuseTC = fragment.texcoord[4];
ATTRIB specularTC = fragment.texcoord[5];
ATTRIB viewVecTC = fragment.texcoord[6];
ATTRIB wNormal = fragment.texcoord[7];

PARAM lightColor = program.env[0];

PARAM constval = { 1.0,    2.0,    4.0,    5.0  };
PARAM constval2 = { 0.125,  0.25,   0.5,    0.75 };
PARAM grayscale = { 0.3,    0.59,   0.11  };
PARAM hemiLight = { 0.25,   0.25,  -1.0   };
PARAM skyColor = { 0.5,    0.5,    0.5   };
PARAM grndColor = { 1.0,    1.0,    1.0   };
PARAM epsilon = { 1.0,    0.0,    0.0   };
PARAM specParm = { 0.2,    0.1,    0.425 };
PARAM e = { 2.7182818284590452353602874713527 };
PARAM reliefParm = { 0.0425, 0.0625 };

TEMP RT;
TEMP lightVec, viewVec, halfVec, normalVec, wNormalVec;
TEMP diffuse, specular, gloss, color, ambient;
TEMP light, hemi, atten, rim, lightFall, lightProj;
TEMP geometric, roughness, fresnel;
TEMP NdotA, NdotL, NdotV, NdotH, VdotH, VdotL;
TEMP R1, R2;


#[FPO] relief mapping: view vector with depth factor
###======================================================================
DP3 viewVec, viewVecTC, viewVecTC;
RSQ viewVec, viewVec.x;
MUL viewVec, viewVec.x, viewVecTC;

RCP R1.x, viewVec.z; # R1 = 1.0 / viewVec.z
MUL viewVec.xy, viewVec, reliefParm.x; # viewVec.xy *= depth
MUL viewVec, viewVec, -R1.x; # viewVec *= -R1
MUL viewVec, viewVec, reliefParm.y; # viewVec /= 16.0

MOV RT, normalTC; # RT = texcoord
MOV RT.z, constval.x; # RT.z = 1.0

#[FPO] relief mapping: linear search (15 steps)
###======================================================================
TEX R1, RT, texture[5], 2D; # R1 = tex(RT)
SLT R2.w, R1.w, RT.z; # if ( R1.w < RT.z )
MAD RT, viewVec, R2.w, RT; # RT += viewVec;

TEX R1, RT, texture[5], 2D; # R1 = tex(RT)
SLT R2.w, R1.w, RT.z; # if ( R1.w < RT.z )
MAD RT, viewVec, R2.w, RT; # RT += viewVec;

TEX R1, RT, texture[5], 2D; # R1 = tex(RT)
SLT R2.w, R1.w, RT.z; # if ( R1.w < RT.z )
MAD RT, viewVec, R2.w, RT; # RT += viewVec;

TEX R1, RT, texture[5], 2D; # R1 = tex(RT)
SLT R2.w, R1.w, RT.z; # if ( R1.w < RT.z )
MAD RT, viewVec, R2.w, RT; # RT += viewVec;

TEX R1, RT, texture[5], 2D; # R1 = tex(RT)
SLT R2.w, R1.w, RT.z; # if ( R1.w < RT.z )
MAD RT, viewVec, R2.w, RT; # RT += viewVec;

TEX R1, RT, texture[5], 2D; # R1 = tex(RT)
SLT R2.w, R1.w, RT.z; # if ( R1.w < RT.z )
MAD RT, viewVec, R2.w, RT; # RT += viewVec;

TEX R1, RT, texture[5], 2D; # R1 = tex(RT)
SLT R2.w, R1.w, RT.z; # if ( R1.w < RT.z )
MAD RT, viewVec, R2.w, RT; # RT += viewVec;

TEX R1, RT, texture[5], 2D; # R1 = tex(RT)
SLT R2.w, R1.w, RT.z; # if ( R1.w < RT.z )
MAD RT, viewVec, R2.w, RT; # RT += viewVec;

TEX R1, RT, texture[5], 2D; # R1 = tex(RT)
SLT R2.w, R1.w, RT.z; # if ( R1.w < RT.z )
MAD RT, viewVec, R2.w, RT; # RT += viewVec;

TEX R1, RT, texture[5], 2D; # R1 = tex(RT)
SLT R2.w, R1.w, RT.z; # if ( R1.w < RT.z )
MAD RT, viewVec, R2.w, RT; # RT += viewVec;

TEX R1, RT, texture[5], 2D; # R1 = tex(RT)
SLT R2.w, R1.w, RT.z; # if ( R1.w < RT.z )
MAD RT, viewVec, R2.w, RT; # RT += viewVec;

TEX R1, RT, texture[5], 2D; # R1 = tex(RT)
SLT R2.w, R1.w, RT.z; # if ( R1.w < RT.z )
MAD RT, viewVec, R2.w, RT; # RT += viewVec;

TEX R1, RT, texture[5], 2D; # R1 = tex(RT)
SLT R2.w, R1.w, RT.z; # if ( R1.w < RT.z )
MAD RT, viewVec, R2.w, RT; # RT += viewVec;

TEX R1, RT, texture[5], 2D; # R1 = tex(RT)
SLT R2.w, R1.w, RT.z; # if ( R1.w < RT.z )
MAD RT, viewVec, R2.w, RT; # RT += viewVec;

TEX R1, RT, texture[5], 2D; # R1 = tex(RT)
SLT R2.w, R1.w, RT.z; # if ( R1.w < RT.z )
MAD RT, viewVec, R2.w, RT; # RT += viewVec;

#[FPO] relief mapping: binary search (6 steps)
###======================================================================
TEX R1, RT, texture[5], 2D; # R1 = tex(RT)
MUL viewVec, viewVec, constval2.z; # viewVec *= 0.5
SLT R2.w, R1.w, RT.z; # if ( R1.w < RT.z )
MUL R2, viewVec, R2.w; #
MAD RT, R2, constval.y, RT; # RT += viewVec * 2;
SUB RT, RT, viewVec; # RT -= viewVec;

TEX R1, RT, texture[5], 2D; # R1 = tex(RT)
MUL viewVec, viewVec, constval2.z; # viewVec *= 0.5
SLT R2.w, R1.w, RT.z; # if ( R1.w < RT.z )
MUL R2, viewVec, R2.w; #
MAD RT, R2, constval.y, RT; # RT += viewVec * 2;
SUB RT, RT, viewVec; # RT -= viewVec;

TEX R1, RT, texture[5], 2D; # R1 = tex(RT)
MUL viewVec, viewVec, constval2.z; # viewVec *= 0.5
SLT R2.w, R1.w, RT.z; # if ( R1.w < RT.z )
MUL R2, viewVec, R2.w; #
MAD RT, R2, constval.y, RT; # RT += viewVec * 2;
SUB RT, RT, viewVec; # RT -= viewVec;

TEX R1, RT, texture[5], 2D; # R1 = tex(RT)
MUL viewVec, viewVec, constval2.z; # viewVec *= 0.5
SLT R2.w, R1.w, RT.z; # if ( R1.w < RT.z )
MUL R2, viewVec, R2.w; #
MAD RT, R2, constval.y, RT; # RT += viewVec * 2;
SUB RT, RT, viewVec; # RT -= viewVec;

TEX R1, RT, texture[5], 2D; # R1 = tex(RT)
MUL viewVec, viewVec, constval2.z; # viewVec *= 0.5
SLT R2.w, R1.w, RT.z; # if ( R1.w < RT.z )
MUL R2, viewVec, R2.w;
MAD RT, R2, constval.y, RT; # RT += viewVec * 2;
SUB RT, RT, viewVec; # RT -= viewVec;

TEX R1, RT, texture[5], 2D; # R1 = tex(RT)
MUL viewVec, viewVec, constval2.z; # viewVec *= 0.5
SLT R2.w, R1.w, RT.z; # if ( R1.w < RT.z )
MUL R2, viewVec, R2.w; #
MAD RT, R2, constval.y, RT; # RT += viewVec * 2;
SUB RT, RT, viewVec; # RT -= viewVec;

###======================================================================

# calculate texcoords for diffuse and specular maps
SUB R1, diffuseTC, normalTC;
SUB R2, specularTC, normalTC;
ADD R1, R1, RT;
ADD R2, R2, RT;

# load texture maps
TEX ambient, lightVecTC, texture[0], CUBE;
TEX normalVec, RT, texture[1], 2D;
TXP lightFall, lightFallTC, texture[2], 2D;
TXP lightProj, lightProjTC, texture[3], 2D;
TEX diffuse, R1, texture[4], 2D;
TEX gloss, R2, texture[5], 2D;

# normalize the vector to the light
DP3 lightVec.x, lightVecTC, lightVecTC;
RSQ lightVec.x, lightVec.x;
MUL lightVec.xyz, lightVec.x, lightVecTC;

# normalize the vector to the viewer
DP3 viewVec.x, viewVecTC, viewVecTC;
RSQ viewVec.x, viewVec.x;
MUL viewVec.xyz, viewVec.x, viewVecTC;

# calculate the half angle vector and normalize
ADD halfVec, lightVec, viewVec;
DP3 R1.x, halfVec, halfVec;
RSQ R1.x, R1.x;
MUL halfVec.xyz, halfVec, R1.x;

# scale normal vector to -1.0<->1.0 range and normalize
MAD normalVec.xyz, normalVec.wyzx, constval.y, -constval.x;
DP3 R1.x, normalVec, normalVec;
RSQ R1.x, R1.x;
MUL normalVec.xyz, normalVec, R1.x;

# transform surface normal into world space
XPD R1, wNormal, epsilon;
XPD R2, wNormal, R1;
DP3 wNormalVec.x, normalVec, R1;
DP3 wNormalVec.y, normalVec, R2;
DP3 wNormalVec.z, normalVec, wNormal;

# calculate vector dot products
DP3 NdotL.x, normalVec, lightVec;
DP3 NdotV.x, normalVec, viewVec;
DP3 NdotH.x, normalVec, halfVec;
DP3 VdotH.x, viewVec, halfVec;
DP3_SAT VdotL.x, viewVec, -lightVec;

# calculate roughness parm using specular map
DP3 R1.x, gloss, grayscale;
SUB R1.x, constval.x, R1.x;
MAD R1.x, R1.x, specParm.x, specParm.y;

# calculate microfacet distribution term (Beckmann Distribution)
MAX NdotH.x, NdotH.x, 0.00001; # sikk - Ambient lighting fix
MUL R1.z, R1.x, R1.x;
POW R1.x, NdotH.x, constval.z;
MUL R1.y, R1.z, constval.z;
MUL R1.x, R1.x, R1.y;
RCP roughness.x, R1.x;
MUL R1.x, NdotH.x, NdotH.x;
SUB R1.y, constval.x, R1.x;
MUL R1.x, R1.x, R1.z;
RCP R1.x, R1.x;
MUL R1.x, R1.x, R1.y;
POW roughness.y, e.x, -R1.x;
MUL roughness.w, roughness.x, roughness.y;

# calculate geometric attenuation term
MUL R1.x, NdotH.x, constval.y;
RCP R1.y, VdotH.x;
MUL geometric.x, R1.x, NdotV.x;
MUL geometric.y, R1.x, NdotL.x;
MUL geometric.x, geometric.x, R1.y;
MUL geometric.y, geometric.y, R1.y;
MIN geometric.w, geometric.x, geometric.y;
MIN geometric.w, geometric.w, constval.x;

# calculate Fresnel term (Schlick approximation)
SUB_SAT R1.x, constval.x, NdotV.x;
POW fresnel.x, R1.x, constval.w;
LRP fresnel.w, specParm.z, constval.x, fresnel.x;

# calculate final specular term
MUL R1.x, roughness.w, geometric.w;
MUL R1.x, R1.x, fresnel.w;
MUL R1.y, NdotV.x, NdotL.x;
RCP R1.y, R1.y;
MUL specular, R1.x, R1.y;

# modulate specular by gloss map and add diffuse color
MAD color, specular, gloss, diffuse;

# calculate self shadowing
MAD_SAT R1.x, normalVec.z, lightVec.z, constval2.x;
MUL_SAT R1.x, R1.x, constval.z;
MUL light, R1.x, NdotL.x;

# calculate hemisphere lighting ambient term
DP3 hemi.x, wNormalVec, hemiLight;
MAD hemi.x, hemi.x, constval2.z, constval2.z;
LRP hemi, hemi.x, skyColor, grndColor;
SUB R1.x, ambient.w, constval2.w;
CMP light, R1.x, hemi, light;

# calculate attenuation using the light falloff and projection maps
MUL atten, lightFall, lightProj;

# modulate light by attenuation
MUL light, light, atten;

# rim light
MUL_SAT rim, fresnel.x, VdotL.x;
ADD color, color, rim;

# modulate by light and light color
MUL color, color, light;
MUL color, color, lightColor;

# modify by the vertex color
MUL oColor.xyz, color, vColor;

END


test.vfp:
###==============================================================================
# Doom 3 Interaction Vertex/Fragment Program
#
# Blinn-Phong Lighting Model w/ Parallax Occlusion Mapping (Isotropic)
###==============================================================================
#
# --------------------------------------
# input:
#
# attrib[8] = texture coordinates
# attrib[9] = global tangent
# attrib[10] = global bitangent
# attrib[11] = global normal
#
# env[0]  = diffuse modifier
# env[1]  = specular modifier
# env[2]  = ?
# env[3]  = ?
# env[4]  = localLightOrigin
# env[5] = localViewOrigin
# env[6] = lightProjection S
# env[7] = lightProjection T
# env[8] = lightProjection Q
# env[9] = lightFalloff S
# env[10] = bumpMatrix S
# env[11] = bumpMatrix T
# env[12] = diffuseMatrix S
# env[13] = diffuseMatrix T
# env[14] = specularMatrix S
# env[15] = specularMatrix T
# env[16] = vertex color modulate
# env[17] = vertex color add
#
#--------------------------------------
# output:
#
# texture 0 = normalization cube map
# texture 1 = per-surface normal map
# texture 2 = 1D light falloff texture
# texture 3 = 2D light projection texture
# texture 4 = per-surface diffuse map
# texture 5 = per-surface specular map
# texture 6 = specular lookup table
#
#--------------------------------------
###==============================================================================

!!ARBvp1.0
OPTION ARB_position_invariant;

# Instruction Count: 25

PARAM defaultTexCoord = { 0.0, 0.5, 0.0, 1.0 };
PARAM hemiLightVec = { 0.25, 0.25, -1.0 };

TEMP R0;

# calculate vector to light in R0
SUB R0, program.env[4], vertex.position;

# put into texture space for TEX0
DP3 result.texcoord[0].x, vertex.attrib[9], R0;
DP3 result.texcoord[0].y, vertex.attrib[10], R0;
DP3 result.texcoord[0].z, vertex.attrib[11], R0;

# texture 1 takes the base coordinates by the texture matrix
MOV result.texcoord[1], defaultTexCoord;
DP4 result.texcoord[1].x, vertex.attrib[8], program.env[10];
DP4 result.texcoord[1].y, vertex.attrib[8], program.env[11];

# texture 2 has one texgen
MOV result.texcoord[2], defaultTexCoord;
DP4 result.texcoord[2].x, vertex.position, program.env[9];

# texture 3 has three texgens
DP4 result.texcoord[3].x, vertex.position, program.env[6];
DP4 result.texcoord[3].y, vertex.position, program.env[7];
DP4 result.texcoord[3].w, vertex.position, program.env[8];

# texture 4 takes the base coordinates by the texture matrix
MOV result.texcoord[4], defaultTexCoord;
DP4 result.texcoord[4].x, vertex.attrib[8], program.env[12];
DP4 result.texcoord[4].y, vertex.attrib[8], program.env[13];

# texture 5 takes the base coordinates by the texture matrix
MOV result.texcoord[5], defaultTexCoord;
DP4 result.texcoord[5].x, vertex.attrib[8], program.env[14];
DP4 result.texcoord[5].y, vertex.attrib[8], program.env[15];

# calculate vector to viewer in R0
SUB R0, program.env[5], vertex.position;

# put into texture space for TEX6
DP3 result.texcoord[6].x, vertex.attrib[9], R0;
DP3 result.texcoord[6].y, vertex.attrib[10], R0;
DP3 result.texcoord[6].z, vertex.attrib[11], R0;

# put hemi-light vector into texture space for TEX7
DP3 result.texcoord[7].x, vertex.attrib[9], hemiLightVec;
DP3 result.texcoord[7].y, vertex.attrib[10], hemiLightVec;
DP3 result.texcoord[7].z, vertex.attrib[11], hemiLightVec;

# generate the vertex color, which can be 1.0, color, or 1.0 - color
# for 1.0 : env[16] =  0.0, env[17] = 1.0
# for color : env[16] =  1.0, env[17] = 0.0
# for 1.0 - color : env[16] = -1.0, env[17] = 1.0
MAD result.color, vertex.color, program.env[16], program.env[17];

END

#==================================================================================

!!ARBfp1.0
OPTION ARB_precision_hint_fastest;

# Instruction Count: ALU: 129 TEX: 32 Total: 161

OUTPUT oColor = result.color;
ATTRIB vColor = fragment.color;

ATTRIB lightVecTC = fragment.texcoord[0];
ATTRIB normalTC = fragment.texcoord[1];
ATTRIB lightFallTC = fragment.texcoord[2];
ATTRIB lightProjTC = fragment.texcoord[3];
ATTRIB diffuseTC = fragment.texcoord[4];
ATTRIB specularTC = fragment.texcoord[5];
ATTRIB viewVecTC = fragment.texcoord[6];
ATTRIB hemiLight = fragment.texcoord[7];

PARAM lightColor = program.env[0];
PARAM specColor = program.env[1];

PARAM const = {  1.0,  2.0,  4.0,  5.0  };
PARAM const2 = {  0.25, 0.5,  0.75, 0.1 };
PARAM skyColor = {  0.5,  0.5,  0.5  };
PARAM grndColor = {  1.0,  1.0,  1.0  };
PARAM lumVec = {  0.212671, 0.715160, 0.072169 };
PARAM specExp = { 64.0,  0.00001 };
PARAM Scale = 0.0625;
PARAM Steps = 16.0;
PARAM invSteps = 0.0625;
PARAM ssStrength = 3.0;

TEMP lightVec, viewVec, halfVec, normalVec;
TEMP diffuse, specular, gloss, color, ambient, shadow;
TEMP light, hemi, atten, lightFall, lightProj;
TEMP NdotL, NdotV, NdotH, VdotL;
TEMP TC, shadowTC, delta, delta0, delta1, H0, H1;
TEMP R1, R2;


# normalize the vector to the viewer
DP3 viewVec.w, viewVecTC, viewVecTC;
RSQ viewVec.w, viewVec.w;
MUL viewVec.xyz, viewVecTC, viewVec.w;

# normalize the vector to the light
DP3 lightVec.w, lightVecTC, lightVecTC;
RSQ lightVec.w, lightVec.w;
MUL lightVec.xyz, lightVecTC, lightVec.w;

###======================================================================
# parallax occlusion mapping: linear search (16 steps)
###======================================================================
MUL R1.xy, viewVec, Scale;
MUL R1.z, -viewVec.z, Steps;
RCP R1.z, R1.z;
MUL delta.xy, R1, R1.z;
MOV delta.z, -invSteps;

TEX H0, specularTC, texture[5], 2D;

ADD TC, specularTC, delta;
MOV TC.z, 0.9375; # 1.0 - invSteps

TEX H1, TC, texture[5], 2D;
SLT R1.x, H1.w, TC.z;
CMP H0, -R1.x, H1.w, H0.w;
MAD TC, R1.x, delta, TC;

TEX H1, TC, texture[5], 2D;
SLT R1.x, H1.w, TC.z;
CMP H0, -R1.x, H1.w, H0.w;
MAD TC, R1.x, delta, TC;

TEX H1, TC, texture[5], 2D;
SLT R1.x, H1.w, TC.z;
CMP H0, -R1.x, H1.w, H0.w;
MAD TC, R1.x, delta, TC;

TEX H1, TC, texture[5], 2D;
SLT R1.x, H1.w, TC.z;
CMP H0, -R1.x, H1.w, H0.w;
MAD TC, R1.x, delta, TC;

TEX H1, TC, texture[5], 2D;
SLT R1.x, H1.w, TC.z;
CMP H0, -R1.x, H1.w, H0.w;
MAD TC, R1.x, delta, TC;

TEX H1, TC, texture[5], 2D;
SLT R1.x, H1.w, TC.z;
CMP H0, -R1.x, H1.w, H0.w;
MAD TC, R1.x, delta, TC;

TEX H1, TC, texture[5], 2D;
SLT R1.x, H1.w, TC.z;
CMP H0, -R1.x, H1.w, H0.w;
MAD TC, R1.x, delta, TC;

TEX H1, TC, texture[5], 2D;
SLT R1.x, H1.w, TC.z;
CMP H0, -R1.x, H1.w, H0.w;
MAD TC, R1.x, delta, TC;

TEX H1, TC, texture[5], 2D;
SLT R1.x, H1.w, TC.z;
CMP H0, -R1.x, H1.w, H0.w;
MAD TC, R1.x, delta, TC;

TEX H1, TC, texture[5], 2D;
SLT R1.x, H1.w, TC.z;
CMP H0, -R1.x, H1.w, H0.w;
MAD TC, R1.x, delta, TC;

TEX H1, TC, texture[5], 2D;
SLT R1.x, H1.w, TC.z;
CMP H0, -R1.x, H1.w, H0.w;
MAD TC, R1.x, delta, TC;

TEX H1, TC, texture[5], 2D;
SLT R1.x, H1.w, TC.z;
CMP H0, -R1.x, H1.w, H0.w;
MAD TC, R1.x, delta, TC;

TEX H1, TC, texture[5], 2D;
SLT R1.x, H1.w, TC.z;
CMP H0, -R1.x, H1.w, H0.w;
MAD TC, R1.x, delta, TC;

TEX H1, TC, texture[5], 2D;
SLT R1.x, H1.w, TC.z;
CMP H0, -R1.x, H1.w, H0.w;
MAD TC, R1.x, delta, TC;

TEX H1, TC, texture[5], 2D;
SLT R1.x, H1.w, TC.z;
CMP H0, -R1.x, H1.w, H0.w;
MAD TC, R1.x, delta, TC;

TEX H1, TC, texture[5], 2D;
SLT R1.x, H1.w, TC.z;
CMP H0, -R1.x, H1.w, H0.w;
MAD TC, R1.x, delta, TC;

###======================================================================
# parallax occlusion mapping: intersection calculation
###======================================================================
MOV R1.y, TC.z;
ADD R1.x, R1.y, invSteps;
ADD delta0, R1.x, -H0.w;
ADD delta1, R1.y, -H1.w;
MUL R2.x, R1.y, delta0;
MAD R2.x, R1.x, delta1, -R2.x;
ADD R2.y, delta1, -delta0;
RCP R2.y, R2.y;
MUL R2, R2.x, R2.y;

MUL R1.xy, delta, Steps;
MAD R1.zw, delta.xyxy, Steps, specularTC.xyxy;
MAD TC, -R2, R1.xyxy, R1.zwzw;

###======================================================================
# self shadowing
###======================================================================
MUL delta.xy, lightVec, Scale;

TEX H0, TC, texture[5], 2D;

MAD shadowTC, delta, 1.0, TC;
TEX R1, shadowTC, texture[5], 2D;
MAX H1, 0.0, R1.w;
MAD shadowTC, delta, 0.875, TC;
TEX R1, shadowTC, texture[5], 2D;
MAX H1, H1, R1.w;
MAD shadowTC, delta, 0.750, TC;
TEX R1, shadowTC, texture[5], 2D;
MAX H1, H1, R1.w;
MAD shadowTC, delta, 0.625, TC;
TEX R1, shadowTC, texture[5], 2D;
MAX H1, H1, R1.w;
MAD shadowTC, delta, 0.500, TC;
TEX R1, shadowTC, texture[5], 2D;
MAX H1, H1, R1.w;
MAD shadowTC, delta, 0.375, TC;
TEX R1, shadowTC, texture[5], 2D;
MAX H1, H1, R1.w;
MAD shadowTC, delta, 0.250, TC;
TEX R1, shadowTC, texture[5], 2D;
MAX H1, H1, R1.w;
MAD shadowTC, delta, 0.125, TC;
TEX R1, shadowTC, texture[5], 2D;
MAX H1, H1, R1.w;

ADD R1, H1, -H0.w;
MAD_SAT shadow, R1, -ssStrength, 1.0;

###======================================================================

# calculate texcoords for diffuse and specular maps
SUB R1, diffuseTC, specularTC;
SUB R2, normalTC, specularTC;
ADD R1, R1, TC;
ADD R2, R2, TC;

# load texture maps
TEX ambient, lightVecTC, texture[0], CUBE;
TEX normalVec, R2, texture[1], 2D;
TXP lightFall, lightFallTC, texture[2], 2D;
TXP lightProj, lightProjTC, texture[3], 2D;
TEX diffuse, R1, texture[4], 2D;
TEX gloss, TC, texture[5], 2D;

# calculate the half angle vector and normalize
ADD halfVec, lightVec, viewVec;
DP3 R1.x, halfVec, halfVec;
RSQ R1.x, R1.x;
MUL halfVec.xyz, halfVec, R1.x;

# scale normal vector to -1.0<->1.0 range and normalize
MAD normalVec.xyz, normalVec.wyzx, const.y, -const.x;
DP3 R1.x, normalVec, normalVec;
RSQ R1.x, R1.x;
MUL normalVec.xyz, normalVec, R1.x;

# calculate vector dot products
DP3 NdotL.x, normalVec, lightVec;
DP3 NdotV.x, normalVec, viewVec;
DP3_SAT NdotH.x, normalVec, halfVec;
DP3_SAT VdotL.x, viewVec, -lightVec;

# calculate specular exp using specular map
DP3 R1.x, gloss, lumVec;
MAD R1.x, R1.x, specExp.x, specExp.y;
MUL R1.x, R1.x, const.z;

# calculate specular term
POW specular, NdotH.x, R1.x;

# scale the specular map * 2
MUL gloss, gloss, const.y;

# modulate specular by gloss map and add diffuse color
MAD color, specular, gloss, diffuse;

# calculate self shadowing
ADD R1.x, lightVec.z, const2.x;
MUL_SAT R1.x, R1.x, const.z;
MUL light, R1.x, NdotL.x;

# calculate hemisphere lighting ambient term
DP3 hemi.x, normalVec, hemiLight;
MAD hemi.x, hemi.x, const2.z, const2.z;
LRP hemi, hemi.x, skyColor, grndColor;
SUB R1.x, ambient.w, const2.z;
CMP light, R1.x, hemi, light;
CMP shadow, R1.x, const.x, shadow;

# calculate attenuation using the light falloff and projection maps
MUL atten, lightFall, lightProj;

# modulate light by attenuation
MUL light, light, atten;

# modulate by light and light color
MUL color, color, light;
MUL color, color, lightColor;
MUL color, color, shadow;

# modify by the vertex color
MUL oColor.xyz, color, vColor;

END


these go in the glprogs folder, try them out and see.
these are modified .vfp's to get the extra gloss effect.
and are used for post processing.
of course make backups first :) before testing!

edit:
you'll notice in your posted .vfp its a    Custom Blinn-Phong Lighting Model (Isotropic)
where this one is a  Cook-Torrance Lighting Model w/ Relief Mapping (Isotropic)
however it needs the modified test.vfp to work in tandem as they wont work without the other to have the gloss render properly.

it may or may not have issues with ATI cards but on Nvidia it works great.
#32
It's not the same effect as with the glprogs, as they are more intense. these seem to be more subtle. at first how you described it as a interaction shader was confusing believing it had to do with vfp's where its a .mtr variable with the code posted.
#33
That's interesting, is that just a material variable. by the way Nice rock pack as I had a chance to have a look, much better than the stock sharprock that comes with D3.
#34
Take a look at the interaction and test .vfp's in my Blade Yautja mod, It's what I used to get the aliens and environment glossed up. Those might help. they both need to be used to work, for vanilla D3.
#35
Welcome! / Re: Hi everyone!
October 02, 2014, 05:10:53 PM
Welcome to the D3 editing community. and Hi 8)
#36
id Tech 4 Models and Animations / Re: Bone scaling on MD5
September 30, 2014, 02:29:34 PM
No guarantees but can try rescale world units in the utilities tab in max, sometimes it works sometimes it doesn't.
#37
Usually in the C: drive d3edit makes autosave files ,like autosave1 and autosave1.bak and autosave2 and autosave2.bak
that's one thing you can check, my advice is to burn to a blank cd or dvd at least once a week or when you can using one that can be written to a few times at least and always have a hard copy just in case, the term save and save often applies to development more so than playing. now having a hard drive die is bad enough, but always backup your work.
hope everything is well now, best always!
#38
id Tech 4 WIP / Re: BladeYautja
September 28, 2014, 04:28:09 PM
No physical copies exist, it's just a concept render.
yeah, big corporate might come and 'get me, torture me and hang me off a bridge
for making a game they could not. Fear and hype are one thing, taking a risk is another.
since my Prometheus mod ,Phantasm and now this, and my poor health, it matters not,
besides I have good relations with some of the fox people, and it has all been positive.
while I was making phantasm beyond, feedback was good and I've actually had contact with A Michael Baldwin, and Bill Thornbury as well as Kristen Deem, they've all been wonderful and I'm considering a sequel for that as well.

But for this (the mod), it is what it is. nothing more than an interactive digital painting. and freedom of expression as a tribute to those that made this stuff in the first place.,Giger,Hall, and Winston. with my respects and appreciation.
#39
id Tech 4 WIP / Re: BladeYautja
September 28, 2014, 05:17:53 AM
I had this in mind for my standalone (version) which works, for a hard copy, but I need ink for my printer, this is rendered in max to show my concept.


#40
id Tech 4 WIP / Re: BladeYautja
September 25, 2014, 04:29:12 PM
Quote from: VGames on September 25, 2014, 12:05:22 PM
Why did u make the game so tough. You're the predator. He can take multiple shogun blasts at close range and still keep on killing with little fatigue. I think u should make him tougher. That's just me. Great mod so far. Nice polished look all around.

what you can do is go to the player.def and increase the health and or max health if that would help.
the player.def is in the predwarrior_000a.pk4 that could help, also the 'U' key gives all but your still vulnerable to rocketmen and plasma casters.
#41
id Tech 4 WIP / Re: BladeYautja
September 25, 2014, 04:25:47 PM
That could be from the glprogs (interaction.vfp and test.vfp) those were added to make some surfaces extra glossy.
in the predwarrior_000a.pk4 you will find the glprogs folder, you can try and overwrite those with the default doom 3 ones and see a difference? but make a back up first before testing. I've noticed this on my laptop but not my desktop.
they both have different graphics. as some of the skulls would glow a bit on the laptop but would be great looking on the desktop. That's what I know, look into those two glprogs and see.


or you could just simply remove those two modifyied .vfp's from the mod folder and put them somewhere safe. as those are for high end graphics cards. and  as d3 would already have those default ones in its directory.
#42
id Tech 4 WIP / Re: BladeYautja
September 24, 2014, 11:28:39 PM
save and save often (quick save and quick load)
could you post a screenshot with a description, please and thank you, so I can understand what you mean better. thanks.
#43
id Tech 4 Engine Coding / Re: POM
September 21, 2014, 07:16:42 PM
POM is (Parallax Occlusion Mapping) correct? not (Party On man) just kiddin' :)
This engine still has great stuff unexplored.
#44
id Tech 4 WIP / Re: BladeYautja
September 21, 2014, 12:33:41 PM
I've uploaded a 3rd person patch to fix the 3rd person HUD and camera clip, these two .pk4's just get added to the mod folder. (optional)
http://www.moddb.com/mods/blade-yautja/downloads/byp-3rdperson-patch
Thanks.
#45
id Tech 4 WIP / Re: BladeYautja
September 21, 2014, 01:25:53 AM
Quote from: Radegast on September 20, 2014, 01:47:53 PM
Do you plan to release a linux or OS X port of Blade Yautja?

from what I know most of my mods work on a mac, as for linux and mac for that matter I'm not sure really whats needed or what kind of binaries, so I've never really looked into those.