mrjs icon indicating copy to clipboard operation
mrjs copied to clipboard

notes - figure out why we have way too many draw calls / fix for reducing the number of redundant glPrograms

Open hanbollar opened this issue 1 year ago • 9 comments

Linking

related to #651

Problem

Description of the problem including potential code and/or screenshots as an example

Solution

Quick explanation of change to be done

Breaking Change

If this is a breaking change describe the before and after and why the change was necessary

Notes

Notes and any associated research or links


Required to Merge

  • [ ] PASS - all necessary actions must pass (excluding the auto-skipped ones)
  • [ ] TEST IN HEADSET - main dev-testing-example and any of the other examples still work as expected
  • [ ] VIDEO - if this pr changes something visually - post a video here of it in headset-MR and/or on desktop (depending on what it affects) for the reviewer to reference.
  • [ ] TITLE - make sure the pr's title is updated appropriately as it will be used to name the commit on merge
  • [ ] BREAKING CHANGE
    • DOCUMENTATION: This includes any changes to html tags and their components
      • make a pr in the documentation repo that updates the manual docs to match the breaking change
      • link the pr of the documentation repo here: #pr
      • that pr must be approved by @lobau
    • SAMPLES/INDEX.HTML: This includes any changes (html tags or otherwise) that must be done to our landing page submodule as an effect of this pr's updates
      • make a pr in the mrjs landing page repo that updates the landing page to match the breaking change
      • link the pr of the landing page repo here: #pr
      • that pr must be approved by @hanbollar

hanbollar avatar May 13 '24 20:05 hanbollar

Your Render PR Server URL is https://examples-mrjs-pr-652.onrender.com.

Follow its progress at https://dashboard.render.com/static/srv-cp17fegl6cac73emhid0.

render[bot] avatar May 13 '24 20:05 render[bot]

the issue

the issue is due to too many materials being created with new that are redundant to each other - where their differences are just selected uniform variables

the supposed fix i found

instead of doing new everywhere, we should grabbing from a catalogue of materials unless a user creates something specific (for normal and debug items) and use the uniforms properly for differences.


implementing now to confirm

hanbollar avatar May 13 '24 21:05 hanbollar

down from 22 --> 14 draw calls --> still looking into

Screenshot 2024-05-13 at 3 13 30 PM

hanbollar avatar May 13 '24 22:05 hanbollar

Screenshot 2024-05-13 at 7 28 31 PM

still looking into ways to reduce the number of glPrograms, but here's where we're at for now

hanbollar avatar May 14 '24 02:05 hanbollar

Screenshot 2024-05-16 at 5 11 50 PM

hanbollar avatar May 17 '24 00:05 hanbollar

Screenshot 2024-05-16 at 5 33 32 PM

same out come

hanbollar avatar May 17 '24 00:05 hanbollar

  • number of draw calls depends on number of models in scene with differing materials (including text and otherwise)
  • draw call count changes depending on what is within frustum area
  • glprogram count increases as scene loads in (and scroll down to new items) - until has loaded int data all items from scene

things to do:

  • [ ] see if can optimize troika material setup / reusability
  • [ ] instancing geometry (that's a future pr)
  • [ ] LOD - i think we're okay on this being something user specified if they want to define that in the scene directly

hanbollar avatar May 17 '24 01:05 hanbollar

  • number of draw calls depends on number of models in scene with differing materials (including text and otherwise)
  • draw call count changes depending on what is within frustum area
  • glprogram count increases as scene loads in (and scroll down to new items) - until has loaded int data all items from scene

things to do:

  • [ ] see if can optimize troika material setup / reusability
  • [ ] instancing geometry (that's a future pr)
  • [ ] LOD - i think we're okay on this being something user specified if they want to define that in the scene directly

we're going to need an actual material caching system setup - same thing with geometry instancing

hanbollar avatar May 17 '24 01:05 hanbollar

turning this into a draft since we'll be doing a rework of MeshInstancing and MaterialInstancing in a future pr and those are super relevant to this getting improved

hanbollar avatar May 18 '24 04:05 hanbollar