-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Add overrideMaterialFillMode property to Mesh #13688
Conversation
…fined by material
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
Snapshot stored with reference name: Test environment: To test a playground add it to the URL, for example: https://babylonsnapshots.z22.web.core.windows.net/refs/pull/13688/merge/index.html#WGZLGJ#4600 Links to test babylon tools with this snapshot: https://playground.babylonjs.com/?snapshot=refs/pull/13688/merge To test the snapshot in the playground with a playground ID add it after the snapshot query string: https://playground.babylonjs.com/?snapshot=refs/pull/13688/merge#BCU1XR#0 |
Thanks for the PR! However, I wonder why you put To mimic what we have for alpha blending, with cc @sebavan to get his opinion. Regarding:
I don't think you can change the 128 limit, I seem to remember that it's a limit in Chrome where things get much slower because the object is not stored/managed internally in the same way when the number of properties reaches that limit... Instead of adding |
Because Say, take a look at:
Right now it is pretty short and clear:
Interesting. I'll take a look if I can figure that out. |
What bothers me is that conceptually, Let's see what @sebavan thinks. |
Yeah I understand. I was spending quite bit of time trying to think how to do it myself. A plain function would require adding imports everywhere. Mesh or Material submethod requires calling Anyway, how I ended up thinking of it is just a @internal helper function. Its not a getter or property tied to SubMesh itself. Just a helper function to get the required fillMode when dealing with SubMeshes. (Like all code parts that used fillMode were) |
…und 128 property limit
Pushed a fix for not using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @Popov72 I would as well prefer the fill mode on the mesh rather than the submesh.
I would also remove the scene parameter from it as it is only used once in scene. so we prevent extra checks in all the other cases.
Looking more closely the override seems to only be needed in 4 places:
- in _bind
- in _processRendering
- collide
- and in the depth peeling
For the first 2 If it all belongs to the mesh like _bind and _processRendering does, it could be computed inside ? I wonder if it would make things simpler
I already considered that but unfortunately I don't think that would work. If applied inside then:
|
Scene override is used by effectLayer._renderSubMesh() and mesh.render(), so yeah I suppose that is kind of redundant to centralize. Could make more sense if additional render paths that use it are added in future. I'll go ahead and move the helper function to Mesh and remove that scene arument then. |
Ok, did those changes now. Looks like it gained couple extra |
@MiikaH We gave this one more thoughts with @Popov72 earlier today and we think this could do it #13708 so instead of adding tons of feedback here I drafted it to discuss the difference before merging. It is all your code just remapped a tiny bit without the part not related to the rendering (as we figured those info are really geometry based) What do you think ? |
As discussed in forum thread here: https://forum.babylonjs.com/t/add-mesh-overridematerialfillmode/39475/
It seems to work fine for playground
/#WX0F9G
. The model has 2 meshes, each with bunch of instances, both share same material. The playground example changesoverrideMaterialFillMode
on the other mesh only.