Search Issue Tracker
By Design
Votes
0
Found in [Package]
10.1.0-preview.5
Issue ID
1268504
Regression
No
Setting Material Color and Surface Type using MaterialPropertyBlock does not work when Surface Type is set to Transparent
How to reproduce:
1. Create a new HDRP Template project
2. Import the attached script named "MaterialTest.cs"
3. Click MaterialTest - > Create
4. Observe the two created Spheres in the Scene window
Expected result: One of the Spheres is rendered transparent with a red tint
Actual result: The Sphere is rendered either Opaque or extremely emissive depending on which Color constructor is used
Reproducible with: 2018.4.26f1(4.10.0), 2019.4.8f1(7.4.3), 2020.1.2f1(8.2.0), 2020.2.0a21(10.0.0-preview.27, 10.1.0-preview.5)
Notes:
1. If unityMaterial.SetColor("_BaseColor", new Color(128, 0, 0, 0f)) is used, the Sphere becomes extremely emissive. This is fixed by opening the material instance's properties and manually setting the same color using the Color wheel
2. If unityMaterial.SetColor("_BaseColor", new Color(1, 0, 0, 0f)) is used, the Sphere becomes opaque. This is fixed by by expanding material's properties
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Memory leak when a lot of UI elements are spawned and despawned
- Warnings are not logged in the Console window when using external code analyzers
- Errors “TLS Allocator ALLOC_TEMP_TLS, underlying allocator ALLOC_TEMP_MAIN has unfreed allocations, size 288“ appear constantly when Prefab is open
- Crash on PPtr<Shader>::operator or NullException errors spammed in console when calling Dispose() on null GraphicsBuffer with baked Reflection Probes
- “EndRenderPass: Not inside a Renderpass” and other Render Graph errors in the Player when Render Graph is enabled and Overlay UI is used
Resolution Note:
The attached project has some mistakes in the material creation pattern. Certain keywords were missing that are mandatory for setting up a transparent object, which in turn caused the reported behavior.
We have decided that new c# helpers would make it easier to create materials from a script and avoid similar situations. This idea was added to our roadmaps, but currently, there is no ETA available when this new feature would land.