Skip to content

Commit

Permalink
Update to Blender 4.1 and RD 1.31
Browse files Browse the repository at this point in the history
  • Loading branch information
eliemichel committed Apr 5, 2024
1 parent 5e11aa7 commit 18be57a
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 16 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*If this helps you save time or money for your job, please consider supporting the work involved in here ;)* [![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=DNEEF8GDX2EV6&currency_code=EUR&source=url)

**News** As of January 2024, an extra command line option `--disable_direct_composition=1` is recommended to prevent Chrome from restarting the GPU process.

**News** As of January 2023, Only versions older or equal to 0.5.0 no longer work because the associated version of RenderDoc are no longer able to inject into Chrome. Use version 0.6.0 (for RenderDoc 1.25 and Blender 3.4) or newer!

**News** As of Aug 23, 2020, [**Google Earth** web](https://earth.google.com/web/) is now supported on top of Google Maps!
Expand Down Expand Up @@ -36,7 +38,7 @@ You can follow instruction from the walkthrough video: https://youtu.be/X6Q7dbtX

```
set RENDERDOC_HOOK_EGL=0
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-gpu-sandbox --gpu-startup-dialog
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-gpu-sandbox --gpu-startup-dialog --disable_direct_composition=1
```

3. Do NOT press Ok on the dialog box yet;
Expand All @@ -56,7 +58,7 @@ set RENDERDOC_HOOK_EGL=0
For step 2. you can create a link to Chrome rather than usig the cmd, and put as target (again, adapt the path to `chrome.exe` to your installation):

```
C:\Windows\System32\cmd.exe /c "SET RENDERDOC_HOOK_EGL=0 && START "" ^"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe^" --disable-gpu-sandbox --gpu-startup-dialog"
C:\Windows\System32\cmd.exe /c "SET RENDERDOC_HOOK_EGL=0 && START "" ^"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe^" --disable-gpu-sandbox --gpu-startup-dialog --disable_direct_composition=1"
```

Troubleshooting
Expand Down
6 changes: 3 additions & 3 deletions blender/MapsModelsImporter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019 - 2021 Elie Michel
# Copyright (c) 2019 - 2024 Elie Michel
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the “Software”), to deal
Expand All @@ -24,8 +24,8 @@
bl_info = {
"name": "Maps Models Importer",
"author": "Elie Michel",
"version": (0, 6, 3),
"blender": (3, 1, 0),
"version": (0, 7, 0),
"blender": (4, 1, 0),
"location": "File > Import > Google Maps Capture",
"description": "Import meshes from a Google Maps or Google Earth capture",
"warning": "",
Expand Down
Binary file not shown.
Binary file modified blender/MapsModelsImporter/bin/win64/renderdoc.dll
Binary file not shown.
Binary file modified blender/MapsModelsImporter/bin/win64/renderdoc.pyd
Binary file not shown.
7 changes: 3 additions & 4 deletions blender/MapsModelsImporter/google_maps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019 - 2021 Elie Michel
# Copyright (c) 2019 - 2024 Elie Michel
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the “Software”), to deal
Expand Down Expand Up @@ -214,7 +214,6 @@ def addImageMaterial(name, obj, img):
obj.data.materials.append(mat)
nodes = mat.node_tree.nodes
principled = nodes["Principled BSDF"]
principled.inputs["Specular"].default_value = 0.0
principled.inputs["Roughness"].default_value = 1.0
if img is not None:
texture_node = nodes.new(type="ShaderNodeTexImage")
Expand All @@ -223,8 +222,8 @@ def addImageMaterial(name, obj, img):
link = links.new(texture_node.outputs[0], principled.inputs[0])

def numpyLoad(file):
(dim,) = np.fromfile(file, dtype=np.int, count=1)
shape = np.fromfile(file, dtype=np.int, count=dim)
(dim,) = np.fromfile(file, dtype=np.int32, count=1)
shape = np.fromfile(file, dtype=np.int32, count=dim)
dt = np.dtype(file.read(2).decode('ascii'))
array = np.fromfile(file, dtype=dt)
array = array.reshape(shape)
Expand Down
36 changes: 33 additions & 3 deletions blender/MapsModelsImporter/google_maps_rd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019 - 2021 Elie Michel
# Copyright (c) 2019 - 2024 Elie Michel
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the “Software”), to deal
Expand Down Expand Up @@ -194,14 +194,14 @@ def extractRelevantCalls(self, drawcalls, _strategy=4):
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], "_w"):
break
break # Found a good draw call
min_drawcall += new_min_drawcall
else:
print("Error: Could not find the beginning of the relevant 3D draw calls")
return [], "none"

print(f"Trying scraping strategy #{_strategy} (from draw call #{min_drawcall})...")
relevant_drawcalls, _ = self.findDrawcallBatch(
relevant_drawcalls, new_min_drawcall = self.findDrawcallBatch(
drawcalls[min_drawcall:],
first_call,
drawcall_prefix,
Expand All @@ -225,6 +225,36 @@ def extractRelevantCalls(self, drawcalls, _strategy=4):
if self.hasUniform(call, "_uMeshToWorldMatrix")
]

if capture_type == "Google Maps":
# Accumulate multiple batches
batch_count = 1
while True:
min_drawcall += new_min_drawcall
# Find a batch
first_call = "" # Try from the beginning on
last_call = "Draw()"
drawcall_prefix = "DrawIndexed"
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], "_w"):
break # Found a good draw call
min_drawcall += new_min_drawcall

# Accumulate the batch
new_relevant_drawcalls, new_min_drawcall = self.findDrawcallBatch(
drawcalls[min_drawcall:],
first_call,
drawcall_prefix,
last_call)

if not new_relevant_drawcalls:
break

relevant_drawcalls.extend(new_relevant_drawcalls)
batch_count += 1

print(f"Found {batch_count} batches.")

return relevant_drawcalls, capture_type


Expand Down
7 changes: 4 additions & 3 deletions doc/Building RenderDoc module.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
Get python source code in Python-X.X.X
Get embedable release in python-X.X.X-embed-amd64
Edit qrenderdoc/pythonXX.natvis
Edit qrenderdoc/pythonXX.natvis by copying the existing pythonYY.natvis and replacing pythonYY by pythonXX everywhere in its content.
Copy Python-X.X.X\Include\*.h to qrenderdoc\3rdparty\python\include
Copy C:\PythonXX\Include\pyconfig.h to qrenderdoc\3rdparty\python\include, C:\PythonXX being the install path of PythonXX
Copy python-X.X.X-embed-amd64/pythonXX.zip to qrenderdoc\3rdparty\python
Copy python-X.X.X-embed-amd64/pythonXX.dll and _ctypes.pyd to qrenderdoc\3rdparty\python\x64
Expand All @@ -25,11 +26,11 @@ with
pythonXX.lib
(twice)
Copy python310.dll in qrenderdoc\3rdparty\python\x64
Manually run the lines of dll2lib.bat in qrenderdoc\3rdparty\python\x64
Open renderdoc.sln in VisualStudio
Right click on the solution, "Retarget Solution" to your latest
Make sure you build the x64 version, not x86
Make sure you build the x64 version, not x86, Release mode
Build pyrenderdoc_module
Copy x64/Release/renderdoc.dll and x64/Release/pymodules/renderdoc.pyd to MapsModelsImporter/blender/bin/win64
Expand Down
3 changes: 2 additions & 1 deletion doc/dll2lib.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
REM Set the python version and make shure lib.exe is in the path (e.g. run from the developer command prompt)
set PYTHON_VERSION=python310
set PYTHON_VERSION=python311

REM If "dumpbin" is not recognized as a command, run from the developer command prompt
dumpbin /EXPORTS %PYTHON_VERSION%.dll > %PYTHON_VERSION%.exports

echo EXPORTS > %PYTHON_VERSION%.def
Expand Down

0 comments on commit 18be57a

Please sign in to comment.