Reputation:
I want to make object to become highlighted when selected in order to do this I need a custom shader that scales that renders the model outline - this part of the task I'm familiar with - XML3D provides a way to implement custom shader.
But the missing piece is having access to render pipeline: Its impossible to make nice highlighting without copying the model and painting it over old one or rendering the scene in two passes (postprocessing). Creating another model copy in the usual way (attaching new element to dom tree) won't solve the issue since I need also control scene blending.
How to I get it done with with xml3d? Is it possible without digging deep into the library?
Upvotes: 1
Views: 103
Reputation: 123
In general there are four approaches to implement highlighting:
selected
has a specific value.
For instance:<mesh id="foo">
<data src="mesh-data.json"></data>
<float name="selected">0</float>
</mesh>
$("#foo float[name=selected]").text("1");
If sufficient for your use-case, I would recommend approach 3, as it is not very intrusive. The interface for creating custom rendering pipeline is not yet very stable.
Upvotes: 0
Reputation: 166
As ksons mentioned the render pipeline interface is undergoing some major changes right now, XML3D 4.8 is the last version that supports it in its current form. Version 5.0 will likely re-introduce it in a (hopefully) much improved form.
We use a custom render pipeline in one of our internal projects to draw a wireframe overlay onto selected models, I've posted a simplified version of this pipeline as a Gist for you to have a look at. Essentially it renders the scene using the standard internal render pass and then does a second pass to draw the highlighted objects in a crude wireframe mode without depth testing.
As I said this works in v4.8, if you need this functionality in v4.9 then please open an issue and I'll see about re-enabling it as a minor release.
Upvotes: 0