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
- Value of the "OnApplicationFocus" is "True" when Player loses the focus before it launches
- .mp3 playback position is inaccurate when loaded with .streamAudio while in Play Mode
- DateTime.Now returned time is 1 hour behind when system time zone is set to Morocco
- Media Encoder produces incorrectly muxed WebM videos by improperly distinguishing I-frames from P-frames when encoding with alpha channel
- "State comes from an incompatible keyword space" errors are thrown when saving changes in Shader Graph where sprite is casted as a shadow
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.