Thin glass and SpriteStudio blend states lose their blend factors
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- csharp
- Domain
- computer-graphics, game-dev
Research direction
Inspect the blend-state assignments at the reported lines in MaterialSpecularThinGlassModelFeature.cs and SpriteStudioRenderFeature.cs. Start by comparing the current RenderTargets[0] replacement with the 4.3 nested initializer, then verify the thin-glass sample and the three states retain their intended colour and alpha blend factors without replacing the struct.
Written by the indexing model from the issue text.
Description
Release Type: Official Release
Version: 4.4.0-beta1 to 4.4.0-beta8, and master at 062a8c76f. 4.3 is not affected
Platform(s): All
Describe the bug
Three blend states are built with the BlendStateDescription(source, destination) constructor and then
have render target 0 replaced by a new BlendStateRenderTargetDescription. The new struct carries the
default values, so the factors set by the constructor are lost.
| File | Blend state |
|---|---|
MaterialSpecularThinGlassModelFeature.cs, line 67 |
Thin glass transmittance pass |
SpriteStudioRenderFeature.cs, line 30 |
SubBlendState |
SpriteStudioRenderFeature.cs, line 39 |
MultBlendState |
All three come from commit b2eafab19 (2025-06-28), which replaced a nested initializer with an
assignment.
Before (4.3, correct)
context.MaterialPass.BlendState = new BlendStateDescription(Blend.Zero, Blend.SourceColor)
{
RenderTarget0 = { AlphaSourceBlend = Blend.One, AlphaDestinationBlend = Blend.Zero }
};
Result: enabled, colour Zero / SourceColor, alpha One / Zero.
After (4.4, current)
var blendState = new BlendStateDescription(sourceBlend: Blend.Zero, destinationBlend: Blend.SourceColor);
blendState.RenderTargets[0] = new BlendStateRenderTargetDescription { AlphaSourceBlend = Blend.One, AlphaDestinationBlend = Blend.Zero };
Result: disabled, colour One / Zero, alpha One / Zero.
Fix
var blendState = new BlendStateDescription(sourceBlend: Blend.Zero, destinationBlend: Blend.SourceColor);
blendState.RenderTargets[0].AlphaSourceBlend = Blend.One;
blendState.RenderTargets[0].AlphaDestinationBlend = Blend.Zero;
The same change applies to the two SpriteStudio states: set the fields on RenderTargets[0] and do not
assign a new struct.
To Reproduce
- Create a material with
MaterialSpecularThinGlassModelFeature, as in the engine's glass sample material. - Put an opaque object behind it.
- Run. The glass renders as an opaque surface and hides the object.
Pass states of the generated material, printed at runtime on 4.4.0-beta8:
pass 0: transparency=True cull=Back blend=One/Zero enabled=False
pass 1: transparency=True cull=Back blend=SourceAlpha/One enabled=True
pass 2: transparency=True cull=Front blend=One/Zero enabled=False
pass 3: transparency=True cull=Front blend=SourceAlpha/One enabled=True
Passes 0 and 2 are the transmittance passes.
Expected behavior
The transmittance passes multiply what is behind the glass: enabled, colour Zero / SourceColor.
Screenshots
N/A
Log and callstacks
N/A
Additional context
- The SpriteStudio states are read from the code. I have not run the SpriteStudio renderer.
- Workaround for thin glass: set
pass.BlendStateon the even passes afterMaterial.New.
- Dominant language
- C#
- Stars
- 7.8k
- Forks
- 1.2k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 64
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from stride3d/stride
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
stride3d/stride#3386 · 7 comments ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
stride3d/stride#3384 · 1 comment ·
Maintainers usually reply within 1 day
-
area-Samples bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
stride3d/stride#3066 · 6 comments ·
Maintainers usually reply within 1 day
-
area-Doc
Difficulty 1/5 Under an hour Newbie friendliness 78/100
stride3d/stride#2452 · 4 comments ·
Maintainers usually reply within 1 day
Similar issues
-
area-ai untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
dotnet/extensions#7790 ·
Maintainers usually reply within 1 day
-
P2 testing
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
area-Infrastructure-coreclr os-ios os-maccatalyst os-tvos untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
dotnet/runtime#134766 · 3 comments ·
Maintainers usually reply within 1 day
-
0 - Backlog Bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
BrighterCommand/Brighter#4444 ·
Maintainers usually reply within 1 day
-
area:frontend bug FE P3
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
klasolsson81/jobbliggaren#1915 ·
Maintainers usually reply within 1 day