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.

Set outline parameters via Javascript

Home Forums Programming Set outline parameters via Javascript

Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #27444
    web
    Customer

    I’m trying to change outline parameters via JavaScript.

    In the “visual_logic.js”. I tried the following parameter to change the outline color but I’m getting “cannot read property ‘outlinePass’ of undefinded”.
    appInstance.postprocessing.outlinePass.visibleEdgeColor = new v3d.Vector4(0,0,1,1)

    Also I would like to know if someone could tell me the paramters to set all possible outline effects? For example “render hidden edge” or “edge strength” etc.

    #27445
    web
    Customer

    Was a bit too early with writing here. Setting the outline color is working the way I described above. There was just a browser caching issue.

    So for everyone who is interested in setting outline effects via JavaScript, these are the commands:

    appInstance.postprocessing.outlinePass.visibleEdgeColor = new v3d.Vector4(0,0,1,1);
    appInstance.postprocessing.outlinePass.hiddenEdgeColor = new v3d.Vector4(0,1,0,1);
    appInstance.postprocessing.outlinePass.edgeStrength = 3;
    appInstance.postprocessing.outlinePass.edgeGlow = 0;
    appInstance.postprocessing.outlinePass.edgeThickness = 4;
    appInstance.postprocessing.outlinePass.pulsePeriod = 0;

    The only thing I could figure out, is how to set “Render Hidden Edge”. Tried it this way, but doesnt seem to have any effect:
    appInstance.postprocessing.outlinePass.renderHiddenEdge = false;

    • This reply was modified 1 year, 6 months ago by web.
    #27450

    thanks for sharing your solution!

    is how to set “Render Hidden Edge”.

    this is alpha channel of hiddenEdgeColor, 0 or 1

    appInstance.postprocessing.outlinePass.hiddenEdgeColor.setW(1);

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

    #27455
    web
    Customer

    Ah, okay. Neat hack^^

    #47230
    brotchen
    Participant

    Hello, sorry to bump this old topic.

    I have a question about the javascript part for the outline effect.
    I’m trying to use the puzzle block “exec script” where it executes the specified js code.

    Basically, I have a cube and another smaller cube hidden inside it. I’m trying via the exec script puzzle to temporally activate the “Render Hidden egdes” option when clicking on the visible cube but I cant figure out what to write exactly, even using the answer from Yuri : “appInstance.postprocessing.outlinePass.hiddenEdgeColor.setW(1);”

    nothing happens. Is there a specific way to write this?

    Attachments:
    You must be logged in to view attached files.
    #47240

    Hi,

    try using app instead:

    app.postprocessing.outlinePass.hiddenEdgeColor.setW(1);

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

    #47265
    brotchen
    Participant

    Hello Yuri,
    It worked great! Thank you! :good:

    Attachments:
    You must be logged in to view attached files.
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.