Jump to content

How to implement clipping planes as with Three.js?


BlackMojito
 Share

Recommended Posts

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,

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

31 minutes ago, RaananW said:

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 :D )   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 ...

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...