How to develop colored wireframes for Solid, Lookdev and Rendered mode?

Issue / Need


I know there is an object and random wireframe mode in Wireframe draw, but the same is not true in Solid (Workbench), Lookdev or rendered mode.

I would love this feature. The code for coloured or object based wireframe colour is there, but not in the other draw modes. There must be a way to add the wireframe random color or object colour to the other editors.

Question

How could I draw the same wireframe overlays from Wireframe Draw mode into the other viewport solid, lookdev and rendered systems and overlays?

The current code to draw wireframes in wireframe display is where? How is it implemented?

Reasons

As a UX, I can use many booleans, work multiple forces, use many nulls as reference, work lattices on lattices, and many other elements in solid, lookdev or rendered mode. I need to see them, but black lines on lines is not clear what line of what object I’m clicking on. If they had random color or object based color coding, then I could quickly distinguish which one I could or should click on. This will save time, make life more efficient and makes every day viewport manipulation a little easier.

Rclick Select requests for this feature:

Others who have needed this:
https://blender.community/c/rightclickselect/bqhbbc/
https://blender.community/c/rightclickselect/dmhbbc/
https://blender.community/c/rightclickselect/BXgbbc/
https://blender.community/c/rightclickselect/PYfbbc/
https://blender.community/c/rightclickselect/jTdbbc/

8 Likes

The relevant code is in source/blender/draw/engines/overlay/overlay_wireframe.c.

3 Likes

Oh cool, here it is. Probably should have started grepwinning it.

Ok, so I see a wireframe cache that checks a bool to set random colour or object colour. Great, that’s the functionality I need in the other modes. It also has some conditionals to outline what shader mode the wireframes with the colours go.

I also notice the wireframes are setup as overlays, which is nice. Meaning in theory they could populate to the other shader modes.

So… the conditional, I am pretty new to C, if I allow it to include other shading modes - in theory it would populate to the others? Without too much rewrite?

2 Likes

Been digging a bit more (thanks to a friend of mine) checking to see where color is coming from. I see it pulling it from the theme - so now doing some debug builds to see if changing colour works.

After I get the colour changes working in the other modes (instead of pulling color matrice from theme, pull from object color, eg) — I would need object or random with the bools that set it, but also in the other modes.

Example, changing from theme color to object color: Line 224-228

    if (geom) {
  // OVERLAY_extra_wire(cb, geom, ob->obmat, color); 
  OVERLAY_extra_wire(cb, geom, ob->obmat, ob->color); 
}

Still exploring!

2 Likes

Still poking around. Will probably have to figure this out with breaking points in a debug build. I think I see code that’s relevant to wireframe, but there seems to be systems that only place this in the Wireframe Shaded mode, either intentionally, or because I’m missing code for the other modes. I still can’t find which is the fallback in the other modes.

2 Likes

Hola Draise, do you have any news on the Colored wires in Shaded modes?

1 Like

Hey there, I found my C-fu is pretty limited and I could not dig enough to replicate to the other modes. I only know the theory and the documents, but I would need to invest in a third party dev to work it for me. I have it queued for later, but for now I’m working on getting some funds for the devs I know (as I like to sponsor them directly). It should be possible, it’s all overlay code, but it’s only tied to one method of drawing - yet it’s an overlay type of drawing. Meaning… it could be just added as a feature to the other drawing modes.

TLDR. It could be exposed as overlays to the other modes - technically. From what I researched. I just… can’t do it myself. I just… know where the code for it sits really.

I think the biggest hurdle is the UI entry design to toggle it for the other modes - deciding the UX at the end of the day.

Another hurdle is how the theming works, you’d have to re-write some wireframe theming systems for it to be possible, so it’s also in those documents.