Can't figure out drawing a border on a rectangle clearly

I am having a lot of trouble getting a clear border around rectangles, I’ve created a playground to demo what i’m talking about, the positioning of the lines is something i can get right on my own but i can’t figure out how to get rid of the blurring, like in the top left and bottom right rectangles in the playground the lines are being blurred.

I did read somewhere about like the nearest neighbor sampling mode on a texture but i’m not using textures on this example, so do I need to add a texture to get it to render properly or is there a way to make the rendering not do this sort of anti-aliasing, I have been trying to turn off anti-aliasing a hundred different ways and it never goes away.

Hey :slight_smile:

What exactly is your usecase here ?
I’m asking because this seems odd :

I mean, even solving the blur issue, adding 4 meshes to create a border is not optimal… If you are 2D did you consider using the GUI ? Otherwise if it’s 3D it will be much better with a shader

firstly, thanks for the feedback, perhaps a shader would be the right answer here.

secondly, as to the use case, unfortunately it kind of touches a nerve, i would hope that rendering a border around a rectangle is abstract enough to be its own problem without the use case, but I know that you are intending to point me to the gui if it would make my life easier when i’m actually coming away from it, and the decision to come away from it wasn’t easy to make, because i may end up having to manually do text rendering somehow, so it feels like i’m criticizing the people who worked on the gui to come to the conclusion it isn’t adequate but my weeks of frustration can’t be ignored either

I have already done this project I’m working on before using the GUI if you are interested…

But it wasn’t working out, and as much as I know you would prefer people to use the existing library i can only give you my word of my own real world experience on the limitations i ran into being too numerous, it’s like it’s designed to be an overlay on top of the 3d content where in my case the “gui” elements ARE the the 3d content

for example there’s this concept of a guimanager and there is 0 documentation I could find anywhere about using the gui without it, but when you use the guimanager it has like a full screen texture, which is like you’re projecting into the 3d space instead of building into it, let’s say you wanted to switch cameras dynamically, you’d need to recalculate that projection if it is an overlay texture, but if you actually paint the gui elements onto the mesh then you wouldn’t need to.

i’m sorry if i’m pre-emptively defensive but when the entire point of a project i’m working on is like “to see if i can” and i get pushback on like “why reinvent the wheel” it upsets me, perhaps that’s my own insecurities, but then i feel obliged to try and justify myself and i’m too autistic for all this social nuances, i just want technical help to achieve my goal rather than philosophically debating if i should be doing what i’m doing.

to elaborate, the gui has 2d and 3d controls, if you use the 2d ones the events are arbitrarily nerfed such that event objects are missing information that other control’s events arent, like an onpointerenter only gives you x and y (it has that single overlay gui in mind) when i actually need the full event, but then if you use the 3d controls they become impossible to align properly with each other and i can’t for the life of me get the 3d stackpanels to work

so, to be frank, it’s the way the gui is designed that i can’t work with, it changes the normal operation of things that are intended to simplify things, but they are only simplifications when you have an overlay style interface, when you don’t these simplifications are constraints

in theory, if i could use the gui stuff without a guimanager and actually put the gui into the 3d world space instead of trying to hide it away from it, then i’d use it for sure, but if documentation on how to do that exists it’s been hidden very well

Hey :slight_smile:

I think you over-reacted a bit, I was just asking, because sometimes people don’t know about simpler solutions… Also if you are interested, have a look at this topic
on which I have stressed-tested a bit the GUI ^^^


Coming back to your question, here is a shader-based example :

Best,
Tricotou

1 Like

thanks! yes, i am sure i did overreact, as i said the question touches a nerve but it felt rude to ignore it, i hope to afford some therapy one day <3

your chat app is cool, i’m not really trying to make something 2d i’m just starting with 2d to make sure i can translate styling to rendered result, like i have a 20px margin in my json and i see a 20px margin in the rectangle, but in the future that will be within a microcontext of a larger scene, and i don’t want to have a different approach for the 2d vs 3d content

as for the topic, i don’t know how to apply it to my current project, i am not that experienced in game dev stuff so when people talk about “uv maps” i’m just like “ok, cool story”, i will understand at some point but there are a LOT of gaps in my knowledge and if i tried to fill them all i wouldn’t ever get anything done

even with a shader solution for the borders that still doesn’t resolve the actual rectangles themselves having a color bleed / anti-alias that is undesireable, maybe there’s a good samaritin outthere who can put up with my lack of mental health and assist me, thanks for the help so far

btw that topic you linked, i had already read it about 10 times and tried to understand it very hard, lol, that’s literally the one i referenced in my original post when i mentioned nearest nieghbour and me not using textures :slight_smile: