Jump to content

EdgesRenderer in WorkerThread ?


KevinBLT
 Share

Recommended Posts

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?

Link to comment
Share on other sites

@Deltakosh : When :huh: ? exactly :D

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

Link to comment
Share on other sites

  • 2 weeks later...

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? :rolleyes:

You're really a shader god! :D 

Link to comment
Share on other sites

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? :rolleyes:

You're really a shader god! :D 

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 :) )

 

 

 

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