BritneyWatch Posted November 28, 2018 Share Posted November 28, 2018 I understand that in Babylon.js, you have to put lights for shadings and well....3D effect in general. But say I want to save up all the processing time and do away with having to calculate lights altogether and I already have my scene with all the lighting information baked in the texture. In Blender such a texture would be called emissive, in 3DS Max, it will be standard material with full illumination. How or what is the way to implement such a simplistic texture in Babylon.js to save up lighting calculation time ? Quote Link to comment Share on other sites More sharing options...
Sebavan Posted November 29, 2018 Share Posted November 29, 2018 You could use a PbrMaterial with unlit = true it will then bypass all the code except applying the albedoTexture to the model. Quote Link to comment Share on other sites More sharing options...
thrice Posted November 30, 2018 Share Posted November 30, 2018 You should be able to make a custom shader material for this purpose, at least that is what I do. I use it when I want the material to appear exactly as is. Something like: BABYLON.Effect.ShadersStore['noLightFragmentShader'] = ` precision highp float; uniform float time; varying vec2 vUV; uniform sampler2D textureSampler; void main() { vec4 texture_color = texture2D( textureSampler, vUV ); vec4 final = texture_color; gl_FragColor = final; } BABYLON.Effect.ShadersStore["noLightVertexShader"]= ` precision highp float; // Attributes attribute vec3 position; attribute vec3 normal; attribute vec2 uv; // Uniforms uniform mat4 worldViewProjection; // Varying varying vec4 vPosition; varying vec3 vNormal; varying vec2 vUV; void main(void) { gl_Position = worldViewProjection * vec4(position, 1.0); vUV = uv; }`; this.babylon = new BABYLON.ShaderMaterial('blah', this.scene, { vertex: 'noLight', fragment: 'noLight', }, { attributes: ["position", "normal", "uv"], uniforms: [ "world", "worldView", "worldViewProjection", "view", "projection" ], }); `; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.