Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Material File Broken #422

Open
seb776 opened this issue Mar 17, 2023 · 5 comments
Open

Material File Broken #422

seb776 opened this issue Mar 17, 2023 · 5 comments
Labels

Comments

@seb776
Copy link

seb776 commented Mar 17, 2023

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 !

@StanleySweet
Copy link

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.

@julien-moreau
Copy link
Contributor

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 ?

@seb776
Copy link
Author

seb776 commented May 18, 2023

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 ?

@StanleySweet
Copy link

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

@julien-moreau
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants