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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
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.