Quantcast
Channel: Bugs Latest Topics
Viewing all articles
Browse latest Browse all 760

Babylon Headless on Server Side

$
0
0

Hi, I'm looking to make babylon run on server side, without a browser, to take screenshot of the 3D scene.

To achieve that I created a project with headless-gl, but I've always the same error. 

Who can help me with this error, or maybe I can use another library?

 

Here is the error:

Babylon.js engine (v3.2.0-beta.5) launched

BJS - [16:47:09]: Unable to compile effect:

BJS - [16:47:09]: Uniforms:  world, view, viewProjection, vEyePosition, vLightsType, vAmbientColor, vDiffuseColor, vSpecularColor, vEmissiveColor, vFogInfos, vFogColor, pointSize, vDiffuseInfos, vAmbientInfos, vOpacityInfos, vReflectionInfos, vEmissiveInfos, vSpecularInfos, vBumpInfos, vLightmapInfos, vRefractionInfos, mBones, vClipPlane, diffuseMatrix, ambientMatrix, opacityMatrix, reflectionMatrix, emissiveMatrix, specularMatrix, bumpMatrix, normalMatrix, lightmapMatrix, refractionMatrix, diffuseLeftColor, diffuseRightColor, opacityParts, reflectionLeftColor, reflectionRightColor, emissiveLeftColor, emissiveRightColor, refractionLeftColor, refractionRightColor, vReflectionPosition, vReflectionSize, logarithmicDepthConstant, vTangentSpaceParams, diffuseSampler, ambientSampler, opacitySampler, reflectionCubeSampler, reflection2DSampler, emissiveSampler, specularSampler, bumpSampler, lightmapSampler, refractionCubeSampler, refraction2DSampler

and the code:

package.json dependencies:

"dependencies": {
"babylonjs": "^3.2.0-beta.5",
"gl": "^4.0.4",
"jsdom-global": "^3.0.2",
},
 

scene.js

require('jsdom-global')()
var gl = require('gl')(400,400); //headless-gl
 
var BABYLON = require("babylonjs");
var mycanvas = {
getContext: () => gl,
addEventListener: function () { }
};
 
var engine = new BABYLON.Engine(mycanvas, true);
var scene = new BABYLON.Scene(engine);
var box = BABYLON.MeshBuilder.CreateBox('box', { size: 20 }, scene)
var camera = new BABYLON.FreeCamera('camera', BABYLON.Vector3.Zero(), scene);
var ground = BABYLON.Mesh.CreateGround('ground', 10, 10, 20, this.scene);
scene.render()

Viewing all articles
Browse latest Browse all 760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>