BlackMojito Posted October 18, 2017 Share Posted October 18, 2017 Hi guys, I am porting our application from three js to Babylon but I cannot find an easy way to achieve the functionality as shown in this three.js sample. I know that I can write my own shaders by inserting the clipping planes block but before doing so I would like to know if there exists already an easy way to do that in Babylon? Thanks, Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 18, 2017 Share Posted October 18, 2017 Howdy, welcome to the forum! So, unless there is a function that was added (which is possible) - no, Babylon only offers camera z clipping. Quote Link to comment Share on other sites More sharing options...
adam Posted October 18, 2017 Share Posted October 18, 2017 You could use CustomMaterial: https://playground.babylonjs.com/#AFRP1L Wingnut, Arte and jerome 3 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 18, 2017 Share Posted October 18, 2017 Or you can just set scene.clipPlane = new BABYLON.Plane(...) Arte 1 Quote Link to comment Share on other sites More sharing options...
BlackMojito Posted October 19, 2017 Author Share Posted October 19, 2017 18 hours ago, adam said: You could use CustomMaterial: https://playground.babylonjs.com/#AFRP1L Thanks! I will take a look. But is there any easy ways to add such shader blocks to all the materials? Quote Link to comment Share on other sites More sharing options...
BlackMojito Posted October 19, 2017 Author Share Posted October 19, 2017 17 hours ago, Deltakosh said: Or you can just set scene.clipPlane = new BABYLON.Plane(...) Thanks. But I don't understand why we can only set one clipPlane? BTW, can the frustumPlanes be used for my purpose? Or they are just the same as the ones of the current active camera? Quote Link to comment Share on other sites More sharing options...
jerome Posted October 19, 2017 Share Posted October 19, 2017 Imho, the frustum planes are simply used to determine if a mesh must be rendered or not : if it intersects the frustum, then it's selected for rendering. They don't visually clip the mesh. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 19, 2017 Share Posted October 19, 2017 We only have one because we never needed more And @jerome is correct Quote Link to comment Share on other sites More sharing options...
Arte Posted October 19, 2017 Share Posted October 19, 2017 Hi All, @Deltakosh scene.clipPlane not hiding edges, bug? PG Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 20, 2017 Share Posted October 20, 2017 Not sure to understand the issue Quote Link to comment Share on other sites More sharing options...
Arte Posted October 20, 2017 Share Posted October 20, 2017 Behind scene.clipPlane edges is visible. Quote Link to comment Share on other sites More sharing options...
BlackMojito Posted October 23, 2017 Author Share Posted October 23, 2017 On 10/18/2017 at 11:08 PM, adam said: You could use CustomMaterial: https://playground.babylonjs.com/#AFRP1L Hi adam, Why I cannot find the definition of CustomMaterial? Where is this class defined? Thanks Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 23, 2017 Share Posted October 23, 2017 Hi @xuchen_shadow, It can be found in the material library - https://github.com/BabylonJS/Babylon.js/blob/master/dist/materialsLibrary/babylon.customMaterial.d.ts Quote Link to comment Share on other sites More sharing options...
BlackMojito Posted October 23, 2017 Author Share Posted October 23, 2017 31 minutes ago, RaananW said: Hi @xuchen_shadow, It can be found in the material library - https://github.com/BabylonJS/Babylon.js/blob/master/dist/materialsLibrary/babylon.customMaterial.d.ts It seems that material library is not in the bundle babylon.js, how can I use it then? BTW,I am writing my app using TypeScript. Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 23, 2017 Share Posted October 23, 2017 You can use npm to include the entire material library: https://www.npmjs.com/package/babylonjs-materials it includes everything you need Quote Link to comment Share on other sites More sharing options...
BlackMojito Posted October 23, 2017 Author Share Posted October 23, 2017 Hi RaananW, I got the below error by including Babylon's-materials using npm. How can I let it find babylon itself? WARNING in ./node_modules/babylonjs-materials/babylonjs.materials.min.js Module not found: Error: Can't resolve '../babylon.max' in '/Users/xuchen/Development/XViewer/node_modules/babylonjs-materials' @ ./node_modules/babylonjs-materials/babylonjs.materials.min.js 1:82-107 @ ./src/main.ts Thanks Quote Link to comment Share on other sites More sharing options...
BlackMojito Posted October 23, 2017 Author Share Posted October 23, 2017 36 minutes ago, RaananW said: You can use npm to include the entire material library: https://www.npmjs.com/package/babylonjs-materials it includes everything you need import * as BABYLON from 'babylonjs'; import from 'babylonjs-materials'; Also, the second line seems to be illegal in TypeScript? Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 23, 2017 Share Posted October 23, 2017 Hi, the warning should not bother you at all, I am working on removing it, but it is mainly due to the dev version being included (if found). The second line is perfectly legal in TypeScript, I am using it on a daily base. Not sure what error you are getting. What TypeScript are you using? Quote Link to comment Share on other sites More sharing options...
BlackMojito Posted October 23, 2017 Author Share Posted October 23, 2017 7 minutes ago, RaananW said: Hi, the warning should not bother you at all, I am working on removing it, but it is mainly due to the dev version being included (if found). The second line is perfectly legal in TypeScript, I am using it on a daily base. Not sure what error you are getting. What TypeScript are you using? I am using typescript 2.5.3 and please see the following error. [at-loader] Checking finished with 1 errors [at-loader] ./src/main.ts:2:13 TS1005: '=' expected. Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 23, 2017 Share Posted October 23, 2017 Ah!. it should be import 'babylonjs-materials'; without from. I am fixing the documentation now, my bad. Quote Link to comment Share on other sites More sharing options...
BlackMojito Posted October 23, 2017 Author Share Posted October 23, 2017 1 minute ago, RaananW said: Ah!. it should be import 'babylonjs-materials'; without from. Super thanks! Hum the last question, is it possible to write a similar class like CustomMaterial which extends the PBR materials? Do I just need to copy some src code from CustomMaterial? What I want to do is to insert some code into their existing shaders. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 23, 2017 Share Posted October 23, 2017 Ping @NasimiAsl who is the mastermind behind the customMaterial Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted October 23, 2017 Share Posted October 23, 2017 hi @Deltakosh i make some PRB Material https://www.babylonjs-playground.com/#F5IEQE#19 that work before this changes i need that for update uniform after bind ( i don't know why this need be changed = > https://github.com/BabylonJS/Babylon.js/pull/2962/commits ) *notic we accept keep custommaterial in old version and update that any 3 month ? @xuchen_shadow (hi again ) i don't know why you wanna make some custom PBR material because that custom material let we have standard material effect in shader but what property in PBR material you wanna change try fix and make new PG ... Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 23, 2017 Share Posted October 23, 2017 Yep still align with that: Quote we accept keep custommaterial in old version and update that any 3 month ? Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted October 23, 2017 Share Posted October 23, 2017 45 minutes ago, Deltakosh said: Yep still align with that: yes but that js is damaged now some samples is don't be run after change i wanna make some sample (simple sample ) after any publish we can test it ( this is like quality support test ) 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.