A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 35 of 35

Thread: Linear transformations

  1. #21
    Palindrome emordnilaP Diniden's Avatar
    Join Date
    Feb 2008
    Posts
    230
    Also good job on your doom project ) it's looking very nice ^_^

    Are you just rendering squares for everything? or is it still triangle polygons?

  2. #22
    Palindrome emordnilaP Diniden's Avatar
    Join Date
    Feb 2008
    Posts
    230
    Ok well I applied my theory and I was right X_X, after I translate my initial vector to a new vector space, anything that lies on the positive X-axis of that vector space is "behind" that space!!! So! I can do all my 3D face clipping by simply doing a if(_X>=0) { face or point is not on screen }....but of course I'm extending that to 3 different vector spaces for clipping the field of vision properly. Then with these 3 vector spaces I have intersections between them at easily determined intersections so I can reduce the number of needed calculations when translating the screen anywhere....*is happy*

    I'm almost getting to the point of utilizing rays to try out bitmap rendering methods....having little time here and there to concentrate on this program ;~;

  3. #23
    Senior Member rachil0's Avatar
    Join Date
    Jul 2007
    Location
    Columbus, OH.
    Posts
    465
    I think a picture is worth a thousand words, hard to visualize what you're up to. But I'm looking forward to seeing it in action.

    That doom demo is squares for everything. It creates the frame pixel by pixel and then blows it up by a factor of 2-4 (that's why it's so blocky).

  4. #24
    Palindrome emordnilaP Diniden's Avatar
    Join Date
    Feb 2008
    Posts
    230
    Yeah sorry I'm not posting anything I don't feel there is anything worth showing yet :P

    You can't exactly see what I'm up to just yet visually...just a buncha boxes sitting around for now...

    I've split all my faces into triangles...getting good calculation results so far, once I design some sort of complex shape that you can walk around I'll start posting what I'm up to ^_^

    but interesting scaling idea you got going XD I was wondering how you got it big :d (also wondering about the blocky thing...but was assuming it was just pixelated bitmaps you were using XD)...interesting way of going about it though...

    Like I said, almost there to getting the ray depiction of who and what I'm doing...since I have simplified the faces I'll be looping through by a freakish ton, I think I'll be shooting rays to each vertex that is visible to find the needed faces (thus eliminating any sorting...the rays will decide order of render of only visible faces...)

    Also, I'm working on making the calculations a lot more efficient by making point groupings (which relate to vector space crossings) to only check through those groupings to enhance performance a lot more...

  5. #25
    Palindrome emordnilaP Diniden's Avatar
    Join Date
    Feb 2008
    Posts
    230
    Ok I got the visual space fixed finally (well kinda I did a slight hack on one of my equations cause I couldn't figure out what was going on with one of the rotations whilst translating to my field of vision vector spaces, but it works well enough for the time being...just have this big hole of unsatisfied feeling residing in me now)

    Anywho, I'll be doing ray visible face detection now (to find what visible faces are behind what faces) and once I get that done I'll make some spiffy large complex object to run around to see how it works so far...still not quite there to the point of rendering my bitmaps (which I dread will kill my fps finally *tears*) but at least working on step by step : ) I'm relatively happy I got this far without reading on 3D engines yet

  6. #26
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    I knew everybody could do it
    who is this? a word of friendly advice: FFS stop using AS2

  7. #27
    Palindrome emordnilaP Diniden's Avatar
    Join Date
    Feb 2008
    Posts
    230
    Ok a demo is coming out real soon...so far I have gotten the ray construction algorithm fixed up. It makes a ray to every visible vertex. Finding the end of the ray was easy (since it was just the location of the vertex XP) but finding where it's start point was, was a little tricky.

    My idea was to send a ray from the screen to ever visible vertex, if the ray intersects a plane on the way to the vertex then the vertex is behind something. If all three vertex's of a plane is behind another plane, then don't render the plane (I know this idea creates potential holes in a proper render, but this is just my start at this...)

    Anywho, the hard part of this idea was finding the proper place to begin the ray in relation to the screen. If I chose the proper begin and end location of the ray, then the ray should end up looking like a single point on the screen if I drew the ray.

    At anyrate I accomplished that much!! But I'm now struggling making the algorithm that finds the begin point more efficient using a basis...for some reason when I do it in basis form it renders wrong X (, I believe I'm just making a simple computational error though...but too tired tonight to solve it =_= I'll let you all know how it goes by tomorrow though ^_^, I predict in 1-2 days I'll have my first model, unless I encounter some frustrating hang up...in which I will not be pleased :P...

    In a nut shell things before first model:

    -Calculate proper basis for improving ray begin point generation
    -make ray to plane intersection detection

    then after that it all good ...

    Hitting 125 CUBES rendered in an environment atm at 35 fps...if all cubes are visible goes down to 25. Each cube represents 8 points and 12 faces. total of 1480 faces and 1000 points in the environment.

    if the cubes are not drawn then hitting 125 fps when they are not onscreen and 40 fps when all are "visible". When they are all visible it means there are also rays being drawn to each point.

  8. #28
    Palindrome emordnilaP Diniden's Avatar
    Join Date
    Feb 2008
    Posts
    230
    Well I hit a hangup T_T I can't get my ray/segment algorithm to intersect properly with a plane...Have no clue why it won't work...may take a bit to sort out before that demo I promised will come out...


    Edit: Everytime I post I have an issue here it seems I solve it in 5 minutes....well it'll be just a little bit for that model now XD!!
    Last edited by Diniden; 06-02-2008 at 04:37 PM.

  9. #29
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    maybe you might want to check other people algos for that
    who is this? a word of friendly advice: FFS stop using AS2

  10. #30
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    not that I have to share code for now (very messy right now),- but perhaps some insight of someone who is rather visual driven as technical:
    http://board.flashkit.com/board/show...hp?t=760371#17
    http://board.flashkit.com/board/showthread.php?t=759766
    http://board.flashkit.com/board/show...72#post3818672
    http://board.flashkit.com/board/showthread.php?t=720250

    even though you haven´t shown anything so far,- it sounds interesting- cant wait seeing a demo at some point

  11. #31
    Palindrome emordnilaP Diniden's Avatar
    Join Date
    Feb 2008
    Posts
    230
    Well I looked at your posts that were listed hoping to find some sort of revelation to help me out here, but my methods differ from what I see going on...

    As far as what's going on at this point with my engine, I got all of the rays (or segments...whichever I need...rays cost 1 less conditional :P) intersecting perfectly with my faces. Now to render perfectly I could shoot these rays over every pixel and easily make a perfect rendering XD; however, we all should know that that would bog down the processor extensively...

    I need to think of a clever way to determine visible faces with these rays instead...that's ALL I need then I can do whatever rendering I want (since I'm using rays/segments I could even achieve lighting effects extremely easily).

    I remember rachil or realMak discussing shotting more rays at the edges of my targets. Ok, I can do that. As a matter of fact I can shoot rays at ONLY the edges of every visible face (in front of the camera) if I wanted to. As a matter of fact it's scary easy to do so. However, once I send these rays to the edges what do I do with all the intersections I gather???

    That is where I'm hitting a wall. I'm not entirely sure what to do with the data I get from the intersections (I can tell you the intersection of the rays in the vector space the ray is shot or I can tell you the intersection in relation to the vector space of the camera...).

    I'm trying to find the visible faces with as little ray shooting as possible (all the algorithms I thought/looked up/modified all required a fair amount of calculation for the cause, but still not hefty...all just addition and subtraction ^_^)


    So, knowing I can offer you all this, how can I properly determine visible faces and then tell you the sorting of these visible faces?

  12. #32
    Palindrome emordnilaP Diniden's Avatar
    Join Date
    Feb 2008
    Posts
    230
    btw, I have one method, but it's pretty ray intensive still.

    My method is starting with the farthest back faces, for every pixel that is an edge of those faces shoot a ray to find if something is in front of that edge, if it crosses a plane or multiple planes get the closest plane and trace it's edge with rays and search for overlapping planes.

    Well, that's a very simplified way of putting it XD. It may not be a bad idea because I'm sure a lot of efficiency can be added to quite quickly find all visible edges and ordering of faces, but even at it's most efficient state it would still require a lot of pixels to cover I believe...just tracing around a 700x600 screen's edge would be 2600 rays *ouch*.

    So, any thoughts or comments on other ways to use the rays?


    Edit: Just thought of one...after mapping the edges to the screen, detect any crossings between planes and shoot rays at the intersections...and luckily I'm already mapping the points to the screen and storing them before face detection :d hmmmmmmmm....

    Well, should you still think of something else lemme know your thoughts...I'll try working out this wee little theory of mine : }
    Last edited by Diniden; 06-03-2008 at 05:24 PM.

  13. #33
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    maybe post a screenshot or demo before

  14. #34
    Palindrome emordnilaP Diniden's Avatar
    Join Date
    Feb 2008
    Posts
    230
    Once again it's not all worth posting (because it won't tell you much...)....I can draw a picture of how my modeling works from a different angle. Would that help??

    (see when I draw all the rays and all that fun stuff coming from the camera, it appears as single dots on the screen, which is how it's supposed to be since the ray follows the angle of perspective from the viewer. So posting the swf won't help in the least since everything I'm doing is mostly math vector spacing and rays that appear as dots XP).

    And I decided to finally break down and read on 3D engine a bit...

    It seems what my issue is, is actually one of the most discussed issues in the 3D world XD "hidden surface determination". I was amazed at the range of algorithms being used X_X

    So at any rate, I'll draw that picture for you which will show how things are running as of now. I'll have it up by tomorrow.

    Also, I'll be working on my intersection in 2D ray shooting algorithm. It'll also probably include a priority listing of some sort which will help with eliminating redundancy....(my head almost exploded after I got the rays to intersect properly when I realized that there were so many different conditions to consider in the depth setting X_X)...

    (by the way, I ramble a TON in these posts I'm making, because 1: it lets you know how I'm thinking through this and 2: it's a great place to take notes if I forget something I thought X_X, so sorry if a lot of what I say doesn't make sense!)

    To expand a bit more on what I'm thinking regarding this intersection in 2D algorithm:

    First step: Find all faces within cameras view //this step is still a tad buggy on my end...

    Second step: Set all the faces depth priority to 1

    Third step: Find all intersections of every face when all the faces points are projected on the screen

    Fourth step: Shoot a ray from all of the pixels intersection location in the 3D space (in the proper direction according to perspective distortion of course)

    Fifth step: For every ray shot collect all the intersections the ray made with the planes and set each planes priority who is behind the other to the priority of the plane it was behind if that planes priority was greater than the priority in front of it.

    Sixth step: Sort faces by priority

    Now this handles Z sorting just fine...I'm still thinking through the hidden face part...*grumbles*
    Last edited by Diniden; 06-03-2008 at 06:45 PM.

  15. #35
    When you know are. Son of Bryce's Avatar
    Join Date
    Aug 2002
    Location
    Los Angeles
    Posts
    838
    Quote Originally Posted by yvillicana
    flashandmath.com
    has a lot of examples

    ---Yvette
    Thanks for this link, looks like it will be very helpful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center