RimLighting Fabric problem

Hi Forum,

I’m having some problems with the RimLighting fabric. My ultimate goal is to take an image and apply a highlight around the edge to indicate that the object is “selected”. I started down the path of using a combined material of Image and RimLighting but couldn’t get the Rimlighting to show correctly. I then tried just getting a polygon (circle) with Rim Lighting to show up but I can’t seem to see any actual “rim” on the polygon, its as if i’m using just a regular ‘color’ material.

I tried looking at the materials sandcastle example but it uses a global polygon extent, which makes it difficult to see the “rim”, so I modified it to just use a simple circle polygon and still do not see any rim effect. I’ve attached my modified “materials” example, with the other materials demo stripped out. Hopefully you can just copy paste it into the sandcastle window. I was wondering if someone knowledgeable it could tell me what I’m doing wrong?

Any help would greatly be appreciated. If I figure out my ultimate goal (image with a highlight around it) using these textures, I think it might be a good example to close the “TODO: need simple but inspiring example of writing custom materials with Fabric” mentioned in the Fabric Wiki


rimLighting.js (3.14 KB)

Hi Mike,

Rim lighting doesn’t shade the edge of the object. It shades where the frontface of the object meets the backface. So it’s not great for things like polygons, but is useful for things like ellipsoids as shown here.

The simplest thing to do is to draw a polyline around the edge on mouse over. You could also composite an alpha map or emission map on mouse over to provide a highlight.

Longer-term, you’ll be able to apply a glow to the object to get a nice highlight. There’s some plans on the roadmap, but we’re a little ways off from starting it.


Ahh, thanks for the clarification!