I’ll give you a hint: it is one of the more stupid guys.
Now, please do guess but do not hope for any feedback if your answer was right. I forgot on which of the guys I clicked. I wanted to give the ‘active’ guy - whose brain will be on screen - a glowing border and tried the Bloom Effect. But this made the entire guy yellow, and did not just add a yellow border.
So my question is: how can I add a border to a single object. It does not need to glow, just a coloured line will do.
As Ali said, the absolute simplest way possible is:
…or something like that.
Remove it again when unselected. The light will only affect that model.
The next easiest way is to grab the world bound (a bounding box) and turn that into a wire frame attached to the model. The code for that is a little more complicated but straight forward.
Neither of these are “borders around the object” but will definitely serve as an indicator of which one is selected and you can move on to the next item on your to-do list.
Edit: and if you really do want a border around the object then the link from that other thread:
…really is the best you can do. It’s relatively simple. Always works, etc… It will draw outlines on things projecting towards the camera but often times that’s desirable.
…and the only way to get a true 2D border effect is to render the model off-screen and then calculate where it’s border would be using 2D approaches and render that image on the gui node over the object. Very complicated.
Well, I think adding an ambient light is even easier since it requires no code change other than the line adding the light. And OP seems to like the effect. (Indeed, there are many styles of game where an outline would look out of place but a highlight(literally) looks nice.)
material know about parameter from 1 line user code like for example “mat.setColor()” then JME pass it to shader in appropriate way. Light list is also passed to shader. Im not sure why you ask this question.
Anyway what i mean, again, is that using simple things like for example:
mat.setTexture() (but in this case would need remember old one)
can be used to “mark” selected object, so dont really need outline. (ofc if Material is not shared between this objects)
I thought you meant some custom highlight feature in the shader.
If we are just talking about Lighting.j3md then…
Overrides the existing color so you have to remember the old one. You also need to set diffuse and ambient. So two lines plus remembering the settings to put it back. (And my recollection is that JME makes it extra-stupid-difficult to get the color from a material parameter safely… like 5 steps where one should do or something.)
As you say.
Makes really ugly geometry and unless you also clone it then it makes the solid version disappear. Frankly, if wire frame were enough then this thread wouldn’t exist.
This is why I still contend that adding the ambient light is the easiest way. It also looks nice and in some cases is actually the best aesthetic choice. As it stands today, I think it even works for PBR materials.