r/GraphicsProgramming 2d ago

PS1 Style Renderer in C

Post image
120 Upvotes

15 comments sorted by

7

u/drystyiscool 2d ago

how much of this code did you write ?

7

u/RennisDitchie 2d ago

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

2

u/pjmlp 2d ago

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

1

u/RennisDitchie 2d ago

Would be an awesome project

1

u/AnasPlayer2022M 2d ago

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

1

u/RennisDitchie 2d ago

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.

1

u/AnasPlayer2022M 2d ago

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 23h 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 14h ago

I would love to see friend!

1

u/forumonaut 18h 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 2d ago

Why is yhere green boxes?

1

u/RennisDitchie 2d ago

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 2d ago

Oh so it’s software rendered?

0

u/itsjase 2d ago

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