Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
eliemichel committed Jun 24, 2021
2 parents 4c4eafa + c73ab79 commit 066938c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/cannot-import-rdc-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ If you are having trouble importing a .rdc file with this add-on, please provide
- The .rdc file
- Your GPU name
- Version of this add-on (must be the most recent one)
- Version of RenderDoc (1.10 recommended)
- Version of RenderDoc (1.10 mandatory)
- Version of Blender (2.82 minimum)
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ Troubleshooting

Useful information can be found in the comment of the video, as well as on [the support thread on blenderartists](https://blenderartists.org/t/google-maps-models-importer/1153561).

### Check software versions

Most importantly, use the last version of this add-on. In the release notes of each version the recommended/required versions of RenderDoc and Blender are specified. As of now, use RenderDoc v1.10 (**not** 1.11) and the last version of Blender.

### Example of capture files

To check your installation, you can try importing sample captures from [MapsModelsImporter-samples](https://github.com/eliemichel/MapsModelsImporter-samples).
Expand Down Expand Up @@ -129,9 +133,17 @@ You can use the [LilyCaptureMerger](https://gumroad.com/l/KSvXuu) add-on for thi

You can check out the [LilyTexturePacker](https://gumroad.com/l/DFExj) add-on I've made especially for this. Beware to use it only **after** using LilyTextureMerger, because the latter rely on individual block textures to perform matching.

### How to clean up imported geometry

Even though it won't make miracles, the following can help:

- To join all chunks into a single mesh: A (to select all), Ctrl+J
- To weld vertices: Switch to Edit mode (Tab), M > By Distance.
- To set the scale to 1 without changing the size of the geometry: Ctrl+A > Scale

### It's taking too long, how to automate this process?

Although I don't know how to automate the capture itself, you can easily automate the importing part, see [this issue](https://github.com/eliemichel/MapsModelsImporter/issues/39) for an example of automation script.
Although I don't know how to automate the capture itself, you can easily automate the importing part, see [this issue](https://github.com/eliemichel/MapsModelsImporter/issues/39) for an example of automation script, or [this one](https://github.com/eliemichel/MapsModelsImporter/issues/128) to import all rdc files from a directory.

Notable use cases
-----------------
Expand Down
21 changes: 15 additions & 6 deletions blender/MapsModelsImporter/google_maps_rd.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def hasUniform(self, draw, uniform):
constants = self.getVertexShaderConstants(draw)
return uniform in constants['$Globals']

def extractRelevantCalls(self, drawcalls, _strategy=0):
def extractRelevantCalls(self, drawcalls, _strategy=4):
"""List the drawcalls related to drawing the 3D meshes thank to a ad hoc heuristic
It may different in RenderDoc UI and in Python module, for some reason
"""
Expand Down Expand Up @@ -160,9 +160,12 @@ def extractRelevantCalls(self, drawcalls, _strategy=0):
last_call = ""
drawcall_prefix = "DrawIndexed"
capture_type = "Google Earth"
skipped_drawcalls, min_drawcall = self.findDrawcallBatch(drawcalls, first_call, drawcall_prefix, last_call)
if not skipped_drawcalls or not self.hasUniform(skipped_drawcalls[0], "_uProjModelviewMatrix"):
first_call = "INVALID CASE, SKIP ME"
min_drawcall = 0
while True:
skipped_drawcalls, new_min_drawcall = self.findDrawcallBatch(drawcalls[min_drawcall:], first_call, drawcall_prefix, last_call)
if not skipped_drawcalls or self.hasUniform(skipped_drawcalls[0], "_uMeshToWorldMatrix"):
break
min_drawcall += new_min_drawcall
elif _strategy == 6:
# Actually sometimes there's only one batch
first_call = "DrawIndexed"
Expand All @@ -181,7 +184,7 @@ def extractRelevantCalls(self, drawcalls, _strategy=0):
print("Error: Could not find the beginning of the relevant 3D draw calls")
return [], "none"

print(f"Trying scrapping strategy #{_strategy}...")
print(f"Trying scraping strategy #{_strategy}...")
relevant_drawcalls, _ = self.findDrawcallBatch(
drawcalls[min_drawcall:],
first_call,
Expand All @@ -200,13 +203,19 @@ def extractRelevantCalls(self, drawcalls, _strategy=0):
else:
capture_type = "Google Earth"

if capture_type == "Google Earth":
relevant_drawcalls = [
call for call in relevant_drawcalls
if self.hasUniform(call, "_uMeshToWorldMatrix")
]

return relevant_drawcalls, capture_type

def run(self):
controller = self.controller
drawcalls = controller.GetDrawcalls()
relevant_drawcalls, capture_type = self.extractRelevantCalls(drawcalls)
print(f"Scrapping capture from {capture_type}...")
print(f"Scraping capture from {capture_type}...")

if MAX_BLOCKS <= 0:
max_drawcall = len(relevant_drawcalls)
Expand Down

0 comments on commit 066938c

Please sign in to comment.