Difference between revisions of "Tips for Verge3D devs"

From Verge3D Wiki
Jump to navigationJump to search
 
(22 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:JavaScript]]
[[Category:JavaScript]]
This page contains random tips and code snippets that Verge3D devs or [https://www.soft8soft.com/docs/manual/en/programmers_guide/Developer-Kit.html Verge3D DevKit] users may find useful for their work.
This page contains random tips and code snippets that Verge3D devs or [https://www.soft8soft.com/docs/manual/en/programmers_guide/Developer-Kit.html Verge3D DevKit] users may find useful for their work.
== Supported modelling suites ==
{| class="wikitable sortable"
|-
! Suite !! Release year !! Python !! App M. || Build Info / Notes
|-
| Blender 2.91 || 2020 || 3.7.7 || Thread ||
|-
| Blender 2.92 || 2021 || 3.7.7 || Thread ||
|-
| Blender 2.93 LTS || 2021 || 3.9.2 || Thread || Dropped Windows 7 support (Windows 8.1 is OK)
|-
| Blender 3.0 || 2021 || 3.9.7 || Thread || Used in Ubuntu 22.04
|-
| Blender 3.1 || 2022 || 3.10.2 || Thread ||
|-
| Blender 3.2 || 2022 || 3.10.2 || Thread ||
|-
| Blender 3.3 LTS || 2022 || 3.10.2 || Thread ||
|-
| Blender 3.4 || 2022 || 3.10.8 || Thread ||
|-
| Blender 3.5 || 2023 || 3.10.9 || Thread ||
|-
| Blender 3.6 LTS || 2023 || 3.10.9 || Thread ||
|-
| Blender 4.0 || 2023 || 3.10.11 || Thread ||
|-
| 3ds Max 2021 (23.0) || 2020 || 3.7.6 || Process || VS 2017, Platform Toolset v141, Windows SDK 10.0.17134.0. Dropped Windows 7-8.1 support. Arnold by default.
|-
| 3ds Max 2022 (24.0) || 2021 || 3.7.9 || Process || VS 2017, Platform Toolset v141, Windows SDK 10.0.17134.0
|-
| 3ds Max 2023 (25.0) || 2022 || 3.9.7 || Process || VS 2019, Platform Toolset v142, Windows SDK 10.0.19041.0
|-
| 3ds Max 2024 (26.0) || 2024 || 3.10.8 || Process || VS 2019, Platform Toolset v142, Windows SDK 10.0.19041.0
|-
| Maya 2022 || 2021 || 3.7.7 || Thread || Arnold optional. Dropped Windows 7, Windows 8.1 never officially supported.
|-
| Maya 2023 || 2022 || 3.9.7 || Thread || Arnold optional.
|-
| Maya 2024 || 2023 || 3.10.8 || Thread || Arnold optional.
|}
* Python 3.8 is last supported version on Windows 7
* Python 3.11 is supported on Windows 8


== Getting v3d namespace from iframe ==
== Getting v3d namespace from iframe ==
Line 133: Line 88:


* [http://localhost:8668/reset localhost:8668/reset] — reset server settings.
* [http://localhost:8668/reset localhost:8668/reset] — reset server settings.
* [http://localhost:8668/log localhost:8668/log] — App Manager log.


== Restoring console functions ==
== Restoring console functions ==
Line 146: Line 103:


  gh release download v19.0.4 -D v19.0.4 -p 'electron-*64.zip' -p 'electron-*32.zip' -p 'SHASUMS256.txt' -R electron/electron
  gh release download v19.0.4 -D v19.0.4 -p 'electron-*64.zip' -p 'electron-*32.zip' -p 'SHASUMS256.txt' -R electron/electron
== Install Python packages to local directory ==
pip install --target=dir_name package_name

Latest revision as of 09:41, 15 March 2024

This page contains random tips and code snippets that Verge3D devs or Verge3D DevKit users may find useful for their work.

Getting v3d namespace from iframe

document.getElementsByTagName("iframe")[0].contentWindow.v3d

e.g. to print performance profile from the iframe:

document.getElementsByTagName("iframe")[0].contentWindow.v3d.apps[0].printPerformanceInfo()

or to enable FPS counter:

document.getElementsByTagName("iframe")[0].contentWindow.v3d.apps[0].showFPS()

Debugging Verge3D render target

Use the following code to create a plane with the output of the given render target:

// DONT FORGET TO REMOVE IT!
var texture = renderTarget.texture
var geometry = new v3d.PlaneBufferGeometry(3, 3);
var material = new v3d.MeshBasicMaterial();
material.map = texture;
var planeMesh = new v3d.Mesh(geometry, material);
planeMesh.position.x = 6;
v3d.apps[0].scene.add(planeMesh);

Code Indentation Style

The K&R style, 4 spaces:

function someFun() {
    const someConst = 10;
    const alwaysTrue = true;

    for (let i = 0; i < someConst; i++) {
        if (alwaysTrue) {
            console.log(`Hello ${i}!`);
        }
    }
}

Key Triplets

There are several key triplets supported by Verge3D which are useful for debugging. To execute a triplet, wait until a Verge3D app finishes its loading, then press the same key thrice very quickly.

  • PPP — print performance profile. See here for more info.
  • FFF — show/hide FPS counter in the upper left corner of the rendered canvas.
  • HHH — halt/continue application rendering.

Short Links

These short links can be very helpful for debugging mobile devices.

App Manager undocumented features

Restoring console functions

const i = document.createElement('iframe');
i.style.display = 'none';
document.body.appendChild(i);
window.console = i.contentWindow.console;

Downloading Electron builds

gh release download v19.0.4 -D v19.0.4 -p 'electron-*64.zip' -p 'electron-*32.zip' -p 'SHASUMS256.txt' -R electron/electron

Install Python packages to local directory

pip install --target=dir_name package_name