Jump to content

How to implement clipping planes as with Three.js?


BlackMojito
 Share

Recommended Posts

I have successfully to add multiple clipping planes by using CutomMaterial. However I have got further problems.

I am using SSAO2 and it uses the GeometryBufferRenderer which can output a Depth texture and a Normal texture. BUT the buffers do not take into account the clipping planes so that I will get shadow where it should not.

I understand that I need to customize the shaders so that I can insert necessary uniform variables and clipping plane logic.

But HOW CAN I DO THAT?

I tried to inherit from GeometryBufferRenderer and would like to override its internal effects but there were too many private variables. And even if I can do it, I need to replace the default GeometryBufferRenderer in the Scene class. This is also not possible as it was a private member...

 

Help needed! 

Link to comment
Share on other sites

5 hours ago, Deltakosh said:

Hello the simplest hack would be to replace BABYLON.Effect.ShadersStore["geometryPixelShader"] by the string of your own shader

The original string is:https://github.com/BabylonJS/Babylon.js/blob/master/src/Shaders/geometry.fragment.fx

 

 

Yeah but how can I update the internal effect each time the uniforms(planes) should be modified?

Link to comment
Share on other sites

9 hours ago, Deltakosh said:

You can add code to material.onBindObservable and get material.getEffect() to set the values you want

Hum....but GeomertryBufferRenderer is not a Material. It holds directly a private "Effect". I cannot get it...as...it is private. 

And the GeometryBufferRenderer inside Scene is also private... 

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...