Yes but I think the wireframe rendering does tri’s right? So a box would get a diagonal across each face, which I don’t want.
Texture map also has the problem that if I scale the box non uniformly then the lines will not be of equal thickness.
EDIT: I suppose I could build the box with ‘little sticks’ at creation time when I know what measurements the box will have. I was hoping for something easier/faster since I will be doing loads of these but maybe thats would be the best way.
Hi Redbox and thanks for your persistence! It made me try a little harder and actually come up with a solution.
I think. I haven’t tried to make the really thin lines but I think it should work. My main concern was to make it work with non-uniform scaling.
Noughty me I should be doing my taxes today and not play with shaders.
All these objects have the same shader with no parameter changes. The lines stay with the same visual thickness.
Works with meshes and static mesh components.
Here’s the material snippet
EDIT: Maybe that divide by scale can be simpler. I’ll check later.
I’ll probably try to add some filtering as fragments get small in screen. Maybe using DDX and DDY. Doas anyone have any suggestions?
Also I’ll probably end up making this into a UV based variant so that I can have skewed boxes.
I see that it uses local position, so it can work only with single meshes.
I’m not sure how it will behaves when becomes part of other actor. In case of using in BP I think it will take position of BP itself. In case of widget… ¯_(ツ)_/¯
Oh it does work if the box is a component inside a BP, that’s what I tested with the zebra striped sine shader in the picture above.
You see the right two meshes have hemisphere component icons inside them and I scaled the actual component and not the actor.
I’m spending way too long time on this it has to stop now. I did make a UV variant so that I can have skewed boxes and might be a bit more flexible.
It was just meant for the boxes in my 3D vr gui so enough already!
The new one is a bit too confusing to post here but it uses the same principle as the above one just UV coords instead of local position. Also I had to do some custom UV layout so that I could have three planes to be scaled correctly.