We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Object clipping issues

Home Forums General Questions Object clipping issues

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #30892
    Avataroriggin
    Newbie

    Hi guys, I am working on a lift configurator. The lift has 2 objects, ‘FRONT_CHAINS’ and ‘BACK_CHAINS’ which are supposed to be clipped at a specific dynamic height, located at the base of the ‘CHAIN_DRIVE’ object.

    Scene

    But unfortunately I do not have experience with 3D and I did not find a proper solution for my problem.

    I already tried different ways to solve this, but none of them has worked.

    My first attempt was creating a clipping plane, but far from successful :( I read verge 3d and threejs documentation about clipping planes and both were not enough clear for me. I unfortunately did not get how I could apply the newly created plane as a clipping plane in the material and if I should do something else (like setting the Local Clipping to true or even pushing the new plane to renderer.clippingPlanes (this one crashed the application)), and if so, how exactly should I do it. After some fails I gave up and started trying to do this using alpha clipping.

    So I asked a friend to create and apply a texture. A 2×2 PNG with a black and a white stripe. My idea was to move the texture using a custom value node created in blender, so I could set it using the puzzles. After a lot of research we find a way to control this, but again, did not work well. The values have different behavior than they had in blender and I can not work with them.

    I still guess the clipping plane would be the best solution for me, but I have no idea how to make this work in the code. I tried the code below but I do not notice any changes.

    But maybe there is even a way to do this animating the chains along a path so they really make the turn over the chain drive.

    I hope you guys can help me with that.
    Thanks ;)

    • This topic was modified 1 week, 5 days ago by Avataroriggin.
    #30916

    Hi,
    Looks like you forgot to enable clipping planes on the renderer:
    v3d.apps[0].renderer.localClippingEnabled = true

    Co-founder and CTO at Soft8Soft
    FB | Twitter | VK

    #30920

    Also, it’s not recommended to access app.materials array directly, use v3d.SceneUtils.getMaterialByName() method instead.

    Co-founder and CTO at Soft8Soft
    FB | Twitter | VK

    #30930
    Avataroriggin
    Newbie

    Hi, Looks like you forgot to enable clipping planes on the renderer: v3d.apps[0].renderer.localClippingEnabled = true

    Hi Alexander, thanks for the answer, but it also did not work for me. When I add this line to my code the result is exact the same as before (and the fps decrease a lot).

    Also, it’s not recommended to access app.materials array directly, use v3d.SceneUtils.getMaterialByName() method instead.

    This also does not work for me. It returns the following error

    Maybe I should mention that I am trying this all from the console at runtime. I do not know if there is any difference doing it so

    #30941

    Looks like you forgot app instance parameter:

    v3d.SceneUtils.getMaterialByName(v3d.apps[0], 'YourMaterial')

    As for clipping planes, it looks like you need different params for your plane. Keep in mind that Verge3D API coordinate space is different: x-left, y-up, z-forward. That means your clipping plane (0, 0, -3) is vertical, not horizontal. Use (0, -1, 0) or so.

    Co-founder and CTO at Soft8Soft
    FB | Twitter | VK

    #30943
    Avataroriggin
    Newbie

    Looks like you forgot app instance parameter:
    v3d.SceneUtils.getMaterialByName(v3d.apps[0], 'YourMaterial')
    As for clipping planes, it looks like you need different params for your plane. Keep in mind that Verge3D API coordinate space is different: x-left, y-up, z-forward. That means your clipping plane (0, 0, -3) is vertical, not horizontal. Use (0, -1, 0) or so.

    So, this about the Verge3D coordinate system being different was new for me and this was actually the mystery behind the problem.

    Thank you very much :)

    I hope this topic can also help other people who are trying something similar.

    #30944
    Avataroriggin
    Newbie

    I noticed that some time after I run this code, I get the following error

    The code:

    The error:

    Do you have any idea why?

    • This reply was modified 1 week, 5 days ago by Avataroriggin.
    #30984

    Hi,
    looks like some shader bug. Can you isolate crashing material and send us the minimal Blend file with it?

    Co-founder and CTO at Soft8Soft
    FB | Twitter | VK

    #30996
    Avataroriggin
    Newbie

    Hi, looks like some shader bug. Can you isolate crashing material and send us the minimal Blend file with it?

    If you need something else, let me know. Thank you ;)

    PS: I am using more than one material because the plane was clipping only one object, so I added another material to the other object, which had to be clipped in order to work. But the problem exists since it was only one material and it clipped only one object.

    • This reply was modified 1 week, 4 days ago by Avataroriggin.
    Attachments:
    You must be logged in to view attached files.
    #31016

    Hi origgin,
    Thanks for the test example! We are able to reproduce this error. It’ll be fixed in the next 3.3.1 update, which is planned next monday.

    Co-founder and lead developer at Soft8Soft.

    #31021
    Avataroriggin
    Newbie

    Hi origgin, Thanks for the test example! We are able to reproduce this error. It’ll be fixed in the next 3.3.1 update, which is planned next monday.

    Hi. Nice, I will test it again after the update and let you know if it worked, thanks for the nice support ;)

    #31027
    GlifTekGlifTek
    Licensee

    That’s great foreknowldge about the API having y-up coords! :good:

    #31094
    Avataroriggin
    Newbie

    Just to give my feedback: everything is working fine after the update. Thanks again ;)

    #31114
    Yuri KovelenovYuri Kovelenov
    Developer

    excellent! :good:

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.