Making a 3D (viewport-ish)/real-time renderer.. from skratch
arne, you've inspired me to try my hand at actually implementing a rasterizer too.
Here's a link to how far I got today: http://www.zsouthboy.com/lame.zip
Almost have a coherent triangle! (The extra lines are fun, eh? Wee!)
Such a great brain exercise though - having to remember trig functions that i don't get to use in every day life!
First thing I'm doing when I get to rasterizing multiple triangles (correctly) is finding a way to write to a buffer, that is memcpy'd to the screen - it's farkin slow to write line by line.
Here's a link to how far I got today: http://www.zsouthboy.com/lame.zip
Almost have a coherent triangle! (The extra lines are fun, eh? Wee!)
Such a great brain exercise though - having to remember trig functions that i don't get to use in every day life!
First thing I'm doing when I get to rasterizing multiple triangles (correctly) is finding a way to write to a buffer, that is memcpy'd to the screen - it's farkin slow to write line by line.
I just woke up just now and knew exactly what I had to do to make it z-buffer the image!
So I fixed this in five minutes after I got out of bed,
and now it's working!!!
WOOHEE!!!
>>Working Z-Buffer<<
zsouthboy/Chris, I couldn't run you "Lame" renderer..
Cool name on a renderer
I don't think I can even think of kicking indigo's ass yet
So I fixed this in five minutes after I got out of bed,
and now it's working!!!
WOOHEE!!!
>>Working Z-Buffer<<
zsouthboy/Chris, I couldn't run you "Lame" renderer..
Cool name on a renderer
I don't think I can even think of kicking indigo's ass yet
WoooHoooooo!!!
I got colors and selection to work!!!
http://roxworth.elqx.com/obj_viewer/?s= ... =cubeSmall
EDIT:
New Url variables:
- &selected= (model name)
- &wire= (1)
- &hide= (model name)
I got colors and selection to work!!!
http://roxworth.elqx.com/obj_viewer/?s= ... =cubeSmall
EDIT:
New Url variables:
- &selected= (model name)
- &wire= (1)
- &hide= (model name)
Last edited by arneoog on Wed May 02, 2007 4:31 am, edited 3 times in total.
Questions:
How can I find the current depth on a triangle for any given point?
Having big problems finding a way to do it..
..right now it's just taking the mid depth of each tri..
And, any idea why there is gaps between each tri?
example
Thanks!
How can I find the current depth on a triangle for any given point?
Having big problems finding a way to do it..
..right now it's just taking the mid depth of each tri..
And, any idea why there is gaps between each tri?
example
Thanks!
Two things:
1) For any given point you're shading in a tri, to find the distance from camera, simply interpolate the z value of each vertex to that pixel. Same equation as the scanline rasterization!
2) Gaps between the tris are result of subpixel inaccuracy. All modern renderers (OGL & D3D) take care of this problem by shading a pixel :: the TOP LEFT POINT of it is inside the tri.
Check http://www.devmaster.net/articles/softw ... /part4.php
1) For any given point you're shading in a tri, to find the distance from camera, simply interpolate the z value of each vertex to that pixel. Same equation as the scanline rasterization!
2) Gaps between the tris are result of subpixel inaccuracy. All modern renderers (OGL & D3D) take care of this problem by shading a pixel :: the TOP LEFT POINT of it is inside the tri.
Check http://www.devmaster.net/articles/softw ... /part4.php
ah, okay
Thanks, zsouthboy (again )
New question:
I can't find any info/tutorial on how to write a .bmp file using only basic C++..
I have an example of it, but it's in such a complex code that I can't figur out how it actually work
Would be very nice if someone knew a page with all info regarding this,
or could post/send a very simple example of how to do it..
Btw, I have transformation, projection and triangle filling working in C++ now
..but only printing the result as characters.. *hint hint* hehe
Cheers!
Thanks, zsouthboy (again )
New question:
I can't find any info/tutorial on how to write a .bmp file using only basic C++..
I have an example of it, but it's in such a complex code that I can't figur out how it actually work
Would be very nice if someone knew a page with all info regarding this,
or could post/send a very simple example of how to do it..
Btw, I have transformation, projection and triangle filling working in C++ now
..but only printing the result as characters.. *hint hint* hehe
Cheers!
Who is online
Users browsing this forum: No registered users and 57 guests