Computer Science Canada More on .RAW |
Author: | RaPsCaLLioN [ Mon Aug 16, 2004 10:11 am ] |
Post subject: | More on .RAW |
Update of .raw import. Try it with some big raw files.. I'll include one I found somewhere on the board. This should be pretty self explanatory but post any questions/comments/glitches. |
Author: | Delta [ Mon Aug 16, 2004 11:18 am ] |
Post subject: | |
that's awesome man! I love it when you render it very nice work. Teach me the ways! Anyways... one thing... wireframe do that instead of the triangles and lil lines... |
Author: | DanShadow [ Mon Aug 16, 2004 3:26 pm ] |
Post subject: | |
OMFG! That is awesome!! Keep up the great work!! +bits |
Author: | templest [ Wed Aug 18, 2004 10:18 am ] |
Post subject: | |
whaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaat.... +20 Bits |
Author: | RaPsCaLLioN [ Wed Aug 18, 2004 1:50 pm ] |
Post subject: | |
Delta wrote: that's awesome man! I love it when you render it very nice work. Teach me the ways! Anyways... one thing... wireframe do that instead of the triangles and lil lines...
I only do the lil lines if the .RAW file is really large... if u load a smaller .RAW file like uh.... ship.raw or plane2.raw... then it will use full wireframe. U can find those somewhere on the board too |
Author: | templest [ Wed Aug 18, 2004 4:47 pm ] |
Post subject: | |
I seriously doubt that you wrote those coordinate files by hand. Is this a MAYA or 3dsmax file you wrote a program to read and render, or did you really write all that out by hand? |
Author: | RaPsCaLLioN [ Wed Aug 18, 2004 6:25 pm ] |
Post subject: | |
templest wrote: I seriously doubt that you wrote those coordinate files by hand. Is this a MAYA or 3dsmax file you wrote a program to read and render, or did you really write all that out by hand?
Do you know anything about .RAW files? and I never claimed I wrote all those coordinates, are u crazy? |
Author: | templest [ Wed Aug 18, 2004 6:33 pm ] |
Post subject: | |
Nope, I have no idea what a .RAW file is. Nope, I'm not crazy. Nope, I never suggested that you claimed you wrote those RAW files. Since it's your program, I assumed that was yours as well. Why don't know enlighten me, wtf is a RAW file? |
Author: | Mazer [ Wed Aug 18, 2004 8:44 pm ] | ||
Post subject: | |||
My understanding of them is that a .raw file is simply a format for 3D meshes that simply stores coordinates for the vertices. So, one line of the file would mean one vertex and would look like
(using actual values for the coords) Also, and I'm not too sure about this one since I don't use this format, they may or may not store a normal vector for each face. I dunno. It's pretty simple to write some script to export a .raw file (or another file with a similar format) using most popular 3D packages (Blender anyone?). The challenge lies in making a renderer for it in turing. Kudos to you RaPs, kudos. |
Author: | RaPsCaLLioN [ Thu Aug 19, 2004 9:12 am ] | ||
Post subject: | |||
No normal stored in .raw file. Each line is stored as one vertice..
It's just strored as plain text format. I use a program called Deep Exploration to export to .raw format. I think Catalyst suggested that. |
Author: | Mazer [ Thu Aug 19, 2004 2:19 pm ] | ||
Post subject: | |||
RaPsCaLLioN wrote: No normal stored in .raw file. Each line is stored as one vertice..
Er, don't you mean one triangle? |
Author: | RaPsCaLLioN [ Thu Aug 19, 2004 4:07 pm ] |
Post subject: | |
Well... Yes whatever... One triagle/ 3 vertices |
Author: | TheZsterBunny [ Thu Aug 19, 2004 11:07 pm ] |
Post subject: | |
Incredible. Wow. l33t. I've wondered how one can make program such as that. can you perchance post your source. especially the 'render' button. wow. -Z +93 bits |
Author: | RaPsCaLLioN [ Fri Aug 20, 2004 2:09 am ] |
Post subject: | |
I'll post the code when I'm done tweaking. I just noticed I didn't give any info on PgUP/PgDown - use those buttons for a better zoom... U should only use the Zoom buttons for .raw files that are coded really tiny... So yea, try PgUP/PgDown. |
Author: | TheZsterBunny [ Fri Aug 20, 2004 8:45 am ] |
Post subject: | |
Before you post the code, I'd like to take my own shot at this. 2 problems I've encountered in the past were: -the interpretation of the Z coord -the rotation of the shape. How do you get around these problems? What formulas are used for the rotation and z-interpretation? -Z |
Author: | TheZsterBunny [ Fri Aug 20, 2004 4:15 pm ] |
Post subject: | |
I give up. I've tried all day, but I cannot figure out what i'm doing wrong. I would very much like to learn how that program was done -Z |
Author: | RaPsCaLLioN [ Fri Aug 20, 2004 6:07 pm ] |
Post subject: | |
Do you know the equation for rotation? Just make an array that stores 3 coordinates for each point (X, Y, Z) - rotate each accordingly - same equation for any axis. And just draw the 'screen' x/y coordinates. I don't make any sense... I'll post the code but it doesn't make much more sense than I do. Let me play around w/ it a bit more first. |
Author: | Mazer [ Fri Aug 20, 2004 6:11 pm ] |
Post subject: | |
I'm a bit curious, how is the Z sorting done? Just taking the average Z coord for each face and sorting them based on that? |
Author: | RaPsCaLLioN [ Sat Aug 21, 2004 7:44 am ] | ||
Post subject: | |||
Yep. So there are some cases where the display would be wrong because the avg of a polygon that should be located further away may be closer than the avg of an up front polygon.
This is another example of polygons that wouldn't be displayed right. |
Author: | TheZsterBunny [ Sat Aug 21, 2004 7:45 am ] | ||
Post subject: | |||
WHat is the rotation code? I have a nifty way of keeping the shape stored, but rotation is giving me difficulties.
The answer is probably something very simple, and I'm missing it completely. I dug up some formulas for rotation, but I didn't understand them. Its from some computer science university class. Open with PPT. I have to go, -Z |
Author: | RaPsCaLLioN [ Sat Aug 21, 2004 7:58 am ] | ||
Post subject: | |||
This is the procedure for rotation. iTheta is the angle whether +/-. The big problem I encountered initially was during display. It took me forever to realize to use a temp variable to store the rounded value to display. I first rounded each stored point which caused distortion in shape.
|
Author: | TheZsterBunny [ Sat Aug 21, 2004 8:42 am ] | ||
Post subject: | |||
Crap. I've seen that thing before too. This
is what I've used to draw my shapes. Can you please explain to me what the iAxis variables are? Thanks -Z --edit-- and what arPolygons are --edit-- I get it. Thanks. -Z -Z |
Author: | TheZsterBunny [ Sat Aug 21, 2004 11:32 am ] | ||
Post subject: | |||
Ok, got it. 'cept I'm having trouble with the z-sort. ...and shapes with over 10 000 polygons. meh. -Z
|
Author: | RaPsCaLLioN [ Sat Aug 21, 2004 7:42 pm ] |
Post subject: | |
When I used ur code I didn't have problems with .raw files larger than 10k.. What's happening? |
Author: | TheZsterBunny [ Sun Aug 22, 2004 9:32 pm ] |
Post subject: | |
No problems with polygon numbers, but it becomes a bit slow. My Z-Sort is quite slow, and there are occasional problems with overlap. -Z |
Author: | TheZsterBunny [ Sun Aug 22, 2004 9:58 pm ] | ||
Post subject: | |||
Tried my hand at the Z-Sort and distance shading parts of the engine. Still having trouble with both. Fair warning with this version. THe fewer polygons, the better. I've tested this with plane2.raw and it has been pretty smooth. Except for the overlapping polygons. -Z |
Author: | RaPsCaLLioN [ Mon Aug 23, 2004 11:37 am ] |
Post subject: | |
I'll check that code out when I get home and Edit this reply with comments. EDIT I see what u mean with the z-sort. Look into a Quick sort method. I can help u there if u need it. Also, try culling your polygons and that should fix some of the display problems. That should also speed up the system quite a bit. I never liked distance shading. |
Author: | TheZsterBunny [ Tue Aug 24, 2004 5:50 pm ] |
Post subject: | |
Thanks. I've spent the last 2 days trying to remember what I learned in compsci class. the teacher showed us an incredible sorting procedure which sorted huge arrays almost instantly, but I cannot remember it. Also, what is the polygon culling? --edit-- well I found your qsort procedures and am trying to decipher them. I'm just curious as to one part. The variables 'lo' and 'hi', are they the actual values or the unsorted positions of? -Z |
Author: | RaPsCaLLioN [ Wed Aug 25, 2004 9:50 am ] |
Post subject: | |
'lo' and 'hi' are the array positions of the section to sort. Polygon culling is removing background polygons (which aren't seen anyway) from being drawn to speed up the process. |
Author: | TheZsterBunny [ Wed Aug 25, 2004 3:10 pm ] | ||
Post subject: | |||
so to sort the entire array
1 would be 'lo' and 5 would be 'hi'? There is also palce for 2 arrays. A is the output, B is the unsorted data? -Z |
Author: | RaPsCaLLioN [ Thu Aug 26, 2004 6:57 pm ] |
Post subject: | |
a is the centroid (depth value) of each polygon which to sort by and b is the associated location of that polygon in the 'master' array. |
Author: | TheZsterBunny [ Thu Aug 26, 2004 9:20 pm ] |
Post subject: | |
Cool. That helped very much. Now, if you don't mind, another question. How does one go about culling polygons? I think it may have to do with calculating the area of a polygon and seeing if it overlaps any polygons entirely, but I believe this would be less efficient than drawing every polygon. -Z p.s. got distance shading done! |
Author: | Mazer [ Fri Aug 27, 2004 5:56 am ] |
Post subject: | |
You could use the vertices of a triangle and get a normal vector for the face, then check the Z component of it to see if it goes into the screen or out of the screen. This would involve 'cross product', which you learn in grade 12 algebra, but I'm too lazy to explain it well enough right now. Check this site for more info. |
Author: | RaPsCaLLioN [ Fri Aug 27, 2004 9:33 am ] |
Post subject: | |
Yea like that. U should also use that method for shading. |
Author: | TheZsterBunny [ Fri Aug 27, 2004 5:54 pm ] | ||
Post subject: | |||
... This is the method I use for shading.
where sort is my average Z array from lowest to highest. --edit-- Mazer, I just finished struggling through grade 10 white math. It'll be a while before I learn this in class. If you get the time... -Z |
Author: | Mazer [ Fri Aug 27, 2004 7:43 pm ] |
Post subject: | |
I thought the site in my link explained it pretty well, but ok. It's really easy, actually, and in my opinion Mr. Caldwell's method is much simpler. Thus, it's the method I'll use. Just give me a minute to make some pretty illustrations. |
Author: | Mazer [ Fri Aug 27, 2004 8:08 pm ] |
Post subject: | |
I hope this helps. If you want to get the vectors from a triangle, pick an point and subtract it from the other two points. One more thing: order matters. If C = A crossed with B, then A crossed with b = -C. Right hand rule: Find vector A. Put your right hand out at A with your fingers stretched in the direction of the vector. Now curl your fingers toward vector B. Sticking your thumb out should show you the direction of vector C. I'm not sure how you would handle this. Are all of the triangles supposed to have their vertices listed in the same order? |