Skip to content

feat: add Extended Translucency#678

Merged
doodlum merged 1 commit into
community-shaders:devfrom
ArcEarth:extended_transcluency
Jun 23, 2025
Merged

feat: add Extended Translucency#678
doodlum merged 1 commit into
community-shaders:devfrom
ArcEarth:extended_transcluency

Conversation

@ArcEarth
Copy link
Copy Markdown
Contributor

@ArcEarth ArcEarth commented Oct 21, 2024

Hi, everyone,
I am super excited to contribute to this great project!
Please correct me if I got anything wrong :)
I am a little constraint on time so may reply to things late.

Adding a new feature to control translucent material's opacity.
The core changes is all in the HLSL side, where cpp changes just provide 3 setting variables.

Vanilla:
vanilla
Anisotropic Fabric model:
fabric

Settings UI:
settings

Future work:

  • Allow per geometry to override the settings (Not sure about how to do this right now, using a used flag?)

Summary by CodeRabbit

  • New Features

    • Introduced Extended Translucency with enhanced translucency rendering supporting multiple material models like Rim Light, Isotropic Fabric, and Anisotropic Fabric.
    • Added user interface controls for fine-tuning translucency parameters such as transparency increase, softness, and blend weight.
    • Enabled saving and loading of feature settings with VR support.
  • Documentation

    • Added configuration file with versioning for the Extended Translucency feature.
  • Chores

    • Integrated Extended Translucency into global feature management and shader pipelines.
    • Added developer comments regarding texture slot bit allocation for future updates.

@ArcEarth ArcEarth changed the title Feat: Extended Translucency feat: Extended Translucency Oct 21, 2024
Comment thread package/Shaders/Common/SharedData.hlsli Outdated
@doodlum
Copy link
Copy Markdown
Collaborator

doodlum commented Oct 21, 2024

This looks really interesting. It would be best to include this as an option in the JSON configs for True PBR like we did with the glints PR #413 that way different materials can have different translucency types, rather than every alpha effect getting this. Otherwise random translucent objects could look incorrect which would cause issues. True PBR actually has fabric models too, so could maybe implement that without even needed new config options. You would however need to convert assets to PBR to be able to test the model.

@Jonahex is in charge of all that

Copy link
Copy Markdown
Collaborator

@doodlum doodlum left a comment

Choose a reason for hiding this comment

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

Prereq:

Please wait for this issue to be resolved, then this PR can be updated to support it.

@ArcEarth
Copy link
Copy Markdown
Contributor Author

👍 I'll be working on the new nif flags, thanks for the reference!

@ArcEarth ArcEarth force-pushed the extended_transcluency branch 2 times, most recently from c84f52b to 8423cc5 Compare October 27, 2024 07:08
@ArcEarth
Copy link
Copy Markdown
Contributor Author

@doodlum The settings are now detected from ExtraData node in the mesh's NIF.
I find this being much stable than reusing a shading flag.
image

Also, I kept the option to apply this effect to everything, so that existing assets can be improved from this feature immediately.
People can use the setting to make it only apply to the opt-in mesh with the extra data :)
Similarly, mesh can opt-out by setting the extra data to 0.

One future improvement is to make some TESForm based selection like using KID or alkies.

Besides, added another option 'Stregth' to the setting, which is essentially the blending weight (alpha) of this effect.

Comment thread package/Shaders/Lighting.hlsl
@doodlum
Copy link
Copy Markdown
Collaborator

doodlum commented Oct 27, 2024

Looks really good so far. Just a few minor performance related things and I think then it's probably good to go.

Comment thread src/Features/ExtendedTranslucency.cpp Outdated
Comment thread src/Features/ExtendedTranslucency.cpp Outdated
Comment thread src/Features/ExtendedTranslucency.cpp Outdated

ID3D11DeviceContext* context = reinterpret_cast<ID3D11DeviceContext*>(renderer->GetRuntimeData().context);
ID3D11Buffer* buffers[1];
if (auto* data = pass->geometry->GetExtraData(NiExtraDataName)) {
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.

Not sure how good for perf it to look for ExtraData in each PerGeometry

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think it should be fine compared to the cost of updating constant buffer:
The ExtraData is empty on most geometry, and for others with a small amount of extra data, it's a linear/binary lookup on an array of char*, the compare is pointer based instead of strcmp.

I tried to reuse some shader flags, like VertexAlpha, but found there are lot of random assets using them 😂

Comment thread src/Features/ExtendedTranslucency.cpp Outdated
Comment thread src/Buffer.h Outdated
@ArcEarth
Copy link
Copy Markdown
Contributor Author

ArcEarth commented Oct 29, 2024

@doodlum @Jonahex @FlayaN
The new update make use of the cbuffer on slot 7 with immutable buffers that never update/map-unmap after creation. And we only have 5 of them in total. This design can avoid the expensive GPU resources update and synchronization and should be very performant. (DX11 will create new GPU buffer when mapped to write, if the current constant buffer is in use with the GPU, which looks like a common case in the codebase: the same constant buffer seems reused for different geometries and mapped to CPU to udpate before the draw)
Wondering if you like the design or prefer merging this into the per-geometry buffer?
And anything else I should address?

@doodlum
Copy link
Copy Markdown
Collaborator

doodlum commented Oct 29, 2024

@doodlum @Jonahex @FlayaN
The new update make use of the cbuffer on slot 7 with immutable buffers that never update/map-unmap after creation. And we only have 5 of them in total.
Wondering if you like the design or prefer merging this into the per-geometry buffer?
And anything else I should address?

It is probably fine for now. Soon we will probably scrap all additional constant buffers. State switching and updates need to be minimised but it only matters when it affects a significant number of calls.

So two more things:
Use fake enums in HLSL where possible, like we now do with shader flags.
Link to any references used in the code.

@doodlum
Copy link
Copy Markdown
Collaborator

doodlum commented Oct 29, 2024

Please see https://github.com/doodlum/skyrim-community-shaders/blob/dev/package/Shaders/Common/Permutation.hlsli

@ArcEarth ArcEarth force-pushed the extended_transcluency branch from 810a105 to 7d51a1d Compare October 30, 2024 04:40
@ArcEarth
Copy link
Copy Markdown
Contributor Author

@ArcEarth ArcEarth requested a review from doodlum October 31, 2024 04:48
@ArcEarth
Copy link
Copy Markdown
Contributor Author

ArcEarth commented Oct 31, 2024

@doodlum Anything else to be addressed before we can merge? :)

Beside, wondering if we have some detail about the mod release process, if I or the team should upload the feature mod?

Also, the raw Lighting.hlsl edit can be release as a replacer for the current stable version of CS (without settings or nif settings), wondering if we should release it now or release it with the next version?

@ArcEarth ArcEarth requested review from FlayaN and Jonahex November 2, 2024 04:35
@ArcEarth
Copy link
Copy Markdown
Contributor Author

ArcEarth commented Nov 2, 2024

@doodlum @FlayaN @Jonahex Mind to re-review this :)

@doodlum
Copy link
Copy Markdown
Collaborator

doodlum commented Nov 4, 2024

@doodlum @FlayaN @Jonahex Mind to re-review this :)

I will just busy atm

Comment thread src/Features/ExtendedTranslucency.cpp Outdated
Comment thread src/Features/ExtendedTranslucency.cpp
@alandtse alandtse changed the title feat: Extended Translucency feat: add Extended Translucency Nov 28, 2024
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2025

Walkthrough

This update introduces a new "Extended Translucency" feature to the rendering pipeline. It adds shader utilities, configuration, and runtime logic for handling advanced translucency effects, including anisotropic alpha materials. The implementation includes new shader code, configuration files, global integration, feature registration, buffer updates, UI controls, serialization support, and integration with the rendering pipeline via hooks.

Changes

File(s) Change Summary
features/Extended Translucency/Shaders/ExtendedTranslucency/ExtendedTranslucency.hlsli Added shader header with material model constants and functions for view-dependent alpha handling.
features/Extended Translucency/Shaders/Features/ExtendedTranslucency.ini Added configuration file specifying version for the new feature.
package/Shaders/Common/SharedData.hlsli Added ExtendedTranslucencySettings struct and integrated it into the shader feature data buffer.
src/Feature.cpp Registered ExtendedTranslucency in the feature list.
src/FeatureBuffer.cpp Included ExtendedTranslucency settings in the feature buffer data aggregation.
src/Features/ExtendedTranslucency.cpp, src/Features/ExtendedTranslucency.h Implemented and declared the ExtendedTranslucency feature class, with UI, serialization, and hooks.
src/Globals.cpp, src/Globals.h Declared and initialized a global pointer for ExtendedTranslucency.
src/State.h Added ETMaterialModel flag to the ExtraFeatureDescriptors enum.
src/Features/TerrainHelper.cpp Added a comment about updating texture slot constants if changed.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI
    participant ExtendedTranslucency
    participant State
    participant Shader

    User->>UI: Adjust translucency settings (ImGui)
    UI->>ExtendedTranslucency: Update MaterialParams
    ExtendedTranslucency->>State: Update global feature descriptor
    State->>Shader: Pass updated settings via buffer
    Shader->>Shader: Use new alpha/material model logic in rendering
Loading

Suggested reviewers

  • doodlum

Poem

In the world of glass and light,
A rabbit tweaks translucency just right.
With sliders and hooks,
And shader-bound looks,
Fabrics and rims now shimmer so bright!
🐇✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b368cac and 1754485.

⛔ Files ignored due to path filters (1)
  • package/Shaders/Lighting.hlsl is excluded by !**/*.hlsl
📒 Files selected for processing (11)
  • features/Extended Translucency/Shaders/ExtendedTranslucency/ExtendedTranslucency.hlsli (1 hunks)
  • features/Extended Translucency/Shaders/Features/ExtendedTranslucency.ini (1 hunks)
  • package/Shaders/Common/SharedData.hlsli (2 hunks)
  • src/Feature.cpp (2 hunks)
  • src/FeatureBuffer.cpp (2 hunks)
  • src/Features/ExtendedTranslucency.cpp (1 hunks)
  • src/Features/ExtendedTranslucency.h (1 hunks)
  • src/Features/TerrainHelper.cpp (1 hunks)
  • src/Globals.cpp (3 hunks)
  • src/Globals.h (2 hunks)
  • src/State.h (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (11)
  • features/Extended Translucency/Shaders/Features/ExtendedTranslucency.ini
  • src/Features/TerrainHelper.cpp
  • src/FeatureBuffer.cpp
  • src/State.h
  • src/Globals.h
  • package/Shaders/Common/SharedData.hlsli
  • src/Feature.cpp
  • src/Globals.cpp
  • features/Extended Translucency/Shaders/ExtendedTranslucency/ExtendedTranslucency.hlsli
  • src/Features/ExtendedTranslucency.cpp
  • src/Features/ExtendedTranslucency.h
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build plugin and addons
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 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? Create a ticket on our support page 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 docstrings to generate docstrings for this 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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

♻️ Duplicate comments (1)
package/Shaders/Common/SharedData.hlsli (1)

186-192: Ensure HLSL–C++ constant buffer alignment
The new ExtendedTranslucencySettings struct and its insertion into FeatureData must exactly match the layout and size of the corresponding C++ struct in FeatureBuffer.cpp.
Please verify with a C++ static_assert on the buffer size and field offsets or add explicit padding if necessary.

Also applies to: 208-208

🧹 Nitpick comments (8)
src/State.h (1)

154-154: Fix typo in comment
The comment reads “ExtendedTransluceny” instead of “ExtendedTranslucency.” Please correct the spelling to avoid confusion.

-    uint ExtraFeatureDescriptor;  // TerrainHelper : 6, ExtendedTransluceny : 3
+    uint ExtraFeatureDescriptor;  // TerrainHelper : 6, ExtendedTranslucency : 3
package/Shaders/Common/Permutation.hlsli (1)

82-82: Fix spelling typo in comment
The inline comment reads "ExtendedTransluceny"—it should be "ExtendedTranslucency" to match the feature name and avoid confusion.

-   uint ExtraFeatureDescriptor;  // TerrainHelper : 6, ExtendedTransluceny : 2
+   uint ExtraFeatureDescriptor;  // TerrainHelper : 6, ExtendedTranslucency : 2
features/Extended Translucency/Shaders/ExtendedTranslucency/ExtendedTranslucency.hlsli (3)

23-27: Consider extracting magic constant
The 0.001 offset prevents division by zero but is hard-coded. You might define a named constant (e.g., kMinDotEpsilon) for clarity and easy tuning.


28-36: Review 2D fabric alpha formula
The GetViewDependentAlphaFabric2D function is mathematically sound. If performance becomes critical, consider precomputing a0 outside high-frequency loops.


38-43: Guard against zero or negative limits
Currently SoftClamp divides by limit without checking for zero. Adding a check prevents potential NaNs or infinities when limit == 0.

float SoftClamp(float alpha, float limit)
{
    if (limit <= 0) { return 0; }
    alpha = min(alpha, limit / (1 + exp(-4 * (alpha - limit*0.5) / limit)));
    return saturate(alpha);
}
src/Features/ExtendedTranslucency.cpp (3)

7-8: Unused compile-time switch – remove or make it meaningful
EXTENDED_TRANSLUCENCY_PER_MATERIAL_BUFFER is defined but never referenced inside the TU (and I can’t find any reference in the other files from this PR). Dead macros make the intent unclear and risk bit-rot.


94-114: UI slider wired to a non-persisted value
Even after fixing the serialisation list, AlphaStrength defaults to 0 every run because the struct default is 0.f. Consider initialising it to a sensible value (e.g. 1.f) so users immediately see an effect.


66-69: Hook installation: missing failure handling
If write_vfunc fails (e.g. table layout differs on AE/VR), Install() will silently succeed and the feature will act unpredictably. Emitting an error or returning a boolean would aid debugging.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between f9dcd69 and 129d2ce.

⛔ Files ignored due to path filters (1)
  • package/Shaders/Lighting.hlsl is excluded by !**/*.hlsl
📒 Files selected for processing (12)
  • features/Extended Translucency/Shaders/ExtendedTranslucency/ExtendedTranslucency.hlsli (1 hunks)
  • features/Extended Translucency/Shaders/Features/ExtendedTranslucency.ini (1 hunks)
  • package/Shaders/Common/Permutation.hlsli (1 hunks)
  • package/Shaders/Common/SharedData.hlsli (2 hunks)
  • src/Feature.cpp (2 hunks)
  • src/FeatureBuffer.cpp (2 hunks)
  • src/Features/ExtendedTranslucency.cpp (1 hunks)
  • src/Features/ExtendedTranslucency.h (1 hunks)
  • src/Features/TerrainHelper.cpp (1 hunks)
  • src/Globals.cpp (3 hunks)
  • src/Globals.h (2 hunks)
  • src/State.h (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/Globals.cpp (1)
src/Features/ExtendedTranslucency.cpp (2)
  • GetSingleton (17-21)
  • GetSingleton (17-17)
🔇 Additional comments (15)
features/Extended Translucency/Shaders/Features/ExtendedTranslucency.ini (1)

1-2: INI version descriptor looks good
The new ExtendedTranslucency.ini file provides a clear version anchor for the feature.

src/Features/TerrainHelper.cpp (1)

153-153: Helpful reminder for bit‐allocation maintenance
The newly added comment makes it clear where to update the bit allocation if you change the texture‐slot count. This is a useful guide for future maintenance.

src/FeatureBuffer.cpp (2)

6-6: Include ExtendedTranslucency feature header
The new include for ExtendedTranslucency.h is correctly placed alongside the other feature headers.


49-50:

Details

✅ Verification successful

Integrate ExtendedTranslucency settings into buffer data
You’ve appended extendedTranslucency->settings to the feature‐buffer payload. Ensure that the order here matches the layout defined in the HLSL FeatureData structure to avoid mismatches between CPU and GPU data.

Run this to confirm the sequence in your shared-data header:


🏁 Script executed:

#!/bin/bash
# Find the FeatureData struct and show its fields, including ExtendedTranslucencySettings
file=$(fd SharedData.hlsli)
rg -n 'struct FeatureData' -n 'ExtendedTranslucencySettings' "$file"

Length of output: 239


🏁 Script executed:

#!/usr/bin/env bash
# Locate the SharedData HLSL file and dump the FeatureData struct
file=$(fd SharedData.hlsli)
if [[ -z "$file" ]]; then
  echo "Error: SharedData.hlsli not found"
  exit 1
fi

echo "=== struct FeatureData in $file ==="
sed -n '/struct FeatureData/,/};/p' "$file"

Length of output: 347


🏁 Script executed:

#!/usr/bin/env bash
# Dump the FeatureData struct with ample context to inspect its fields
file=$(fd SharedData.hlsli)
if [[ -z "$file" ]]; then
  echo "Error: SharedData.hlsli not found" >&2
  exit 1
fi

echo "=== Showing struct FeatureData with 50 lines after header ==="
rg -n 'struct FeatureData' -A50 "$file"

Length of output: 327


🏁 Script executed:

#!/usr/bin/env bash
# Locate SharedData.hlsli and inspect struct definitions and FeatureData occurrences
file=$(fd SharedData.hlsli)
if [[ -z "$file" ]]; then
  echo "Error: SharedData.hlsli not found" >&2
  exit 1
fi

echo "=== Occurrences of 'FeatureData' in $file ==="
rg -n 'FeatureData' "$file" || echo "(none found)"

echo
echo "=== Top-level struct definitions in $file ==="
rg -n '^struct' -A20 "$file" || echo "(none found)"

Length of output: 670


🏁 Script executed:

#!/usr/bin/env bash
# Extract cbuffer FeatureData from SharedData.hlsli to inspect field order
file=$(fd SharedData.hlsli)
if [[ -z "$file" ]]; then
  echo "Error: SharedData.hlsli not found" >&2
  exit 1
fi

echo "=== cbuffer FeatureData fields in $file ==="
awk '/cbuffer FeatureData/,/};/' "$file"

Length of output: 989


🏁 Script executed:

#!/usr/bin/env bash
# Extract the FeatureData payload initialization from FeatureBuffer.cpp
file=$(fd FeatureBuffer.cpp)
if [[ -z "$file" ]]; then
  file="src/FeatureBuffer.cpp"
fi

echo "=== FeatureData initializer in $file ==="
awk '/FeatureData[[:space:]]*data/,/};/' "$file"

Length of output: 273


🏁 Script executed:

#!/usr/bin/env bash
# Show the context around lines 49-50 in FeatureBuffer.cpp
file=$(fd FeatureBuffer.cpp | head -n1)
if [[ -z "$file" ]]; then
  echo "Error: FeatureBuffer.cpp not found" >&2
  exit 1
fi

echo "=== Lines 30-70 of $file ==="
nl -ba "$file" | sed -n '30,70p'

echo
echo "=== Extracted settings payload block ==="
awk '/globals::features.*->settings/,/\);/' "$file"

Length of output: 1166


FeatureData settings order matches HLSL struct
I’ve verified the FeatureData cbuffer in SharedData.hlsli and confirmed that the sequence in FeatureBuffer.cpp—ending with globals::features::extendedTranslucency->settings—exactly matches the HLSL layout. No changes are needed here.

src/Feature.cpp (2)

7-7: Register ExtendedTranslucency in feature list
The new include is correctly added so the feature is visible to the Feature system.


157-158: Ensure feature‐list ordering consistency
You’ve added extendedTranslucency to the static feature vector. Please verify that its position here aligns with its position in the feature‐buffer and the HLSL layout to maintain consistent indexing across systems.

src/Globals.h (2)

27-27: Register the new feature globally
Forward-declaring ExtendedTranslucency in the globals header aligns with other features and exposes the global pointer.


80-80: Expose extendedTranslucency pointer
Adding the extern ExtendedTranslucency* extendedTranslucency; entry integrates the feature into the global feature list.

src/Globals.cpp (3)

17-17: Include the feature header
#include "Features/ExtendedTranslucency.h" ensures the singleton and class definitions are available for initialization.


79-79: Define the global pointer
Initializing ExtendedTranslucency* extendedTranslucency = nullptr; alongside other features maintains consistency in global declarations.


163-163: Initialize the feature singleton
Assigning features::extendedTranslucency = ExtendedTranslucency::GetSingleton(); in OnInit() hooks the feature into the runtime pipeline.

features/Extended Translucency/Shaders/ExtendedTranslucency/ExtendedTranslucency.hlsli (2)

1-9: Verify material model enum definitions
The MaterialModel constants (Disabled=0…AnisotropicFabric=3) align with two-bit encoding. This mapping is clear and concise.


18-21: Approve naive alpha modulation
GetViewDependentAlphaNaive implements the intended simple blend. Ensure view and normal are normalized upstream to avoid unexpected results.

src/Features/ExtendedTranslucency.h (2)

34-36: Descriptor mask shape – document or widen
ExtraFeatureDescriptorMask is 0b111 (values 0–7) but the enum only defines 0–3. Clarify the extra states (4–7) in a comment or tighten the mask to 0b11.


20-20: VR support flag – double-check runtime parity
Returning true unconditionally implies the feature is known to run on both SE & VR. Please verify on the VR build; otherwise guard with a compile-time platform check.

Comment thread src/Features/ExtendedTranslucency.cpp
Comment thread src/Features/ExtendedTranslucency.cpp
Comment thread src/Features/ExtendedTranslucency.h
@github-actions
Copy link
Copy Markdown

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

@ArcEarth
Copy link
Copy Markdown
Contributor Author

@doodlum Fixed minor issues found by AI, and added support for UI refactoring.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
src/Features/ExtendedTranslucency.h (3)

13-13: Remove unnecessary semicolon after method definition.

The semicolon after the closing brace is unnecessary for method definitions and inconsistent with other methods in the class.

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

19-19: Remove unnecessary semicolon after method definition.

Consistent with line 13, this semicolon should be removed for style consistency.

-	virtual bool SupportsVR() override { return true; };
+	virtual bool SupportsVR() override { return true; }

44-44: Consider explicit enum conversion for clarity.

While the implicit conversion from enum to uint32_t works correctly, making it explicit would improve code clarity and match the pattern suggested in previous reviews.

-	uint32_t AlphaMode = MaterialModel::AnisotropicFabric;
+	uint32_t AlphaMode = static_cast<uint32_t>(MaterialModel::AnisotropicFabric);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 129d2ce and b368cac.

⛔ Files ignored due to path filters (1)
  • package/Shaders/Lighting.hlsl is excluded by !**/*.hlsl
📒 Files selected for processing (4)
  • features/Extended Translucency/Shaders/ExtendedTranslucency/ExtendedTranslucency.hlsli (1 hunks)
  • src/Features/ExtendedTranslucency.cpp (1 hunks)
  • src/Features/ExtendedTranslucency.h (1 hunks)
  • src/State.h (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/State.h
  • src/Features/ExtendedTranslucency.cpp
  • features/Extended Translucency/Shaders/ExtendedTranslucency/ExtendedTranslucency.hlsli
🔇 Additional comments (3)
src/Features/ExtendedTranslucency.h (3)

30-37: Well-designed MaterialModel enum with clear documentation.

The enum values are well-defined with meaningful names and helpful comments. The use of specific values (0, 1, 2, 3, 7) and the distinction between "Disabled" and "ForceDisabled" shows thoughtful design for the bit manipulation scheme.


42-48: Proper GPU buffer alignment and parameter organization.

The alignas(16) directive is appropriate for GPU constant buffer usage, and the parameter names and default values are sensible for translucency effects.


6-25: Comprehensive feature interface implementation.

The class properly implements all required Feature interface methods with appropriate overrides. The shader define targeting only the Lighting shader type is correct for this feature's scope.

@github-actions
Copy link
Copy Markdown

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

@ArcEarth
Copy link
Copy Markdown
Contributor Author

ArcEarth commented May 25, 2025

@doodlum Here is a AIO package for testing.
Please let me know if the one drive link does not work.
https://1drv.ms/u/c/4a6ce604809201e9/ESNyIC6EYvNHhJIY5kGgS_gBW5_wM9zYivn5Mra5CzLfkw?e=uC4VTD

@ArcEarth
Copy link
Copy Markdown
Contributor Author

ArcEarth commented Jun 6, 2025

@alandtse @doodlum
Sorry for pinging, wondering if there are anything I can do to help the review process?
I will need to travel around mid-June, and may not access the game for a month >_< Will be helpful if I can make changes before it :)

@alandtse
Copy link
Copy Markdown
Collaborator

alandtse commented Jun 6, 2025

Please also sync with the latest.

@doodlum
Copy link
Copy Markdown
Collaborator

doodlum commented Jun 6, 2025

@alandtse @doodlum
Sorry for pinging, wondering if there are anything I can do to help the review process?
I will need to travel around mid-June, and may not access the game for a month >_< Will be helpful if I can make changes before it :)

I am ill with COVID

Adding View Dependent Transparency methods to the game.
This effect will make transclucent surface more opaque when view direction is parallel to it.
The effect models regular fabric's transcluceny from the seams between threads.
The thickness of the threads will occlude the seams based on view angle.

Avoid frequent constant buffer update
- We now use 5 pre defined constant buffers which don't need update
- The only buffer update happens in setting menu
- Minor fixes addressed in review
- #if !defined(DEFERRED) cause the effect to disapper in one of my testing equipment, thus not included.

Use Permutation::ExtraFeatureDescriptor for material specification

Add memory fence after descriptor change

Nif extra data can now disable this effect

style: 🎨 apply clang-format changes

Fix issues from AI review

style: 🎨 apply clang-format changes
@ArcEarth ArcEarth force-pushed the extended_transcluency branch from b368cac to 1754485 Compare June 15, 2025 18:41
@ArcEarth
Copy link
Copy Markdown
Contributor Author

ArcEarth commented Jun 15, 2025

@alandtse
Synched to the latest. Everything is still working.
Sorry for replying late, was busy preparing my moving >_<
@doodlum
Hope you get a quick recovery! The community cannot go without you :)

@github-actions
Copy link
Copy Markdown

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

Copy link
Copy Markdown
Collaborator

@doodlum doodlum left a comment

Choose a reason for hiding this comment

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

This seems to work as expected. I do not really understand why there are settings but it's whatever I guess, sort of like SSS settings.

@doodlum doodlum merged commit 02dc8e5 into community-shaders:dev Jun 23, 2025
10 checks passed
@jiayev
Copy link
Copy Markdown
Collaborator

jiayev commented Jun 23, 2025

nice, also consider adding feature desc

@ArcEarth
Copy link
Copy Markdown
Contributor Author

😂 Glad to see it's merged! Thank you a lot! 🎊
I'm travelling but will prepare the mod page and docs once I get a working pc ;)

@alandtse
Copy link
Copy Markdown
Collaborator

If you can get the link for the unpublished nexus page, we can update the link inside CS to cover it. We also can put in a short description if you provide some details.

@ArcEarth
Copy link
Copy Markdown
Contributor Author

@alandtse That's amazing! Btw, I have already added the NexusURL/description in the feature's header file, following format in CS UI rework PR 😉
Let me know when you have a release schedule, I'll be preparing the mod page for it (hope i can find a PC soon 😭)

@alandtse
Copy link
Copy Markdown
Collaborator

Ahh I remember now. We also simplified the format so all you need now is modid but this should be fine too.

@alandtse
Copy link
Copy Markdown
Collaborator

alandtse commented Jul 3, 2025

@ArcEarth we've had a bug report #1230. We'd appreciate it if you did take a look. We're also on Discord if you're willing to join and we can speak there directly in the developers-only channel.

@ArcEarth
Copy link
Copy Markdown
Contributor Author

ArcEarth commented Jul 3, 2025

@ArcEarth we've had a bug report #1230. We'd appreciate it if you did take a look. We're also on Discord if you're willing to join and we can speak there directly in the developers-only channel.

Let me check :)

alandtse pushed a commit to alandtse/open-shaders that referenced this pull request Jul 20, 2025
Adding View Dependent Transparency methods to the game.
This effect will make transclucent surface more opaque when view direction is parallel to it.
The effect models regular fabric's transcluceny from the seams between threads.
The thickness of the threads will occlude the seams based on view angle.

Avoid frequent constant buffer update
- We now use 5 pre defined constant buffers which don't need update
- The only buffer update happens in setting menu
- Minor fixes addressed in review
- #if !defined(DEFERRED) cause the effect to disapper in one of my testing equipment, thus not included.

Use Permutation::ExtraFeatureDescriptor for material specification

Add memory fence after descriptor change

Nif extra data can now disable this effect

style: 🎨 apply clang-format changes

Fix issues from AI review

style: 🎨 apply clang-format changes
@coderabbitai coderabbitai Bot mentioned this pull request Nov 17, 2025
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.

6 participants