MackeyK24 Posted October 19, 2016 Share Posted October 19, 2016 IF ITS NOT ALREADY IN BABYLON.JS (and i just don't see it) Can we embed vertex and fragment programs in the .babylon file on the 'materal' object of the material customType="BABYLON.ShaderMaterial" Example: { "customType" : "BABYLON.ShaderMaterial", "name" : "Items", "id" : "dadbe3ae-445f-4fe4-b83f-000b27b2b8d4", "backFaceCulling" : true, "wireframe" : false, "alpha" : 1, "shaderPath" : "Items", "options" : { "attributes" : [ "position", "uv" ], "uniforms" : [ "worldViewProjection" ], "needAlphaBlending" : false, "needAlphaTesting" : false, "samplers" : [], "defines" : [] }, "textures" : {}, "floats" : {}, "floatArrays" : {}, "colors3" : {}, "colors4" : {}, "vectors2" : {}, "vectors3" : {}, "vectors4" : {}, "matrices" : {}, "matrices2x2" : {}, "matrices3x3" : {} }, Can we add somewhere in a 'base64' encoded string for the shader programs... Something like: "vertexBase64" : "*** BASE64 ENCODED VERTEX PROGRAM ***", "fragmentBase64" : "*** BASE64 ENCODED FRAGMENT PROGRAM ***", Then in the client side Material parser... If we got base64 parsdedMaterial data with our programs already there... no need to make TWO separate server trips to get our shader programs... plus the shader programs are then cached when storing .babylon files in indexedDB. Also it can easily work with sandbox and just drag that single .babylon file to sandbox (ONCE sandbox get the PR fix to use BABYLON.ShaderMaterial vertexBase64 and fragmentBase64) then folks custom shaders will work on the sandbox... Right now if you have BABYLON.ShaderMaterial defined in your .babylon file (and don't use a qualified path) the server will never find or use them (unless you know where those files end up after posting to server and are available ... still would hard code sandbox path to shader program in your .babylon file.).. For some reason if don't use path and just name... it looks in '/src/Sharder/myShader.vertex.fx' Anyways I'm going to play with the github Material.Parse stuff to use material.vertexBase64 and fragmentBase63 IF PRESENT... After i had them to the ShaderMaterial class... Hope you guys like this idea ... That last one to get metadata added seems like a tough sell... I hope you consider this... Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 20, 2016 Share Posted October 20, 2016 It was a tough sell but you made it I'm not opposed at all with this one either! Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted October 22, 2016 Author Share Posted October 22, 2016 Het David... I submitted the PR for vertexElement and fragmentElement to support Base64 encoded strings... Pretty small and clean and works great. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 24, 2016 Share Posted October 24, 2016 merged 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.