Home › Forums › Programming › Set outline parameters via Javascript
Tagged: outline
- This topic has 7 replies, 4 voices, and was last updated 2 years, 6 months ago by saalemv3d.
-
AuthorPosts
-
2020-05-11 at 9:32 am #27444webCustomer
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.
2020-05-11 at 9:50 am #27445webCustomerWas 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;
2020-05-11 at 11:12 am #27450Yuri KovelenovStaffthanks 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);
2020-05-11 at 12:57 pm #27455webCustomerAh, okay. Neat hack^^
2021-11-25 at 11:15 am #47230brotchenParticipantHello, 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.2021-11-25 at 4:03 pm #47240Yuri KovelenovStaff2021-11-26 at 8:16 am #47265brotchenParticipantHello Yuri,
It worked great! Thank you!Attachments:
You must be logged in to view attached files.2022-06-03 at 8:44 am #52639saalemv3dParticipantHi Yuri,
function runCode(app) {
//some code
}
app.scene.appInstance.outline(test, ‘ENABLE’);
app.postprocessing.outlinePass.visibleEdgeColor = new v3d.Vector4(0, 0, 1, 1);How to enable outline and change its color outside the runCode function?
My code structure is something like the above but enabling outline and changing its color give error. -
AuthorPosts
- You must be logged in to reply to this topic.