- Видео 11
- Просмотров 187 246
Marcus Mathiassen
Добавлен 15 янв 2012
Видео
Quadtree vs Spatial partitioning
Просмотров 15 тыс.8 лет назад
source code github.com/MarcusMathiassen/P2D
Spatial partitioning 2D collisions
Просмотров 5 тыс.8 лет назад
source code github.com/MarcusMathiassen/P2D
apple sucks !!!
Yo! Thx for github.
Real time ray tracing is what we want,ray tracing is simple.
Idk why this is in my Rex but I like it
i thought i'd understand visually how it works but i guess i was wrong
okay i see it. when theres a lot of items on the screen and theres only 4 partitions, its lagging and slow. once you add a lot more of these, stuff gets quicker
Hmm why my .ppm file does not exist anywhere, please help
One thing I didn't understand which is why you made the direction vector of every ray constant (0,0,1), I think it must be calculated as the direction from the camera towards the pixel. I'm I right or wrong?
You’re right. I think I made some type of faux orthographic raytracer but honestly I don’t remember.
@@MarcusMathiassen okay, thanks!
which sublime text theme is that?
RTX ON
If I wanted to create a for with a different image each a time how could I do that?
I ran the code in visual studio code and a ppm file "out.ppm" got generated. But it has nothing in it. It shows 0 bytes. Could you please tell what might be the error?
this is awesome
For all the Windows people, if you want to open the file with your default viewer like him, the command is "explorer picture.ppm". That is, you should be writing system("explorer picture.ppm") instead of system("open picture.ppm")
eyy tysm
The R, G, and B components are usually in the range of 0 - 255 inclusive, so you should mod by 256, not 255.
This is very impressive. If you could make a video explaining line by line, that would be awseom
wait so we dont need images?
I’m confused
It's out of focus can't read it.
Thank you very much. Modified it slightly to print custom barcodes from 1s and 0s to a pbm file. Github is: Chrissavi :D
The process cannot access the file because it is being used by another process. in visual studio 2019
This is exactly what I was looking for! Thank you very much!
This content is gold!!!
О, спасибо (thank you)
"Lemme just feed this object into this shit ton of linear algebra"
Pretty much describes most low level graphics programming.
How located coordinate axises? X-axis to viewer, Y-axis - right, Z-axis - up?
Exactly what I wanted, huge thanks!
if you do this code also show similar thing what is this man code: #include<iostream> using namespace std; int main() { system("1.png"); }
Shouldn't the ray origin be 0,0,0 and ray direction x,y,1 ?
I think this is more of an orthographic raytracer, so you can use your own "camera" if you'd like. Though there really are better videos than this. Use it more as a guide than anything.
how do you get to the bash?
You should do an ideal gas simulation
Which compiler are you using?
BombyX 09 clang
#include <fstream> using namespace std; const int width = 255, height = 255; int main () { ofstream img ("image.png"); img << "P3" << endl; img << width << " " << height << endl; img << "255" << endl; for (int y = 0; y < height; y++){ for (int x = 0; x < width; x++){ int r = x % 255; int g = y % 255; int b = y * x % 255; img << r << " " << g << " " << b << endl; } } system("open image.png"); return 0; }
Hey Marcus, i followed through the video but when i run it, it generates an O file which cant be opened on Win 10. I did it on Code::Blocks. Please help.
Nabel Wangwe .o file? As in Object file? Pass it to «cl» to generate an .exe
Eres ua bestia amigo :3 Wou justo yo buscando cosas sobre Ryatracong y tu pones este video. Perdon si no hablo ingles xd
no hay problema
@@MarcusMathiassen :3
Is quadtree faster? Did I understand correctly?
Here, yes, but I remember being sceptical of the performance difference.
I guess it depends on how uniform your distribution of objects is.. If you end up having very many objects, densely together, then trees will bring you more benefits than a uniform grid.. On the other hand, a hierarchical grid may also bring you some of the benefits :)
@@TheLeontheking Isn't a quadtree a hierarchical form of partitioning?
@@olivieero123456789 Yes. What they probably mean by hierarchical grid is either or both of two things. Multiple resolution grids for different object sizes, and multiple bit arrays at lower resolutions to represent something like a quad tree without an actual hierarchy.
In case anyone is confused, he is using pure C++ with fstream library (file stream - useful for creating and working with files of all types) to create a .ppm (portable pixel map / a very inefficient and uncompressed image filetype) file containing information of a sort of "snapshot" created using ray tracing techniques. The console is not a renderer, so when you compile this code do not expect to print the image. The code compiles and generates the .ppm file from source, which you can view with something like gimp or photoshop or fileviewer or most text editors.
PPM is a very simple and easy ASCII format. I love it!
How would you print out the file in Windows?
@@yugiohonline26 What do you mean by print out?
@@yugiohonline26 Imagine this file type as a huge 2d array of color values. This code is programmatically generating the ppm file with a raytracing algorithim. If you want to view the file, open it with some software that can view ppm files.
@@nintendoblood4835 Ok when I run g++ test.out or a.out it doesn't create a ppm file at all. Could it be because I'm on Windows?
*_Please Source Code_*
*_Please Source Code_*
*_Please Source Code_*
*_Please Source Code_*
How would you go about making a bounding box? i cant figure it out for the life of me and all the other "tutorials" ive seen use much more complex and messier code making it hard for someone whos new to the whole raytracing thing to follow along and actually understand whats going on.
Remove the «system» call. It has nothing to do with creating the image and should have been left out. Save yourself the compiler error and remove it.
Wonderful, it helped me a lot. But how to remove system call? What should be replaced?
@@arashshiri5256 replace «system» by nothing and open the output file manually
I use system but declaration error accures .How out of the error?
it says system is undefined and it wont work
Adam Hostetler Just remove the line. Check my answer in other comments for details.
Marcus Mathiassen If i remove system(“open picture.ppm”) nothing happens.
This looks so good! Thanks for the tutorial...
if you dont comment whats the difference from simply read the completed code?
i *literally copied the code* and it didn't work....... **confused screaming**
Can it be used as background so that we can print statements on it
When calculating the discriminant, isn't the formula (-b +- sqrt(b^2 - 4ac))/2? If so, why do you not divide by two in Sphere::intersect?
Oh he just remembered a little bit of stuff from others videos and made a "tutorial" out of it, the dude does not actually understand what he is typing
Next time put some bg music! Overall nice vid.
Kai Tsurugi it’s a BYOBG video. I’ll do voiceover on whatevers next
With vector, you can make more complex images, with fun and calculations.
how much particle? why u use textfile as console? great work.
Particle count is the 'OBJ' counter in the window title. And that is the macOS Terminal, though i see how it might look like 'TextEdit'.
@@MarcusMathiassen argh lol ok sorry. iam noob.