• Using DrawQuadEasy to create Opaque renders
    6 replies, posted
So I'm drawing some simple boxes with https://wiki.garrysmod.com/page/render/DrawQuadEasy My problem is I'm trying to render multiple in one hook, and obviously the ones I render at the end will appear drawn over the first ones. If I move an earlier drawing in front of a later one, it has an overlapping drawing. https://files.facepunch.com/forum/upload/109798/4b165faf-9d1d-4469-b578-636be081c86d/image.png You can see the wrath of the overlapping boxes above. In an ideal case, the red one would be dominant Are there any render commands to make them all render with equal weight? I don't want to do this with a separate hook for each. I've used render.DepthRange to cut the ones out that may have overlapping line of sight, but this seems like a temporary solution Thanks!
You can sort the order in which you draw the boxes by the surface area of each box, if you must do it using DrawQuadEasy 
That worked pretty well. I knew sorting would be something that'd work but I wasn't sure if the performance was going to be hurt by it. Turns out it plays pretty nicely. https://files.facepunch.com/forum/upload/109798/99a5a556-5db6-4cde-aee8-fb0fd281684d/image.png Ended up shrinking the boxes based on how close they were to the player's camera, then sorting by size as you suggested. Sorting by distance was an option but this ultimately worked better for caching. Do you have any recommendations outside of DrawQuadEasy for drawing material based boxes? Your last comment makes me feel like there might be a better alternative for me
Probably using render.DrawBox would be exactly what you need?
When I tried that the material wouldn't orient itself properly. I could ignore the tops and bottoms but the sides had to sell it as all upright. That's why I went with QuadEasy as I could control the faces. Here's an old picture https://files.facepunch.com/forum/upload/109798/398c409f-5f7d-4d32-b80c-1e12704e428a/image.png
Another solution would be to make a custom model, UV map it accordingly and use that with ClientsideModel.
That's actually a really good idea. And it's just a cube that I need. I'm gonna try that!
Sorry, you need to Log In to post a reply to this thread.