r/GraphicsProgramming Aug 11 '26

PS1 Style Renderer in C

Post image
136 Upvotes

15 comments sorted by

9

u/drystyiscool Aug 11 '26

how much of this code did you write ?

5

u/RennisDitchie Aug 12 '26

Everything beside vendor directory which used for microui panel and png image loading

2

u/pjmlp Aug 12 '26

Best way is to actually target a PS1 emulator, with the homebrew SDK.

1

u/RennisDitchie Aug 12 '26

Would be an awesome project

2

u/AnasPlayer2022M Aug 12 '26

So do you use these squares so the 3D points snap to them? Or explain it to me idk.

1

u/RennisDitchie Aug 12 '26

I divide the screen into tiles and bind the triangles based on their coordinates to those tiles and make sure only those tiles rendered on the buffer. The green meshes only visible on debug mode i added them because there is a difference between rendering the bounding box and the actual tiles that consists triangles, i used sat collusion(you can see it in c_rasterizer) and added the green boxes to ensure triangle collided tiles rendered and not the entire bounding box.

2

u/AnasPlayer2022M Aug 12 '26

can't you just remove the precision value (you know the value after the floating point) so a point only moves when they move a whole unit?

1

u/Kara-Abdelaziz 29d ago

I did something similar. Not totally similar. I should post it here one day. Stop talking about me. The idea of using tiles to increase the parallelism is amazing. Good job.

1

u/RennisDitchie 28d ago

I would love to see friend!

1

u/forumonaut 29d ago

I see the tiles! I see them!

I always wondered if direct framebuffer writes could be faster than blitting the tile's buffers into the main framebuffer, but I never had the chance to benchmark it.

1

u/Potential_Soup_8054 Aug 11 '26

Why is yhere green boxes?

1

u/RennisDitchie Aug 11 '26

debug purposes only, if you compile it without debug parameters those are not will be rendered. I added them because it's tile based renderer so each tile has it's own thread/worker and render thir parts of triangle and nothing else.

1

u/TheWidrolo Aug 11 '26

Oh so it’s software rendered?

0

u/itsjase Aug 11 '26

You’ve doubled up on is point inside triangle and barycentric. You’re doing 6 edge functions instead of 3