Forum Replies Created
-
AuthorPosts
-
Ivan LyubovnikovStaff
suggestion: possibly change that in the User Manual, as it still (year later) refers to the supersampling puzzle there, and maybe add info that the anti-aliasing checkbox is referring to the last frame before disabling rendering? lil ambiguous there.
Thanks, will fix that.
also, do you have to run that in a (time) “every frame” puzzle if you want it constantly checked, if called from within a procedure?
Do you mean the case where you want the anti-alias effect from this puzzles to be applied every frame but without rendering being stopped at all?
Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffHi,
For HTML elements you need to use the event puzzle instead of “when clicked” (it works only with 3d objects).
You need to use the “click” event and specify the id of the annotation (“ano_1” in your case):
Attachments:
You must be logged in to view attached files.Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffHi Daniel,
one Question, i there a way to change “IBL Environment Mode” with PUZZLE, after detect iOS!?
You can do that but you need to write a js snippet, since it’s not an only-puzzles soulution.
You need to register a function for puzzles in your app’s main js file in the prepareExternalInterface() function like this:
function prepareExternalInterface(app) { // register functions in the app.ExternalInterface to call them from Puzzles, e.g: app.ExternalInterface.changeIBLMode = function(modeStr) { var mode; switch (modeStr) { case 'PMREM': mode = 0; break; case 'PROBE_CUBEMAP': mode = 1; break; case 'PROBE': mode = 2; break; default: mode = 2; break; } app._envIBLMode = mode; app.updateEnvironment(app.worldMaterial); } }
And after that you can call it via the call_JS_function puzzle:
Attachments:
You must be logged in to view attached files.Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffHi,
You can download a screenshot of what’s rendered on a 3d scene via the
take screenshot
anddownload file
puzzles. See here for more info: https://www.soft8soft.com/docs/manual/en/puzzles/HTML.html#download_file.EDIT: you also need to enable screenshots in your application via the configure_application puzzle. The option you need is called ‘enabled screenshots’.
Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffHi,
I make a few networks to test things out, the material output that’s clicked last is active and is the one blender/Verge uses.
Yes, only the active output is taken into account when the engine compiles a material. Everything that’s not connected to that output is removed and not processed.
Is there a way to have more than one be available to be switched between using js?
No, you can only switch between different materials.
Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffHi,
You can use the App.enableControls method. It receives an HTMLElement as a parameter and passes it into the OrbitControls constructor. You can do that after the app is loaded, for example in the standard runCode function:
function runCode(app) { // add your code here, e.g. console.log('Hello, World!'); app.enableControls(document.getElementById('v3d-container')); }
Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffHi,
appInstance.controls.tween(wPos,wTarget,1);
If I had to write it like this, could I change the animation effect?You can use the tween function, indeed, but unfortunately there’s no way currently to change how the animated value is interpolated. The animation effect that verge3d uses for camera tweening is ease-in-out and it looks like this:
Attachments:
You must be logged in to view attached files.Co-founder and lead developer at Soft8Soft.
2020-07-03 at 10:25 am in reply to: Generate Merged Image From Multiple Images Using Generate Image Puzzles? #29611Ivan LyubovnikovStaffHi,
This can’t be done directly by using “texture from text” or “generate normal map” puzzles but the approach is similar (and also very close to what merge-images.js does).
If you don’t want to have an additional dependency in your project you can just write a simple function specifically for your needs:
function combine(imgSources) { return Promise.all(imgSources.map(function(url) { // load all images return new Promise(function(resolve) { var img = new Image(); img.onload = function() { resolve(img); }; img.src = url; }); })).then(function(images) { // create a canvas with required dimensions var canvas = document.createElement('canvas'); canvas.width = 2048; canvas.height = 512; // draw images to the canvas var ctx = canvas.getContext('2d'); ctx.drawImage(images[0], 0, 0); ctx.drawImage(images[1], 512, 0); ctx.drawImage(images[2], 1024, 0); ctx.drawImage(images[3], 1536, 0); // return the resulting image in base64 form return canvas.toDataURL('image/jpeg'); }); }
It loads all the given images and after they are ready creates a canvas with dimensions 2048×512. Then it just draws all the images into the canvas with some offsets that you can specify in
ctx.drawImage
. The function returns a string in base64 format which looks likedata:image/jpeg;base64,/9j/4AAQSkZJRgABA...
.You can use it to create and add a new image onto the page:
combine(['1.jpg', '2.jpg', '3.jpg', '4.jpg']).then(function(result) { var img = new Image(); img.src = result; document.body.appendChild(img); });
Btw, if you use this canvas approach there’s a limit for the maximum width and height for the combined image: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas#Maximum_canvas_size
Co-founder and lead developer at Soft8Soft.
2020-07-03 at 9:29 am in reply to: Localhost refused to Connect with Chrome 83.0.4103.61 on macOS High Sierra #29610Ivan LyubovnikovStaffOh, sorry, I should’ve been more clear. After you replace the file server.py within the verge3d/manager directory you should just run Blender from the terminal and look at the output there previously was just “Address already in use, exiting”. But now with the new version of server.py there should be a bit more information about what actually happened when Blender tried to start the server.
Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffDo you guys have an idea why:
– v3d.js
– Aquatop.js (its MyAwesomeApp.js)
– Aquatop.css
…
isn’t available in the sources tab ?I looked at the sample app you shared in the first post and saw that v3d.js and your application scripts are bundled within one file RequestReducedScripts.js:
And I guess the css file is bundled in a similar way in RequestReducedScripts.cssAttachments:
You must be logged in to view attached files.Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffwell i was trying to get the fps to link to an updated blender text object for a readout, how does one use the ” .showFPS () : null ” line? wrap in a function? assign it a true value?
You can put
app.showFPS();
in runCode to enable it via js (andapp.hideFPS()
to disable). And there’s also a hotkey to switch it: just pressF
3 times.But this feature is just a small widget displaying FPS in the top left corner. It’s not well-suited for obtaining/utilizing the FPS value. If you need to calculate it I’d suggest to do that in a render callback:
function runCode(app) { // add your code here, e.g. console.log('Hello, World!'); var avgFPS = 0; app.renderCallbacks.push(function(delta, elapsed) { var FPS_INERTIA = 1; if (delta > 0) { avgFPS = v3d.MathUtils.expAverage(avgFPS, 1 / delta, delta, FPS_INERTIA); var fps = Math.round(avgFPS); // update objects, display FPS here, etc... } }); }
– then you can use that
fps
variable for updating a text object, for example:textObj.geometry = textObj.geometry.cloneWithText(String(fps) + ' FPS');
Co-founder and lead developer at Soft8Soft.
2020-07-02 at 4:32 pm in reply to: Localhost refused to Connect with Chrome 83.0.4103.61 on macOS High Sierra #29583Ivan LyubovnikovStaffHmm, it seems that you run
server.py
manually, but it’s not actually needed because Blender should execute that script properly, i.e. by using the appropriate python version and some specific command line arguments. I guess that’s the reason you got the Syntax Error.So, you just need to launch Blender the same way via the terminal as I suggested in the previous post.
Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffA little remark: it would be better to change
parent.$(content).on('remove', detectFormReset);
to something like this:
parent.$(content).on('remove', function() { setTimeout(detectFormReset, 10); });
– just to wait a little bit after the original HTML element was removed, because the new one can be not available immediately.
Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffDo you think there is another event trigger approach i could use?
Yes, I think you can use the jquery UI custom “remove” event, but it’s mostly a javascript solution.
I noticed that there are several dynamic UI elements which, if you make some changes to them, lead to resetting of the whole input form. But the one of the root HTML elements with the id “oDocumentContent” is the one that is always recreated after the changes. So you can just make a function that listens to the “remove” event for “oDocumentContent”:
function detectFormReset() { var content = parent.document.getElementById('oDocumentContent'); parent.$(content).on('remove', detectFormReset); }
– now if you call this function once somewhere in your application, it becomes a callback for the moment when you need to reset listeners in your puzzles logic.
So, I’d recommend to make a procedure in puzzles for registering all event listeners that you need, something like that:
– and now you need to call that procedure programmatically from the detectFormReset() function:
function detectFormReset() { var content = parent.document.getElementById('oDocumentContent'); parent.$(content).on('remove', detectFormReset); v3d.puzzles.procedures.setupListeners(); }
After that there’s nothing left to do but to call detectFormReset() somewhere in your application’s js file (for example in the runCode function) to start all of that detecting&resetting logic.
Attachments:
You must be logged in to view attached files.Co-founder and lead developer at Soft8Soft.
Ivan LyubovnikovStaffHi,
It seems that then you select a different option in the input, e.g. “Top mounted cover/Integrated cover”, the UI is rebuilt and the original HTML elements are replaced/recreated with identical but new elements (seems like you’re using jquery UI for that). That’s why the event listener doesn’t work after selecting a new option: the original HTML element the listener was assigned to was deleted and the new one apparently didn’t inherit any user-created event listeners (besides the ones that jquery UI automatically adds).
Co-founder and lead developer at Soft8Soft.
-
AuthorPosts