How the fuck do I write a 3d engine?

How the fuck do I write a 3d engine?

Attached: not mine.jpg (640x469, 97K)

Other urls found in this thread:

youtube.com/watch?v=HQYsFshbkYw
keithclark.co.uk/labs/css-fps/
en.wikipedia.org/wiki/Rotation_matrix
en.wikipedia.org/wiki/3D_projection
youtube.com/channel/UC-yuWVUplUJZvieEligKBkA
github.com/ssloy/tinyrenderer
gitlab.com/Phnod/infr-2350-tutorials-winter-2019
get.webgl.org/
scratchapixel.com/lessons/3d-basic-rendering/introduction-to-ray-tracing
twitter.com/SFWRedditImages

youtube.com/watch?v=HQYsFshbkYw

opengl 4.6 + imgui + luajit
in C++ btw

using graphics api's or do your own software rendering?

>How the fuck do I write a 3d engine?

First step is to open a portal to HELL.

Attached: john_Carmack_working.jpg (468x332, 18K)

that fucking posture

you program it with html and css

keithclark.co.uk/labs/css-fps/

>bisqit
BASED

cant imagine a more based programmer

Carefully

Know trigonometry

Lots and lots of matrices

Jesus Christ how horrifying.

>keithclark.co.uk/labs/css-fps/
its just a software rasterizer. They aren't THAT complicated.

Mouse and keyboard

thin matrix and the cherno have soms great videos on this

Attached: Screenshot_20190305-232904_Reddit.jpg (1080x1920, 550K)

>the vector cross product is like black magic

Conceptually all you need for a 3D engine back-end is an implementation of a 3D Rotation Matrix solver. Then just pick a graphics buffer and you've got the basics. I wrote mine in Javascript and HTML5

en.wikipedia.org/wiki/Rotation_matrix
en.wikipedia.org/wiki/3D_projection

Check out this guys channel. Extremely based.
youtube.com/channel/UC-yuWVUplUJZvieEligKBkA

I did in 1993 in ASM. You faggots have it so damn easy these days. man up.

>c++
retard

I try to enjoy this guys videos but I hate how he uses his own library for everything.

explain for a newb

He's shitposting. Language wars here are like console wars on /v/

men write in c faggot

You dont.

you can't. it's only possible to fully understand the third dimension from a 4th dimensional perspective. this is why raytracing is a meme

>raytracing is a meme
you have no idea how wrong you are, kid

github.com/ssloy/tinyrenderer

cpp 3d stuff

Just use Godot dude.

Depends how much you want to torment yourself. If you're sane, use opengl. If you want to make it from scratch, you're in for a world of trouble. It's not hard, just very finicky.
I made a 3D engine entirely from scratch myself (I've posted it here before), and it's pure masochism. Only python, on the CPU, single threaded. The framerate in the screenshot is generous about how well it runs. It uses no matrix-based math, no stepping into the fourth dimension, fuck all optimization, and is made of 100% pure spaghetti. I'm not even sure how some parts of it work, they just happened to.
Most of the loss is in texture mapping. It's actually quite usable without it, getting 30-60+ FPS on models under 1000 polygons.

Attached: Capture.png (817x840, 153K)

That's fucking metal dude

You are just a brainlet then, I see you didn't even fix unfilled pixels between polys. I remember making one of these software texture mapped lighted etc renderers when I was 13, today you can find a million tutorials and explanations to do it it's not even a weekend project.

Tfw not working on your engine, but a code generator for your engine's data model.

Quaternions, learn what they are and your life becomes immeasurably easier.

/thread

>youtube.com/channel/UC-yuWVUplUJZvieEligKBkA
it's not difficult to translate to other libraries. I ported his 3D renderer to SDL without problems and I'm not a veteran programmer.

So I guess this is why every CS program makes you take linear algebra...can't imagine the absolute universe-brain motherfuckers who first implemented this shit way back when.

3D or 2.5D?

you don't, use an existing one.

really bothered me how that one corner was angled...

Attached: 1551818135068.jpg (640x428, 153K)

write a 2d renderer and physics engine. add a 3rd dimension. not that fucking hard. the hard part is shit like shaders and bump mapping, or if you really want to get serious, ray-tracing, volumetric effects and or voxel rendering.

or to put this another way:
3D isn't the hard part: the hard part is making it usable with good tooling (like importing meshs and textures from easy software like blender) and making it look good.
Making a simple 3d renderer for cubes and spheres without dynamic cameras, lighting and shaders is easy

what kind of mathematics must i know to build a 3D engine?

Attached: neuro.jpg (400x390, 150K)

Nevermind. Fixed it.

Attached: untitled.4.jpg (1920x1885, 500K)

High-school level trigonometry.

Linear Algebra

It's an absolute requirement.

gitlab.com/Phnod/infr-2350-tutorials-winter-2019
the TA for the graphics course at my school has some code examples as a repo for us to use. He's been showing us how to go from scratch and build a framework in C++ & OpenGL.

>I believe there is an incredible number of counterfeit doctrines and antichrists (Greek word that literally means counterfeit messiah), some more obvious and some more subtle. Islam being one of the most obvious ones.
Holy fucking based.

make a 2D engine and then just (all the engine stuff)^(3/2)

Sure you did kiddo. I programmed the entire Linux kernel from scratch but Linus stole the credit. Not bad for an 8 year old tho

That's what Stackexchange is for, user

Learn Javascript
get.webgl.org/

>getting 30-60+ FPS on models under 1000 polygons
have you tried running it under PyPy
plain old CPython is slow as fuck, I've seen scripts that take several seconds get sped up to having nearly no noticeable processing time beyond PyPy starting up

Borland Applications Frameworks is how I worked on Win NT 3.51

I compile/decompile features allowed me to get around the old bugs left from 3.11

some basic vector math and trig and you can copy+paste the rest

The entirety of the 3rd dimension can be encoded into 2 dimensions. And I mean everything. You, me.. the internet... sunlight... everything.

>thinks she's 1337

C++ is literally just C but better. There's no practical reason to use C anymore except in very specialized cases.

cukkity kek

Right, if C was a number, say 20, then C++ would still be 20 but after you compile it, it would be 21. So it's the same thing but just +1 better afterwards.

c programmers only hate C++ becuase they're scared of templates which are literally macros but safer
functional programmers bring up actual flaws with C++
c programmers just complain about muh templates

You use a graphics engine to draw regular 2d triangles.
You write one shader that transforms (rotates, moves, scales) the triangles' points and one that colors them.

That's basically it.

The one thing C does better is compile times.
Usually sacrificing runtime cost, though, by passing void* instead of using template for code generation.

A software rasterizer is not that hard its maybe 100 lines of code. All you do is make a function to draw the upper and lower halves of a triangle, another function to rotate points, and one to load in the data or just type it out. You can then modify the drawing function to add color, then garoud shading, then texture mapping and normal mapping if you want. Each step is maybe 3 extra lines of code. Most computer science classes assign this as a homework exercise to be turned in before the next class.

>raytracing is a meme
but ray tracing is the industry standard...

you only need quaternions for 3d physics. Most 3d games don't need them simply storing yaw and pitch instead of 4/3 values.

Look into raytracing OP, any retard can slap one of those together from near scratch. See: shadertoy

scratchapixel.com/lessons/3d-basic-rendering/introduction-to-ray-tracing

Attached: FB_IMG_1551410210505.jpg (519x610, 41K)

why is his head 8 inches ahead of his torso wtf

You gotta keep your head in the game(s)

Be good at vector based math

man taught this woman how to shade in with his hair cut. Notice his scar on her square then. She has to memorize him. Chinese or Korean but the man teaching is definitely Korean. This is how they steal btw. Thanks!

Build it flat, like the earth

I have tried it under pypy, and while much faster, it's unusable in this case.
The issue is that it's actually using pygame for the window, even though the heavy lifting is done by my code. Pygame doesn't work under pypy, and the replacement pygame_cffi is incomplete and unstable, also has a bad memory leak, and to top it off is a pain in the ass to get to work on windows.

good luck retracing 2 decades worth of modern 3d engine dev on your own, faggot

raytracer is my daily kata, takes about 10 min to make in any language with a readily accessible windowing system. Don't use it for games though that's retarded, way too slow.