Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement fog #549

Merged
merged 4 commits into from
Jul 21, 2024
Merged

Implement fog #549

merged 4 commits into from
Jul 21, 2024

Conversation

OFFTKP
Copy link
Collaborator

@OFFTKP OFFTKP commented Jul 21, 2024

  • Made lighting LUT texture into an RG32F lut (Light is going to need a second channel too anyway, it stores there the difference between the next value in the LUT for linear interpolation)
  • Former lighting LUT texture is now the texture for all LUTs (both light and fog) and has an extra row for fog data
  • Implemented fog in ubershader and specialized shaders

Before:
image

After:
image

Citra:
image

@@ -652,4 +654,27 @@ void FragmentGenerator::compileLUTLookup(std::string& shader, const PICA::Fragme
shader += "lut_lookup_result *= " + std::to_string(scales[scale]) + ";\n";
}
}
}

void FragmentGenerator::compileFog(std::string& shader, const PICA::FragmentConfig& config) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦊

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦊

BitField<0, 3, FogMode> mode;
BitField<3, 1, u32> flipDepth;
BitField<8, 8, u32> fogColorR;
BitField<16, 8, u32> fogColorG;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For texenv constant colours it's normally ideal to pass them as uniforms as they change constantly, though we'll see if this is necessary here, since I don't expect games to constantly change fog colour

@wheremyfoodat
Copy link
Owner

image

@wheremyfoodat wheremyfoodat merged commit cb2448a into wheremyfoodat:master Jul 21, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants