Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Thin glass and SpriteStudio blend states lose their blend factors

Open Beginner friendly
#3,498 0 comments 0 reactions 0 assignees View on GitHub

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

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

bug

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

  1. Create a material with MaterialSpecularThinGlassModelFeature, as in the engine's glass sample material.
  2. Put an opaque object behind it.
  3. 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.BlendState on the even passes after Material.New.
Dominant language
C#
Stars
7.8k
Forks
1.2k
Avg merge
1d 8h
Merged PRs (30d)
64

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stride3d/stride

All issues in stride3d/stride

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.