flat assembler
Message board for the users of flat assembler.
Index
> Projects and Ideas > How fill 3D triangle using XYZ ? |
| Author |
|
|
revolution 23 Aug 2026, 08:21
The screen is 2D so the 3D XYZ position is converted/projected to 2D first.
1. Project XYZ to the 2D view rectangle to give xy (no z). 2. Fill xy triangle. |
|||
|
|
revolution 23 Aug 2026, 08:25
BTW: It depends upon which kind of projection is needed, but a common projection method is simply to divide each of X and Y by Z.
x = X/Z y = Y/Z This gives the normal "vanishing point" projection. There other types of projection also, these can all be tried to see which is best. |
|||
|
|
Roman 23 Aug 2026, 10:56
Quote: x = X/Z No. I want put in my 3d world game, boxes to shape as 3d triangle. For this reason i needed xyz coords.
|
||||||||||
|
||||||||||
|
Roman 23 Aug 2026, 14:44
I do this. 3D Boxes draw shape triangle using coords xyz.
Last edited by Roman on 26 Aug 2026, 13:06; edited 2 times in total |
||||||||||
|
||||||||||
|
Roman 26 Aug 2026, 12:46
I am done voxelization 3D triangle.
t1 dd 0 ,100f ,0f ;triangle vertices t2 dd 200f ,0 ,0 t3 dd 0f ,0 ,200f
|
||||||||||
|
||||||||||
|
comrade 01 Sep 2026, 01:18
It can't be too dissimilar from rasterizing a 3D -> 2D triangle:
1. Project 3D vertex coordinates to 2D space (divide by Z for perspective projection, standard stuff). 2. Then, project the 2D coordinates to the vertical line to understand where the top, bottom, and "middle" point of the triangle is. 3. Iterate scanline by scanline - but instead of drawing pixels, you generate a voxel. 4. Reduce fidelity by making large steps across the scanline, and when walking the vertcal line. |
|||
|
|
bitshifter 04 Sep 2026, 06:53
The first code you posted is 1 of 3 popular rendering methods.
Its hard to make it fast even with SIMD instructions. Madis and Nick did research on this 10+ years ago... Here is example of bbox triangles (mostly used in HW not SW) https://github.com/ssloy/tinyrenderer The other popular two options are scanline rasterization and raytracing. _________________ Coding a 3D game engine with fasm is like trying to eat an elephant, you just have to keep focused and take it one 'byte' at a time. |
|||
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2026, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.