• Content Count

  • Joined

  • Last visited

About nicktendo

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. @Deltakosh A quick update, I've successfully gotten BJS to run within a NodeJS app. The dependencies are as follows: gl: canvas: jsdom: A version of NodeJS that utilizes Node Module version 48 to be compatible with canvas: A few modifications had to be made to Babylon.js: 1. Define the following variables at the top of Babylon.js: var window = {}; window.location = {}; window.location.href = ""; var navigator = {}; 2. Add an argument to the engine constructor to pass a window variable from jsdom: function Engine(canvas, antialias, nodeWindow, options, adaptToDeviceRatio) { window = nodeWindow; document = window.document; navigator = window.navigator; 3. Comment out the following code inside Effect.prototype._loadVertexShader: if (vertex instanceof HTMLElement) { var vertexCode = BABYLON.Tools.GetDOMTextContent(vertex); callback(vertexCode); return; } Without this comment an error is thrown when attempting to resolve 'HTMLElement', I'm sure there's a more comprehensive solution to this problem. Here is the NodeJS app: var gl = require('gl')(1920, 1080, { preserveDrawingBuffer: true }); var canvas = require('canvas'); const jsdom = require('jsdom'); const { JSDOM } = jsdom; var BABYLON = require('./babylon.max.js'); var dom = new JSDOM(); var window = dom.window; canvas.getContext = function(thecontext,options){ return gl; } canvas.addEventListener = function (event,options){ return 1; } var engine = new BABYLON.Engine(canvas, true, window); var scene = new BABYLON.Scene(engine); // Enable Collisions scene.collisionsEnabled = true; var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 5, -10), scene); var sphere = BABYLON.Mesh.CreateSphere("sphere1", 16, 2, scene); sphere.checkCollisions = true; sphere.position.y = 5; var speed = 0.01; scene.registerBeforeRender(function() { console.log(sphere.position.x); sphere.position.x += speed; }); engine.runRenderLoop(function () { scene.render(); }); console.log("ran") As of now the default vertex shader isn't able to be loaded properly, but as this is a headless implementation shaders probably aren't very relevant. I'll ultimately find a permanent solution for this error. I'm sure there is a significant amount of simplification that could be done to the engine implementation overall since it's running in a headless configuration, but this seems to be working for now. I wanted to minimize my modifications to the engine so I could use as close to a duplicate implementation of the browser version as possible I've attached the NodeJS project files for reference. babylon.max.js index.js package.json
  2. @Deltakosh I'll experiment with using headless-gl as the WebGL context for BJS later today and update with my results..
  3. @Deltakosh How about this :
  4. @Deltakosh How about this:
  5. @Deltakosh I came across a thread in which @RaananW suggested simply overriding the render function as such: Would this be the best way to run a "headless" version of BJS at current?
  6. @Deltakosh Thank you for the reply Is there a "hack" way to accomplish this with the current version of BJS?
  7. Would it be possible to create a BabylonJS scene within the context of a NodeJS server simply to recreate the environment of a player and verify valid movement/collisions? The BabylonJS scene on the server would obviously not need to paint anything anywhere, but would simply need to calculate mesh positions/collisions/etc.
  8. Why isn't a collision triggering and stopping the camera ellipsoid prior to passing through the custom mesh in this scene:
  9. @JCPalmer That was precisely the issue, thanks!
  10. @Deltakosh Sorry for the delay, I'll recreate the issue later today and post the code.
  11. Are there any examples of how to apply a texture to an individual vertex as is described in this tutorial:
  12. @Deltakosh Thank you for the answer I received an error when I attempted to merge 10,000 cubes into a single mesh stating that I had to "enable 32 bit indices". Did I simply cause an error by attempting to execute too large of a mesh merge?
  13. This may be a very noob-ish questions, but how do I enable 32 bit indices in BabylonJS? I've done a bit of searching and can't find any documentation.