-
Notifications
You must be signed in to change notification settings - Fork 92
feat(extended translucency): "scattering volume" material #1350
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
base: dev
Are you sure you want to change the base?
Conversation
WalkthroughThe changes split the previous Changes
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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Poem
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 detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
⏰ 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)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
|
✅ A pre-release build is available for this PR: |
|
The commit title is a bit confusing. Is this a new feature? Fix? Etc. |
|
🤣added a little sauce to the fixes, I can split the change or rename it :) |
|
You don't have to but fixes get merged very quickly. Feats generally get held. |
|
anything to test with? |
that stellar blade suit by predator |
|
Will prepare some official looking material-spheres for showcase all the different material later (really need some sleep today 😂). 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? 😂 |
features/Extended Translucency/Shaders/ExtendedTranslucency/ExtendedTranslucency.hlsli
Outdated
Show resolved
Hide resolved
|
I have split the fixes into #1365 for easier review. |
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.
b258f76 to
2d14322
Compare
|
|
||
| float GetViewDependentAlphaScatteringVolume(float alpha, float3 view, float3 normal) | ||
| { | ||
| return 1.0 - pow(1.0 - alpha, dot(view, normal)); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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
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, orSetActorAlpha.But it does not work out of the box yet:
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Improvements
Bug Fixes