Closed MetaverseUnknower closed 8 months ago
@pravusjif brought to my attention that this is actually the result of using '0' in the object's scale. In my case it was on the Z axis. So a workaround is to use something slightly higher than 0.
My observation about this being related to code within a library was incorrect. This is actually true both for objects created within a library or directly within a host project.
@MetaverseUnknower I'm closing this issue, as it's related to the renderer and to having models with z axis = 0 We've now added a warning about this in the docs
Issue Description:
setPbrMaterial()
works as expected from the host projectsetPbrMaterial()
works as expected when using a video texture (Material.Texture.Video()) from within the library.setBasicMaterial()
also works as expected with a common texture (Material.Texture.Common()) from within my library.However, when using
setPbrMaterial()
withMaterial.Texture.Common()
from within the library, the albedoColor gets blown out and causes a lens flareThis seems to have something to do with the
metallic
andalbedoColor
attributes. WhenalbedoColor
is changed, the lens flare changes in color. Whenmetallic
is exactly 1, the lens flare disappears. Every other number will cause the lens flare, including 0.999...SDK:
Tool:
CLI Version:
@dcl-sdk/utils@1.1.3 @dcl/ecs@7.3.28 Node Version: v16.20.1
Steps to reproduce:
Material.Texture.Common()
andMaterial.setPbrMaterial()
Expected behaviour:
An image created by the NPM module shows with the correct texture settings, matching an image created within the host project
Current behaviour:
An image created by the NPM module shows a lens flare:
If bloom is disabled, image is only a white plane:![Screenshot 2023-11-29 at 10 38 29 PM](https://github.com/decentraland/sdk/assets/96612915/1b07bfc2-1c34-4b48-a322-d513734479bd)
In the Mac desktop client, there is no lens flare but the image appears black even when albedoColor and reflectivityColor are set to white and emissiveColor is set to black.
Reproduction rate:
Always
Code Snippets:
Texture Options (metallic <1, albedoColor = Red):![Screenshot 2023-11-29 at 11 52 06 PM](https://github.com/decentraland/sdk/assets/96612915/36680203-fdbf-411b-a09e-f489445ad8c2)
Texture Options (metallic === 1, albedoColor = Black):![Screenshot 2023-11-29 at 11 53 03 PM](https://github.com/decentraland/sdk/assets/96612915/3fd0ee82-ba0a-4df2-b787-e05fcb92a1c0)
Platforms:
Browser:
Environment:
Evidence:
Results:
metallic <1, albedoColor = Red![Screenshot 2023-11-29 at 11 52 18 PM](https://github.com/decentraland/sdk/assets/96612915/d38ed9cf-e532-457a-80fc-3ccc954fb930)
metallic === 1, albedoColor = Black![Screenshot 2023-11-29 at 11 53 07 PM](https://github.com/decentraland/sdk/assets/96612915/8009b3ea-d73c-466b-980f-5c89167f037c)
Additional Notes:
Contact me on Discord at
unknower
for discussion or reproduction of the issueVLM creates images through services. The MaterialService class utilizes the Material import.
The implementation can be found below:
First we build the texture options, parsing an object from an external server: https://github.com/virtuallandmanager/vlm-dcl/blob/df2551b5c7fdceb60d10c634cd538bc640c479f0/src/components/VLMImage.component.ts#L58
Then we apply the material through the material service: https://github.com/virtuallandmanager/vlm-dcl/blob/df2551b5c7fdceb60d10c634cd538bc640c479f0/src/components/VLMImage.component.ts#L218
Texture options are set within this method: https://github.com/virtuallandmanager/vlm-dcl/blob/df2551b5c7fdceb60d10c634cd538bc640c479f0/src/services/Material.service.ts#L60
Material is applied within this method: https://github.com/virtuallandmanager/vlm-dcl/blob/df2551b5c7fdceb60d10c634cd538bc640c479f0/src/services/Material.service.ts#L17