Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if it's dynamically built it's fine because enable / disable can invalidate the combined mesh and request a recalculation.. something like this maybe:
- 1. you load a cell and at first you don't have any precombined meshes, it requests a recalculation of cell (at this point we use regular meshes for drawing that aren't combined yet, this results in many draw calls), this request to recalculate is pushed on another thread so your main render thread is not affected by this (it would cause stutter)
- 2. another thread is combining the meshes that it can
- 3. when the other thread is finished the combined mesh groups are pushed back to the main thread and the meshes that are part of the combined meshes get culled away and not drawn anymore, instead we use the combined meshes now
- 4. if something gets disabled or enabled and it's part of the combined mesh then the whole combined mesh gets invalidated and a new request is pushed to the other thread while we keep using the uncombined meshes until the other thread finishes
- 5. if the cell is unloaded while the other thread is calculating combined meshes then the task is aborted
- RalgorToday at 16:57
- You could do that if objects are moved too.
- You just have to be careful and don't combine too much together so things are constantly invalidated.
- meh321Today at 16:58
- yes, but it would be better to avoid including any moved objects in there in the first place
- but yes possible if some object moves unexpectedly it can also invalidate
- JohnToday at 16:58
- (be careful you don't end up with GTA4 entire map is 1 file)
- :GWqlabsFeelsFunnyMan:
- meh321Today at 16:58
- it's like skyrim, it's actually possible to move the terrain tiles around in game, but it's not expected
- RalgorToday at 17:00
- ALso, once a static is moved or enabled/disabled, you could flag it not to be included in the next precombine
- So if it happens again, no problem.
- meh321Today at 17:00
- good idea
- RalgorToday at 17:00
- You could also cache these precombines.
- with those flags
- So repeated cell loads just load the cached versions
- You'd just have to know when to invalidate the cache on load
- JohnToday at 17:00
- Eventually the game would have precomined never moving meshes cached
- meh321Today at 17:00
- mmhm you'd have to keep it in memory, possible but dno if it's worth it ?
- JohnToday at 17:00
- Dynamically.
- RalgorToday at 17:01
- Yup
- JohnToday at 17:01
- Any way to store the cache to disk maybe?
- RalgorToday at 17:01
- I wouldn't bother with caching at first. Only if the system works out
- meh321Today at 17:01
- i think it won't be worth it, the combine will not take long on the other thread, humans can't even perceive it most likely
- RalgorToday at 17:01
- Right. Don't optimize until you have proof you need it.
- JohnToday at 17:01
- Well, no matter, it seems that system would work .
- Y'alls is smart
- :pepe:
- RalgorToday at 17:02
- @AnyOldName3 meh321 came up with your answer. :smile:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement