Jump to content

CustomMaterial and onBindObservable loop to infinity


Dad72
 Share

Recommended Posts

I get a lot of errors with CustomMaterial and on my project it makes a lot of shifting and even crashing the page.

I have a huge drop in FPS going up and down constantly. I'm going to have 15 fps 2, 3 seconds, then 55, then 50, then 10, then 60. In short, it's random and a little later, the page crashes.

If, I do not use CustomMateriel for verification purposes that this is the problem or not, I do not have these delays.

I guess CustomMateriel has optimization problems

The errors I receive are:

Quote

[.Offscreen-For-WebGL-000001C312A51F00] AVERTISSEMENT RENDU: aucune texture n'est liée à l'unité 5
 [.Offscreen-For-WebGL-000001C312A51F00] ATTENTION: la texture liée à l'unité de texture 6 n'est pas rendue. Il peut être non-power-of-2 et avoir un filtrage de texture incompatible.
 [.Offscreen-For-WebGL-000001C312A51F00] AVERTISSEMENT DE RENDU: la texture liée à l'unité de texture 7 n'est pas rendue. Il peut être non-power-of-2 et avoir un filtrage de texture incompatible.
 [.Offscreen-For-WebGL-000001C312A51F00] AVERTISSEMENT RENDU: la texture liée à l'unité de texture 8 n'est pas rendue. Il peut être non-power-of-2 et avoir un filtrage de texture incompatible.
 [.Offscreen-For-WebGL-000001C312A51F00] AVERTISSEMENT RENDU: la texture liée à l'unité de texture 9 n'est pas rendue. Il peut être non-power-of-2 et avoir un filtrage de texture incompatible.
 [.Offscreen-For-WebGL-000001C312A51F00] AVERTISSEMENT RENDU: la texture liée à l'unité de texture 10 n'est pas rendue. Il peut être non-power-of-2 et avoir un filtrage de texture incompatible.
 [.Offscreen-For-WebGL-000001C312A51F00] AVERTISSEMENT RENDU: la texture liée à l'unité de texture 11 n'est pas rendue. Il peut être non-power-of-2 et avoir un filtrage de texture incompatible.
 [.Offscreen-For-WebGL-000001C312A51F00] AVERTISSEMENT RENDU: la texture liée à l'unité de texture 12 n'est pas rendue. Il peut être non-power-of-2 et avoir un filtrage de texture incompatible.
 [.Offscreen-For-WebGL-000001C312A51F00] AVERTISSEMENT DE RENDU: la texture liée à l'unité de texture 13 n'est pas rendue. Il peut être non-power-of-2 et avoir un filtrage de texture incompatible.

On my project I have his mistakes there in addition that appears randomly on the PG

Quote

[.Offscreen-For-WebGL-0000026D37EF1FA0] AVERTISSEMENT RENDU: il n'y a pas de texture liée à l'unité 0
(index): 1 WebGL: trop d'erreurs, plus d'erreurs seront rapportées à la console pour ce contexte.

Voici le PG:

http://www.babylonjs-playground.com/#ICIAGK#15

Link to comment
Share on other sites

In fact I notice that the number of texture increases very quickly and I find myself with more than 100 000 000  of textures.

Because of this :

terrainMaterial.onBindObservable.add(() => {
    terrainMaterial.getEffect().setTexture('texture', new BABYLON.Texture("texture.png", scene));
};

It's an infinite loop that loads the textures infinitely. The textures instead of being loaded once, have it infinite to plant the page.

Link to comment
Share on other sites

The ground is black Pryme. It does not work.

It works if I do as before with clear() But it is not the right solution even if it works in part.

http://www.babylonjs-playground.com/#ICIAGK#20

By cons I use only 11 textures and it tells me that I use 43 to 59 ??? There is a problem of calculation. Bug ?

this loads the textures 5 times for each in onBindObservable.

Nothing else works only onBindObservable. Is this a problem in CustomMaterial?

Link to comment
Share on other sites

You can keep it, just remove the instanciation:

var texture = new BABYLON.Texture("texture.png", scene);
terrainMaterial.onBindObservable.add(() => {
    terrainMaterial.getEffect().setTexture('texture', texture );
};

 

Link to comment
Share on other sites

1 hour ago, Dad72 said:

Ok, that's something to know. If we instantiate a texture in the onBindObservable we end up with an infinite loop therefore.

Thank you Deltakosh

I actually think this might solve the trouble I have been having as well.

Link to comment
Share on other sites

17 hours ago, Deltakosh said:

You can keep it, just remove the instanciation:


var texture = new BABYLON.Texture("texture.png", scene);
terrainMaterial.onBindObservable.add(() => {
    terrainMaterial.getEffect().setTexture('texture', texture );
};

No, it does not work better. I have the number of corresponding textures (that's ok) but setTexture () is run in infinite loop so that I end up with a loading of the terrain with a texturing randomly.

I turn at 1 FPS. There is really a problem Dk. It's been at least 8 months that I use onBindObservable in this way that Nasinmi advised me to use and I never had this problem. But since a few weeks, can be (I do not check my projects every day working on other) then, that's not good anymore.

All my projects are broken: HeroonEngine, TerrainEditor, and another project that I'm working on too ... I can not fix them.

It worked for several months, why not now? I almost want to abandon all my projects that I fail to make them work as before. I lost 100% of users because of this, without realizing it. No other solution that onBindObservable works, it's the only thing I can use it seems. When you advise me, it works well, why now it would be a bad idea.

I am convinced that there is a bug somewhere that I can not say where and how, but it has always worked well for more than 6 months or 1 year. Why would it be normal that I have his problems on all my projects. They are all unusable, but they have worked for a long time.

Thank you Dk to check, there is really a problem that is huge.

See this PG and in the console : 

http://www.babylonjs-playground.com/#ICIAGK#23

I still have his mistakes in the console?

Quote

[.Offscreen-For-WebGL-000001D42CD40130]RENDER WARNING: there is no texture bound to the unit 6
/#ICIAGK#21:1 [.Offscreen-For-WebGL-000001D42CD40130]RENDER WARNING: texture bound to texture unit 7 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#ICIAGK#21:1 [.Offscreen-For-WebGL-000001D42CD40130]RENDER WARNING: texture bound to texture unit 8 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#ICIAGK#21:1 [.Offscreen-For-WebGL-000001D42CD40130]RENDER WARNING: texture bound to texture unit 9 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#ICIAGK#21:1 [.Offscreen-For-WebGL-000001D42CD40130]RENDER WARNING: texture bound to texture unit 10 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#ICIAGK#21:1 [.Offscreen-For-WebGL-000001D42CD40130]RENDER WARNING: texture bound to texture unit 11 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#ICIAGK#21:1 [.Offscreen-For-WebGL-000001D42CD40130]RENDER WARNING: texture bound to texture unit 12 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#ICIAGK#21:1 [.Offscreen-For-WebGL-000001D42CD40130]RENDER WARNING: texture bound to texture unit 13 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
/#ICIAGK#21:1 [.Offscreen-For-WebGL-000001D42CD40130]RENDER WARNING: texture bound to texture unit 14 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.

 

Link to comment
Share on other sites

I'm so sorry guys but the CustomMaterial is not a project I'm supporting. I'm ok to help of course but I have already a lot to do with the framework itself

Please ping @NasimiAslfor help

The error I'm seeing are not linked to the onBindObservable

Link to comment
Share on other sites

I think I have more to close all my projects that does not work anymore and where everything depends on CustomMaterial. Unless Nasimi can do something, but I have the impression that it will still take several weeks or months before this is fixed and in the meantime my projects are out of order, I can not do anything and I pass for that who does not care about its users, but hey I think there are more users, so more problem.:(

Link to comment
Share on other sites

 

hi sorry i see that so late

problem

1. onBindObservable run in each frame

2. onBindObservable is only way to update texture uniform in CustomMaterial

solution  1

make counter for each texture ready and stop update your textures after that called one time :D

solution 2 

make new method in standard material for do update texture (specifically) for custom material

 * that method be exist in old version babylonJS but that is not optimized

http://www.babylonjs-playground.com/#ICIAGK#24

ping @Dad72

Link to comment
Share on other sites

Thank you @NasimiAsl I'm not sure this is a final solution, something should be done in CustomMateriel I think. You can add functions in CustomMateriel as it is extended from StandardMaterial. This currently seems like a half-way fix solution because sometimes a texture is black, but not all and sometimes it works well.

Otherwise I have another bug (which exists since the old version): When I create a light after the scene is created, the terrain becomes black. See this PG:

Light not work:  http://www.babylonjs-playground.com/#ICIAGK#26

Also getEffect (). SetVector2 () seems to no longer work on my projects (it worked before) See this PG:

setVector2 not workhttp://www.babylonjs-playground.com/#ICIAGK#27

The fog and shadow seems to work.

Thank you Nasimi.

Link to comment
Share on other sites

hi

if we cant fix that in standard material we cant fix that in custom material too

because we can overwrite any standard material function   and  all effect management  be accessed inside of that 

i fixed in that step  but  we have this conversation before  and i see a lot changes in standard material and

i most check it and find reason 

so i most check it in weekend   fix that again

 

 

 

Link to comment
Share on other sites

On 4/20/2018 at 8:31 PM, Deltakosh said:

I'm so sorry guys but the CustomMaterial is not a project I'm supporting. I'm ok to help of course but I have already a lot to do with the framework itself

Please ping @NasimiAslfor help

The error I'm seeing are not linked to the onBindObservable

it is time to make interface for classes :)

 

Link to comment
Share on other sites

19 hours ago, NasimiAsl said:

so i most check it in weekend   fix that again

Thank you. CustomMaterial is almost perfect, it missing some retouching to stabilize it:

  •  The addition of light and also when we remove a light
  • The setVector2() that does not work anymore
  • uniform texture update (setTexture()) in onBindObservable
  • the errors : RENDER WARNING: there is no texture bound to the unit num x

I think CustomMaterial should be flawless then 

On 20/04/2018 at 6:01 PM, Deltakosh said:

The error I'm seeing are not linked to the onBindObservable

Do you have an error track that you see to help Nasimi find/fix the error ?

Link to comment
Share on other sites

Hey d72... if you use a slightly-older version of the framework, will your products work again?

That might provide less stress, temporarily, right?  Perhaps this subject needs some added think-time.

Does anyone have a link to the PR that did the framework change... that started this add-on/extension backward-compat problem?

Was the reason for that PR/change... told/detailed, there? 

If not, can somebody explain the reasons?  ( I probably would not understand them, though. )  :)

I understand BJS workload overload... as DK describes.  It happened with me with BJS docs.  I needed to quit working on docs... so I could learn the framework.  I had task overload, and the BJS enjoyment levels were dropping.  :o

I hope we can all be kind to each other.  Dad72... put me to work on something helpful.  Can I do/collect some research that will help?  I can make/publish a webpage about this issue... all pertinent links, begging for ideas/work-arounds.   I can also, simply, buy the beer for my think-tank friends, if that would help.  :) 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...