KevinBLT Posted July 11, 2016 Share Posted July 11, 2016 Hello everyone, I would like to know if it was possible to do the work of "Edges Renderer" in a worker thread? It's working really well for our projects but for some objects it can take really a lot of time in which the scene is completely stopping to respond. Any suggests? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 11, 2016 Share Posted July 11, 2016 This could be possible (at least in theory) as long as you don't manipualte DOM or webgl objects. If this is purely about geometry it should work Quote Link to comment Share on other sites More sharing options...
KevinBLT Posted July 13, 2016 Author Share Posted July 13, 2016 I know. However, how would I start an implementation? Do I absolutely need TypeScript? To do a contribution? And also another question: Wouldn't the edgedetection be possible via shader? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 13, 2016 Share Posted July 13, 2016 TypeScript is mandatory to do a contribution. @NasimiAsl did a great shader for Edge Detection Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted July 13, 2016 Share Posted July 13, 2016 @Deltakosh : When ? exactly http://www.babylonjs-playground.com/#JB4YW#1 : use flat normal material for find a edge http://www.babylonjs-playground.com/#JB4YW#8 : use post process and render target for find final result http://www.babylonjs-playground.com/#2KMG5C#5 http://www.babylonjs-playground.com/#JB4YW#11 jerome 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 14, 2016 Share Posted July 14, 2016 See? Everytime a shader is involved you are around NasimiAsl 1 Quote Link to comment Share on other sites More sharing options...
KevinBLT Posted July 27, 2016 Author Share Posted July 27, 2016 This is fantastic! Can I use this with the current Babylon version? I don't understand these exactly: renderTarget.onBeforeRender = function () { for (var index = 0; index < renderTarget.renderList.length; index++) { renderTarget.renderList[index]._savedMaterial = renderTarget.renderList[index].material; renderTarget.renderList[index].material = renderTarget.renderList[index].helperMaterial; } } renderTarget.onAfterRender = function () { for (var index = 0; index < renderTarget.renderList.length; index++) { renderTarget.renderList[index].material = renderTarget.renderList[index]._savedMaterial; } } Why do you have to do something with private members ? Or is this just a temporary workaround? Also, would it be possible to keep the lines the same thickness independet from the camera distance? You're really a shader god! Quote Link to comment Share on other sites More sharing options...
dbawel Posted July 28, 2016 Share Posted July 28, 2016 Hi @Deltakosh - I hope this isn't a completely obvious answer (as it probabaly is,) but why would manipulating DOM porperties be an issue when using a worker thread? DB Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted July 28, 2016 Share Posted July 28, 2016 19 hours ago, KevinBLT said: This is fantastic! Can I use this with the current Babylon version? I don't understand these exactly: renderTarget.onBeforeRender = function () { for (var index = 0; index < renderTarget.renderList.length; index++) { renderTarget.renderList[index]._savedMaterial = renderTarget.renderList[index].material; renderTarget.renderList[index].material = renderTarget.renderList[index].helperMaterial; } } renderTarget.onAfterRender = function () { for (var index = 0; index < renderTarget.renderList.length; index++) { renderTarget.renderList[index].material = renderTarget.renderList[index]._savedMaterial; } } Why do you have to do something with private members ? Or is this just a temporary workaround? Also, would it be possible to keep the lines the same thickness independet from the camera distance? You're really a shader god! you can use it with BABYLONX (extension) + BABYLON * notice i hope we can have it inside the babylon but it is not my job about render target : 1. we define alternative material (in case flat normal view) for each of meshes we want 2. define a render target 3. push target meshes to rendertarget renderlist 4. switch alternative material with current material before render targer wanna be render 5 switch again and put current material for next scene render after render target is finished 6 use the render target result in post process -- what private exactly ? i share any source when it be ready in public -- it is possible but you most define it in alternative material because the post process dont have access to camera and geometry information at last thanks Kvin sorry for late i am very busy this month but i start a topic about shader and i complete that when i find free time ( after 1 month ) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 29, 2016 Share Posted July 29, 2016 On 7/27/2016 at 8:04 PM, dbawel said: Hi @Deltakosh - I hope this isn't a completely obvious answer (as it probabaly is,) but why would manipulating DOM porperties be an issue when using a worker thread? DB because Worker thread are not allowed to reach the DOM dbawel 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.