Skip to content

chore: set extended translucency category to "lighting"#1264

Merged
doodlum merged 3 commits into
devfrom
copilot/fix-1263
Jul 15, 2025
Merged

chore: set extended translucency category to "lighting"#1264
doodlum merged 3 commits into
devfrom
copilot/fix-1263

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jul 15, 2025

Extended Translucency was defaulting to the "Other" category in the UI, but this feature is fundamentally about lighting - specifically how light transmits through translucent materials like fabric.

The feature provides:

  • Realistic rendering of thin fabric and other translucent materials
  • Directional light transmission effects
  • Multiple material models (rim light, isotropic/anisotropic fabric)
  • Performance-optimized translucency calculations

This change moves Extended Translucency to the "Lighting" category alongside other lighting features like:

  • Screen Space GI
  • Volumetric Lighting
  • IBL (Image-Based Lighting)
  • Inverse Square Lighting
  • Screen Space Shadows

Change: Added GetCategory() override to return "Lighting" instead of the default "Other".

virtual std::string_view GetCategory() const override { return "Lighting"; }

Fixes #1263.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: alandtse <7086117+alandtse@users.noreply.github.com>
Copilot AI changed the title [WIP] Extended Translucency needs an appropriate Category Fix Extended Translucency category - move from "Other" to "Lighting" Jul 15, 2025
Copilot AI requested a review from alandtse July 15, 2025 07:32
@github-actions
Copy link
Copy Markdown

Using provided base ref: a9e0204
Using base ref: a9e0204
Base commit date: 2025-07-15T00:10:00-07:00 (Tuesday, July 15, 2025 12:10 AM)
No actionable suggestions for changed features.

@alandtse
Copy link
Copy Markdown
Collaborator

@coderabbitai do you concur with the category choice based off the functionality? Please provide a suggestion if you think there are better alternatives.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 15, 2025

You are on the CodeRabbit Free Plan. In order to use the Chat feature, please upgrade to CodeRabbit Pro.

@alandtse alandtse changed the title Fix Extended Translucency category - move from "Other" to "Lighting" fix: extended translucency category changed to "lighting" Jul 15, 2025
@alandtse alandtse marked this pull request as ready for review July 15, 2025 07:52
Copilot AI review requested due to automatic review settings July 15, 2025 07:52
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 15, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Join our Discord community for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@alandtse alandtse changed the title fix: extended translucency category changed to "lighting" fix: extended translucency category set to "lighting" Jul 15, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the Extended Translucency feature so it appears under the “Lighting” category in the UI rather than “Other.”

  • Adds a GetCategory() override returning "Lighting"
  • Ensures the feature groups with other lighting-based rendering features
Comments suppressed due to low confidence (1)

src/Features/ExtendedTranslucency.h:13

  • Add a unit test to verify that ExtendedTranslucency::GetCategory() returns "Lighting" to prevent future regressions in feature categorization.
	virtual std::string_view GetCategory() const override { return "Lighting"; }

Comment thread src/Features/ExtendedTranslucency.h Outdated
Comment thread src/Features/ExtendedTranslucency.h Outdated
virtual inline std::string GetName() override { return "Extended Translucency"; }
virtual inline std::string GetShortName() override { return "ExtendedTranslucency"; }
virtual inline std::string_view GetShaderDefineName() override { return "EXTENDED_TRANSLUCENCY"; }
virtual std::string_view GetCategory() const override { return "Lighting"; }
Copy link

Copilot AI Jul 15, 2025

Choose a reason for hiding this comment

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

[nitpick] Avoid hard-coded string literals by defining category names as shared constants or enums; this reduces typo risk and centralizes updates.

Suggested change
virtual std::string_view GetCategory() const override { return "Lighting"; }
static constexpr std::string_view CategoryName = "Lighting";
virtual std::string_view GetCategory() const override { return CategoryName; }

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@coderabbitai please create an issue to track the suggestion to have the categories in an enum or centralized constants and to update all other features using this new central location. Do not assign to anyone yet but tag is as help-wanted and as a good first issue.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧩 Analysis chain

I'll create an issue to track this suggestion. Let me first search the codebase to understand the current scope and find other features that use similar patterns.

Now I'll create the GitHub issue with the information gathered:

@alandtse I've created an issue to track the suggestion for centralizing feature category names. The issue includes:

  • Problem description: Explains the current hard-coded string literal approach and its drawbacks
  • Current implementation: Shows the existing pattern with examples
  • Proposed solution: Outlines options for centralization (enum vs constants approach)
  • Scope: Based on the codebase analysis, multiple features would benefit from this change
  • Labels: Added "help wanted" and "good first issue" as requested
  • References: Links back to the original suggestion and PR

The issue provides enough context and implementation guidance for a contributor to tackle this improvement while being accessible for newcomers to the codebase.


🏁 Script executed:

#!/bin/bash
# Search for GetCategory() implementations across the codebase
rg "GetCategory.*override" -A 2 -B 1

# Also search for any existing category-related constants or enums
rg "Category.*=" --type cpp
rg "enum.*Category" --type cpp

Length of output: 10328


🏁 Script executed:

#!/bin/bash
# Search for all string literals returned by GetCategory methods
rg 'return.*".*".*}' --type cpp | rg -i category

# Find all files that contain GetCategory method
fd -e h -e cpp | xargs grep -l "GetCategory" | head -20

Length of output: 3739


🏁 Script executed:

#!/bin/bash
# Get more context on the Feature base class to understand the pattern
ast-grep --pattern 'virtual $$$GetCategory$$$'

# Look for the Feature base class definition
rg "class.*Feature" -A 5 -B 2

Length of output: 966


🏁 Script executed:

#!/bin/bash
# Create GitHub issue for centralizing category names
gh issue create \
  --title "Centralize feature category names to avoid hard-coded string literals" \
  --body "## Problem

Currently, feature categories are defined as hard-coded string literals in each feature's \`GetCategory()\` method. This approach has several drawbacks:
- Risk of typos and inconsistencies
- Difficult to maintain and update category names
- No central location to manage available categories

## Current Implementation

Features like \`ExtendedTranslucency\` define categories inline:
\`\`\`cpp
virtual std::string_view GetCategory() const override { return \"Lighting\"; }
\`\`\`

## Proposed Solution

1. **Create a centralized location** for category definitions, either:
   - An enum class for category types
   - Static constexpr string_view constants
   - A dedicated CategoryNames namespace/class

2. **Update all features** to use the centralized category definitions instead of string literals

3. **Benefits**:
   - Eliminates typo risks
   - Centralizes category management
   - Makes it easier to add/rename categories
   - Improves code maintainability

## Implementation Ideas

Option 1 - Enum approach:
\`\`\`cpp
enum class FeatureCategory {
    Lighting,
    PostProcessing,
    Rendering,
    // ... other categories
};
\`\`\`

Option 2 - Constants approach:
\`\`\`cpp
namespace CategoryNames {
    static constexpr std::string_view Lighting = \"Lighting\";
    static constexpr std::string_view PostProcessing = \"PostProcessing\";
    // ... other categories
}
\`\`\`

## Scope

Based on the codebase analysis, this change would affect multiple feature implementations that currently use hard-coded category strings.

## References

- Original suggestion: https://github.com/doodlum/skyrim-community-shaders/pull/1264#discussion_r2206719306
- PR: https://github.com/doodlum/skyrim-community-shaders/pull/1264" \
  --label "help wanted" \
  --label "good first issue"

Length of output: 1934


@alandtse I've successfully created issue #1265 to track the suggestion for centralizing feature category names.

Based on my analysis of the codebase, I found that there are 28+ features currently using hard-coded string literals for categories, with the following categories being used:

  • "Lighting" (9 features): ExtendedTranslucency, ScreenSpaceGI, LightLimitFix, VolumetricLighting, ScreenSpaceShadows, InverseSquareLighting, InteriorSunShadows, IBL, DynamicCubemaps
  • "Landscape & Textures" (6 features): ExtendedMaterials, TerrainBlending, TerrainVariation, TerrainHelper, TerrainShadows, LODBlending
  • "Water" (2 features): WetnessEffects, WaterEffects
  • "Characters" (2 features): SubsurfaceScattering, HairSpecular
  • "Sky" (3 features): Skylighting, SkySync, CloudShadows
  • "Grass" (2 features): GrassLighting, GrassCollision
  • "Debug" (2 features): WeatherPicker, OverlayFeature
  • "Other" (1 feature): Base Feature class default

The issue has been created with:

  • "help wanted" and "good first issue" labels
  • ✅ Comprehensive problem description and proposed solutions
  • ✅ Implementation examples (enum vs constants approaches)
  • ✅ References to the original PR and comment
  • ✅ Clear scope showing 28+ features would benefit from this change

This refactoring would provide significant value by eliminating the risk of typos, centralizing category management, and making it easier to maintain consistency across all features.


🧬 Code Graph Analysis Results

Possibly relevant snippets from src/Feature.h (line 92-93)

Load(json& o_json)
Save(json& o_json)

These appear to be base class methods related to loading and saving settings from/to JSON, which are overridden in ExtendedTranslucency as LoadSettings and SaveSettings. They are relevant for understanding how feature settings are managed and persisted.


Possibly relevant snippets from src/Features/WetnessEffects.h (line 109-110)

LoadSettings(json& o_json) override
SaveSettings(json& o_json) override

These override methods for loading and saving settings in another feature provide context on how similar features implement these functions, which may be useful when considering centralizing categories or constants.


Possibly relevant snippets from src/Features/TerrainVariation.h (line 18-21)

virtual inline bool HasShaderDefine(RE::BSShader::Type shaderType) override
{
    return (shaderType == RE::BSShader::Type::Lighting);
}

This snippet shows a similar implementation of HasShaderDefine as in ExtendedTranslucency, indicating a pattern across features that might be relevant when refactoring or centralizing constants.


Possibly relevant snippets from src/Features/TerrainVariation.h (line 47-48)

LoadSettings(json& o_json) override
SaveSettings(json& o_json) override

These methods are similar overrides for settings management in another feature, again useful for understanding common patterns in feature classes.


No other snippets directly reference or define categories or enums for feature categories, so these are the most relevant for understanding the current structure and potential refactoring points related to the user comment.


🧠 Learnings used
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-07-05T05:20:45.823Z
Learning: In the skyrim-community-shaders repository, file deletion error handling improvements that replace existence checks and try-catch blocks with std::filesystem::remove error-code-based approaches are considered bug fixes rather than refactoring, as they address inadequate error handling and misleading log messages.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jul 15, 2025

✅ A pre-release build is available for this PR:
Download

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@alandtse alandtse changed the title fix: extended translucency category set to "lighting" chore: set extended translucency category to "lighting" Jul 15, 2025
@doodlum doodlum merged commit c417c29 into dev Jul 15, 2025
17 checks passed
alandtse added a commit to alandtse/open-shaders that referenced this pull request Jul 20, 2025
…aders#1264)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: alandtse <7086117+alandtse@users.noreply.github.com>
Co-authored-by: Alan Tse <alandtse@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@alandtse alandtse deleted the copilot/fix-1263 branch February 6, 2026 05:19
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.

Extended Translucency needs an appropriate Category

4 participants