BabylonJS / Editor

Community managed visual editor for Babylon.js
http://editor.babylonjs.com/
811 stars 231 forks source link

Material File Broken #422

Open seb776 opened 1 year ago

seb776 commented 1 year ago

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 :

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 commented 1 year ago

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 commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

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

julien-moreau commented 11 months ago

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