Skip to content

Conversation

@ArcEarth
Copy link
Contributor

@ArcEarth ArcEarth commented Aug 2, 2025

Adding a new material model to the feature: ScatteringVolume
This material is modeled after a ball of smoke, which scattering light exponentially
through it.

It is unique because its the first material model that "fade out" the mesh,
instead of strengthening its edges.

This material was originally designed for Ghost, or SetActorAlpha.
But it does not work out of the box yet:

  1. The EffectShader of a regular ghost is way too strong, making it hard to see difference in the mesh's rendering.
  2. We disabled this effect in SKIN shader to avoid rendering issue with makeup and face details.

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added a new "Scattering Volume" material mode for extended translucency effects.
    • Included "Scattering Volume" option in the material model selection with updated descriptive tooltips.
  • Improvements

    • Improved alpha handling for anisotropic materials with view-dependent alpha adjustments.
    • Refined transparency behavior for scattering volume materials with view-dependent fading.
  • Bug Fixes

    • Ensured alpha values are properly clamped for improved visual consistency.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 2, 2025

Walkthrough

The changes split the previous Disabled material model into ScatteringVolume and a new Disabled with updated values, add a view-dependent alpha computation function, modify shader alpha handling to include the new model, and extend UI elements and enums to support the new material mode.

Changes

Cohort / File(s) Change Summary
Material Model & Shader Function Updates
features/Extended Translucency/Shaders/ExtendedTranslucency/ExtendedTranslucency.hlsli
Split Disabled into ScatteringVolume (4) and Disabled (5); added GetViewDependentAlphaScatteringVolume function for view-dependent alpha calculation.
Shader Alpha Handling Update
package/Shaders/Lighting.hlsl
Adjusted alpha threshold and clamping in anisotropic alpha section; added handling for ScatteringVolume using new view-dependent alpha function.
Feature UI & Enum Extensions
src/Features/ExtendedTranslucency.cpp, src/Features/ExtendedTranslucency.h
Added ScatteringVolume enum value and description; updated UI combo box to include new material model with tooltip; updated feature summary text to mention the new model.

Sequence Diagram(s)

sequenceDiagram
    participant UI as User Interface
    participant Feature as ExtendedTranslucency Feature
    participant Shader as Shader Code

    UI->>Feature: User selects material model (e.g., "Scattering Volume")
    Feature->>Shader: Pass material model enum and settings
    Shader->>Shader: If model == ScatteringVolume<br>Call GetViewDependentAlphaScatteringVolume(alpha, view, normal)
    Shader-->>Feature: Return adjusted alpha value
    Feature-->>UI: Render with updated translucency effect
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • alandtse

Poem

A shimmer glows where shadows play,
Scattering light in a gentle way.
Enums split and shaders sing,
New translucency takes its wing.
Rabbits hop through code so bright,
Dancing softly in the light! 🐇✨

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.


📜 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 b258f76 and 2d14322.

📒 Files selected for processing (4)
  • features/Extended Translucency/Shaders/ExtendedTranslucency/ExtendedTranslucency.hlsli (2 hunks)
  • package/Shaders/Lighting.hlsl (2 hunks)
  • src/Features/ExtendedTranslucency.cpp (3 hunks)
  • src/Features/ExtendedTranslucency.h (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/Features/ExtendedTranslucency.cpp
  • features/Extended Translucency/Shaders/ExtendedTranslucency/ExtendedTranslucency.hlsli
  • src/Features/ExtendedTranslucency.h
  • package/Shaders/Lighting.hlsl
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Validate shader compilation (Flatrim, .github/configs/shader-validation.yaml)
  • GitHub Check: Validate shader compilation (VR, .github/configs/shader-validation-vr.yaml)
  • GitHub Check: Build plugin and addons
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.
  • 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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate unit tests to generate unit tests for 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.

@ArcEarth ArcEarth changed the title extended translucency fix collection feat(extended translucency): fix collection Aug 2, 2025
@github-actions
Copy link

github-actions bot commented Aug 2, 2025

Using provided base ref: 87a8408
Using base ref: 87a8408
Base commit date: 2025-08-07T23:50:38-07:00 (Thursday, August 07, 2025 11:50 PM)
No actionable suggestions for changed features.

@github-actions
Copy link

github-actions bot commented Aug 2, 2025

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

@alandtse
Copy link
Collaborator

alandtse commented Aug 2, 2025

The commit title is a bit confusing. Is this a new feature? Fix? Etc.

@ArcEarth
Copy link
Contributor Author

ArcEarth commented Aug 3, 2025

🤣added a little sauce to the fixes, I can split the change or rename it :)

@ArcEarth ArcEarth changed the title feat(extended translucency): fix collection feat(extended translucency): "ghost" material Aug 3, 2025
@alandtse
Copy link
Collaborator

alandtse commented Aug 3, 2025

You don't have to but fixes get merged very quickly. Feats generally get held.

@doodlum
Copy link
Owner

doodlum commented Aug 3, 2025

anything to test with?

@jiayev
Copy link
Collaborator

jiayev commented Aug 3, 2025

anything to test with?

that stellar blade suit by predator
https://mega.nz/folder/ejgGjYZS#h9WXWAJGWYNrAQQDQHo7pw/file/Du5ziIKQ

@ArcEarth
Copy link
Contributor Author

ArcEarth commented Aug 3, 2025

Will prepare some official looking material-spheres for showcase all the different material later (really need some sleep today 😂).
Currently, they can be seen in the alchemy table's bottles. I am trying to make them working on in game 'ghosts' status, but they apparently rendered with more tricks: ('setactoralpha' command + a effect shader), the actor alpha seems not interact with the shader at all (need more testing)

Beside the new "ghost" mode, the whole geometry alpha bug can be tested by predator's mod (its nif have no alpha property, just alpha=0.2)

Maybe I should split the change into a feature one and a fix one? 😂

@ArcEarth ArcEarth changed the title feat(extended translucency): "ghost" material feat(extended translucency): "scattering volume" material Aug 4, 2025
@ArcEarth
Copy link
Contributor Author

ArcEarth commented Aug 4, 2025

I have split the fixes into #1365 for easier review.
Will prepare more showcase of this new material model (alone with the old one) without blocking the fixes to go in :)

Adding a new material model to the feature: ScatteringVolume
This material is modeled after a ball of smoke, which scattering light exponentially
through it.

It is unique because its the first material model that "fade out" the mesh,
instead of strengthening its edges.

This material was originally designed for `Ghost`, or `SetActorAlpha`.
But it does not work out of the box yet:
1. The EffectShader of a regular ghost is way too strong, making it hard to see difference in the mesh's rendering.
2. We disabled this effect in SKIN shader to avoid rendering issue with makeup and face details.
@ArcEarth ArcEarth force-pushed the extended_translucency_dev branch from b258f76 to 2d14322 Compare August 8, 2025 15:26

float GetViewDependentAlphaScatteringVolume(float alpha, float3 view, float3 normal)
{
return 1.0 - pow(1.0 - alpha, dot(view, normal));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The distance a ray of light traveled in a sphere is 2R*cos(theta), which scatters light at exp(k*2R*cos(theta)) where k is a absorbing factor. k can be deduced from the input alpha, assuming its the transparency when viewing from its normal direction.
And the math turns out to be this simple...

" - Isotropic Fabric: Imaginary fabric weaved from threads in one direction, respect normal map, also works well for layer of glass panels.\n"
" - Anisotropic Fabric: Common fabric weaved from tangent and birnormal direction, ignores normal map.\n");
" - Anisotropic Fabric: Common fabric weaved from tangent and birnormal direction, ignores normal map.\n"
" - Scattering Volume: A **volumn** (instead of a layer) of light scattering or absoring material, it fade the geometry out at its edge instead of strength them like other material.\n");
Copy link
Collaborator

@Pentalimbed Pentalimbed Aug 12, 2025

Choose a reason for hiding this comment

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

Spelling and grammar mistakes:

  • volumn - volume
  • absoring - absorbing
  • what does "fade the geometry out at its edge instead of strength(en?) them" mean? It becomes more transparent towards the edges instead of the other way around?

I suggest you put your texts through a spell checker or LLM

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.

5 participants