Technically backface culling should cull polys when the dot product = 0, since when it equals 0 the polys is perpendicular to the camera and thus invisible. When you complete sega rally2 (if you can get that far lol) the champagne is invisible. The reason is because all the face normals are 0. So when multiplied by the model matrix they are still 0 and get culled. Tweaking the condition to only cull polys when greater than 0 fixes this, and allows these 'bad' polys to render as they do on the model3.

This commit is contained in:
Ian Curtis 2019-01-16 01:07:56 +00:00
parent 98106df68b
commit 864bb36b5a
2 changed files with 10 additions and 10 deletions

View file

@ -89,7 +89,7 @@ float area(vec2 a, vec2 b)
void main(void)
{
if(gs_in[0].discardPoly>=0) {
if(gs_in[0].discardPoly > 0) {
return; //emulate back face culling here (all vertices in poly have same value)
}
@ -439,14 +439,14 @@ vec4 GetTextureValue()
if (microTexture) {
vec2 scale = (baseTexSize / 128.0) * microTextureScale;
vec4 tex2Data = textureR3D( tex2, ivec2(0), vec2(128.0), fsTexCoord * scale);
float lod = mip_map_level(fsTexCoord * scale * vec2(128.0));
float blendFactor = max(lod - 1.5, 0.0); // bias -1.5
blendFactor = min(blendFactor, 1.0); // clamp to max value 1
blendFactor = (blendFactor + 1.0) / 2.0; // 0.5 - 1 range
vec4 tex2Data = textureR3D( tex2, ivec2(0), vec2(128.0), fsTexCoord * scale);
float lod = mip_map_level(fsTexCoord * scale * vec2(128.0));
float blendFactor = max(lod - 1.5, 0.0); // bias -1.5
blendFactor = min(blendFactor, 1.0); // clamp to max value 1
blendFactor = (blendFactor + 1.0) / 2.0; // 0.5 - 1 range
tex1Data = mix(tex2Data, tex1Data, blendFactor);
}

View file

@ -280,7 +280,7 @@ void main()
vec4 finalData;
vec4 fogData;
if(fsDiscard>=0) {
if(fsDiscard > 0) {
discard; //emulate back face culling here
}