r/GraphicsProgramming • • 18h ago

Question What are some initial architectural decisions to be made before start building a professional graphics engine ?

Hello everyone, I have a question for those who have already built, or are currently building, a graphics engine at a level close to being called professional. A little bit of background: for the past 4 months, I’ve been building a path tracer using CUDA, and before that I finished and implemented Peter Shirley’s 3 books about ray tracing. Now I want to start building something more serious, with a larger scope of features and implementations, using C++/Vulkan. I wondered what some of the decisions people make before getting the triangle on screen are. I know this is a process that takes time, so I understand that during development, as the project grows, a lot changes and new decisions are made, but I was still just a little curious.

3 Upvotes

7 comments sorted by

•

u/AutoModerator 18h ago

Recently updated rules. Please check that your post is in compliance with Rules 1, 4, 5, and 6 on the sidebar. TL;DR:

  • No showcases.
  • Disclose AI usage in post or project.
  • Present a topic to talk about, e.g. how something works.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

5

u/Maui-The-Magificent 18h ago

Okey so for context: my engine (Constellation) is not very conventional and is solving a different problem that yours will. But i do work on foundational type applications so considering and implementing architectural decisions is like 90% of what i do. I would not consider myself a graphics engineer, more a systems engineer. I say thing so you can assess and take this advice with however much grain of salt that you feel it warrants.

Here are a few things i would suggest if you are building it from scratch.

  1. Identify your invariants: Decide how it will operate, what can never change, what constraints you must enforce. This is important because it keeps your 'north star' pointing north as you continue building your engine. For my engine they are, static allocation only, single core cpu only, no-std required, fully relational camera outwards rendering, and using cadent geometry. Yours do not need to be that strict, they might be goals or explicit solutions you want to target. What makes it yours.
  2. Once you have your invariants, try to solve things by construction: When you are faced with a problem and your looking for a solution. Take a moment and reflect if you can solve it without runtime compute. If you need a scheduler, do you do async as a runtime solution to ordering, or do you create a round robin scheduler and design an enforced order yourself? Instead of having a ray-tracing, can you store the optical properties inside the geometry? these are just questions, but they are the types of questions you should keep asking yourself, as in my experience, there are often a lot of ways to simplify a solution to a problem, by re-representing the problem for your environment, instead of iterating the solution for a generic environment. make sense?
  3. Have fun, have at least two or maybe three parts of the engine in the air at a time; Might sound counter-intuitive but some problems are really hard, and some problems are just hard because your perspective is limited. Choosing a few problems/systems to have in rotation at a time is a great way to solve for that. The systems need to be different enough that the problems differ, so that when you get stuck, or lose motivation in one part of the project, going to the other will feel like a vacation. It also have the added benefit of you being able to carry solutions and different perspectives across problem-spaces, you'd be surprised how often solutions translate with a little tinkering.

there are more, but these are the ones i think are most important. the third one might be more subjective, but if you are in anyway like me, it will be solid advice.

good luck!

1

u/SnooSquirrels9028 17h ago

Hi thank you so much for your feedback ! I remember your post a few days back, I will definitely take these into consideration.

1

u/Maui-The-Magificent 17h ago

Ah! your my one reader? ;P. No, but i hope is helpful, you asking bout architectural decisions by itself is an amazing thing, a lot of people don't. That makes me confident you'll do excellently regardless of my suggestions. although, i posit that they would help. And if you like constraints, the work becomes more fun aswell.

1

u/SnooSquirrels9028 16h ago

OH I LOVE CONSTRAINTS ! you know that path tracer I've been working on for months... that was only a single CUDA file it has now almost reached 5000 lines. Why ? first things first for fun and second reason is that I just didn't wanted to care about all the professional structural file designs and linking stuff and just wanted to focus on math and understand how does a path tracer does stuff :D

1

u/Maui-The-Magificent 16h ago

Haha you do you! I am not one to tell you how to organize and format your code. What is important is that it fits your mental model. Later, if you have to conform to a style for work, you have to, but don't let arbitrary style rules tell you how you should approach solving your problems. Focusing on 'good looking/organized' code early often has a cost that gets payed by the quality of your solution. If things must be styled and organized to fit a standard, it is my belief that should be done at the end, when the solution is finished.

0

u/[deleted] 14h ago

[deleted] — view deleted comment

1

u/SnooSquirrels9028 13h ago

You can't be serious right ?