Forum Replies Created
-
AuthorPosts
-
Ivan LyubovnikovStaff
Hi,
We’ve managed to fix this issue. The fix will be available in the next Verge3D minor update which is planned next Monday.
Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffSee attached image. How can I tap into the v3d elements through an exec js script puzzle? Or is my attachment oversimplifying this?
You can do that through
v3d
, for example,v3d.Mesh
orv3d.Scene
, but it’s usually for when you need to create new objects before adding them into the application.In order to change something that’s already there you can use the
app
variable. For example, the controls are available asapp.controls
and the scene isapp.scene
. So, dumping can be modified like this:app.controls.rotateInertia = 0.2;
Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffHi,
There’s no
controls.dampingFactor
setting but you can use the following properties to control the damping effect for different types of movement and for both mobile and desktop controls:controls.rotateInertia = 0.1; controls.rotateInertiaTouch = 0.1; controls.panInertia = 0.1; controls.zoomInertia = 0.1; controls.zoomInertiaTouch = 0.1;
Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffHi,
I would be okay for the moment if there is a max script solution I could use.
You can try this maxscript code:
expPath = "C:\\path\\to\\export\\directory\\" extensions = #("png", "jpg", "hdr") bkpPath = expPath + "_texturesBkp\\" -- remove & create the backup dir DOSCommand("if exist " + bkpPath + " (del /f/s/q " + bkpPath + "* & rmdir " + bkpPath + ")") DOSCommand("mkdir " + bkpPath) -- copy existing files with the specified extensions into the backup dir for ext in extensions do ( DOSCommand("copy /b/v/y " + expPath + "*." + ext + " " + bkpPath) ) -- run export macros.run "Verge3D" "exportGLTF" -- copy files from the backup dir back to the original dir for ext in extensions do ( DOSCommand("copy /b/v/y " + bkpPath + "*." + ext + " " + expPath) ) -- remove the backup dir DOSCommand("del /f/s/q " + bkpPath + "*") DOSCommand("rmdir " + bkpPath)
(here’s the link just in case: https://www.dropbox.com/s/xpht3rge7wb7d25/export.ms?dl=0)
– it copies certain image files into a specified “backup” folder, then performs export and after that restores the files reverting changes that were made to them during the export.
You can see at the top of the script the following variables:
– expPath – you need to specify the export path for your scene (with double backslashes “\\”)
– extensions – only files that have one of those are preserved by the script; you can add/remove any other extensions if you need
– bkpPath – the temporary directory located inside the export folder; it is used for keeping the old files for restoring them after the exportSo, to perform export of your scene you can just run that script instead of the Verge3D->Export glTF… menu command. I tested it on an example scene and it works well. Hope this helps!
Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffvisual_logic.xml is only used in the Puzzles Editor for generating visual_logic.js, which is the file that’s actually used in the application.
So, if you want to change the files manually you definitely need to edit the .js file. Although, I’d suggest using the Puzzles Editor locally for that and then update both .xml and .js in the published version.
Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffJust one more doubt (sorry), is it possible to save the file directly on disk instead of making the download?
This requires a server configured so that it could receive requests with the file content and save it on the disk.
But doing something like that from a browser directly on a user machine is not allowed for security reasons.
Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffHi,
We have not tried using AFrame in combination with Verge3D, but I think that there can be many issues if you try to integrate one into the other in a single 3d scene. Both AFrame and Verge3D have Threejs as a base, but they also both manage loading, creating and initializing a 3d scene on their own, so that’s the part there they conflict with each other. And I think there’s simply no easy access from Verge3D to an AFrame scene and vice versa, since one engine doesn’t “know” about the 3d scene and its objects that were created in the other engine.
But if you want to use AFrame to render a separate webgl scene then there shouldn’t be any problems with that. If by “user can create additionally” you mean custom puzzle plugins then I believe you can just load AFrame library and use its API inside a custom puzzle.
Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffHi,
You can use the HTML->download_file puzzle for that, but you need to generate the CSV content first. The puzzle setup may look like this:
– first you put the variables into a CSV string, which then goes into the download puzzle.Attachments:
You must be logged in to view attached files.Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffHi,
Do you mean the visual_logic.xml file that’s used for Puzzles or some other xml file in your app?
Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffHi,
Is it possible to switch IBL mode in puzzles?
There’s a way to do that, although it’s a bit hackish. If you don’t use light probe objects in your scene this should be enough (light probes also need manual switching as well as the environment):
– the key puzzles are System->feature_available and Advanced->exec_script
The code inside the “exec script” puzzle:
app._envIBLMode = v3d.IBLEnvironmentProbeCubemap; app.updateEnvironment(app.scene.worldMaterial);
Attachments:
You must be logged in to view attached files.Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffHi!
Generally, it depends on how complex are the materials that you want to optimize. Also, the performance gain can vary on different hardware.
If the materials are simple as you say, then it’s quite possible that you won’t get any noticeable difference. But on the other hand you have thousands of them, so… the only answer is to test that.
You can use the v3d performance profiler in your current project to check how much time the materials take to render. You can do that through the puzzle System->print_performance_info or just pasting this into the console:
v3d.apps[0].printPerformanceInfo()
.You’ll get various rendering info printed in the console, but the sections that are important in your case are “Materials and Shaders” and “Total Render Time”. If you aim at 60 fps then the total render time shouldn’t be higher than 16ms. Also, if it’s quite low (5-6ms) then there’s probably no point in optimizing at all.
Also, from “Materials and Shaders” you can see if there are any materials that take much longer time to render than others and therefore are a potential bottleneck.
Also, you can do this quick test:
v3d.apps[0].scene.traverse(function(obj) { obj.material = new v3d.MeshBasicMaterial({ color: new v3d.Color(Math.random(), Math.random(), Math.random()) }); });
– this replaces all materials in the scene with the Basic material with no textures (or you can do that only for materials you need to test performance of). If there’s no performance gain even when using Basic, then there won’t be any when using an optimized material with everything baked into a single texture.
Hope this helps!
Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffDoes that mean I change to below:
<button id=’v3d-container’ class=”layui-btn layui-btn-primary layui-border”>Button</button>No, not exactly what I meant. I was referring to moving the buttons inside the “v3d-container” element:
<body> <div id="v3d-container"> <div id="fullscreen_button" class="fullscreen-button fullscreen-open" title="Toggle fullscreen mode"></div> <button class="layui-btn layui-btn-primary layui-border">Button</button> </div> </body>
Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffAh, I see. That’s weird because the snap puzzle shouldn’t change the far value. Can you provide a test example to reproduce this issue?
Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffHi,
It seems that the camera is located too far from the objects and the camera’s current far clip value is not high enough to properly render them. You can just increase the “Far Clip” value in the camera settings:
Attachments:
You must be logged in to view attached files.Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffHi! That’s probably because the standard element #v3d-container (which contains the 3d scene) is rendered above the buttons. That happens because it has the following CSS rules applied:
position: absolute; z-index: 0;
To fix that you can just put the buttons right inside #v3d-container. Or, alternatively, leave them as is but add CSS rules like “position: relative; z-index: 1;” so they will be rendered above #v3d-container.
Co-founder and lead developer at Soft8Soft.
-
AuthorPosts