Editor icon indicating copy to clipboard operation
Editor copied to clipboard

Material File Broken

Open seb776 opened this issue 2 years ago • 5 comments

Hello There,

I am facing an issue trying to create a material with custom code.

There is no documentation on how to do this with the editor but I think I found how to handle it. Here's the steps :

  • Create a "Material File" by right clicking in src
  • Add the proper import in index.ts
  • The editor automatically asks for the name we want to give to the material
  • It then update / loads
  • The thumbnail displays a broken icon
  • When assigning the material to an object it's invisible

No errors in the console, webpack or typescript logs.

I have the issue with Editor 4.5.0 and 4.6.0, I tried babylonJS 5.19.0 update in package.json with no luck.

At first I thought my shader code was the culprit but I have the same bahviour when I keep the code generated by right clicking -> Material File.

Is this a known issue ? Is there a way to make it work ?

Thanks !

seb776 avatar Mar 17 '23 16:03 seb776

I experience the same issue. There seems to be no documentation whatsoever on this feature. I can upload a sample project, but it can be reproduced using a barebone project (Empty workspace template) . Changing properties of existing materials such as the color might also cause the preview to break.

StanleySweet avatar Mar 17 '23 16:03 StanleySweet

Hey,

You are right that it's not documented. We are using PBR custom materials at work and they seem to work. Which kind of material did you try to create ? Standard based ? Custom based ? PBR based ?

julien-moreau avatar May 18 '23 12:05 julien-moreau

I don't really remember what kind of material it was bug we can try recreate the bug I think, @StanleySweet did you kept the repro project ?

seb776 avatar May 18 '23 13:05 seb776

I have this one, which was broken TestBabylon - Copy.zip

StanleySweet avatar May 18 '23 13:05 StanleySweet

I'm sorry the template was not updated but got it working by replacing these lines:

// Clip plane
// MaterialHelper.BindClipPlane(this._activeEffect, scene);
bindClipPlane(this._activeEffect, this, scene);

and

// MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);
MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);
Capture d’écran 2023-05-18 à 15 33 40

julien-moreau avatar May 18 '23 13:05 julien-moreau

Nice, when was it fixed?

StanleySweet avatar Feb 10 '25 20:02 StanleySweet