A Flash Developer Resource Site

Page 4 of 6 FirstFirst 123456 LastLast
Results 61 to 80 of 108

Thread: [as3][3d] little 3d texturing demo

  1. #61
    Senior Member
    Join Date
    Nov 2003
    Location
    Las Vegas
    Posts
    770
    The old box gets between 14-18 at low quality, 12-14 at medium, and 9-12 at high. Most other 3d demos I've tried on it struggle to get above 6-8, so your demo seems to be optimized beyond just about anything I've seen.

  2. #62
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    update
    with a refined animation system

    - independent vertex animations per character
    - animation independent camera switching (no resets or delays)
    - queue manager with frame independent animations = doesn´t stress the CPU so much + smooth results on low specs
    this demo offers:
    - 4 cams
    - 3 animations for the mother, 2 for the animal. You can playback them simultaneous it should´t have a major impact on the performance

    the online demo

    on this AMD Athlon 3500+ (2.21 GHz single core) I get about 35 fps in Opera

    some stats about this demo:
    overall filesize: ~ 246 KB
    textures: 181 KB
    3d meshes: 12 KB
    animations: 15 KB
    engine + xml 38 KB

    so the biggest files are still the textures (PNG for the 2 characters because of some opaque parts), my custom file types are still damn smal wich should give the loading in general a good speed boost, also because there is hardly any parsing operating like in many other engines.

    As for the animations
    ,- since I want to trigger alot animations from within the XML via trigger events I decided to go with a script alike system to define the animations in Flash. THose scripts are defined as strings either in AS or in the xml (like a general syntax) and will behave the same.
    PHP Code:
    [mother]loop(1:200,2:200,3:200,4:200,5:200
    for example will animate the object 'mother' in a loop with the frame order: 1,2,3,4,5,- since it is a loop it will continue with 1,2,3,.. The number after the ':' defines the delay till the next frame in miliseconds- if it isn´t defined it takes the defined values for that frame from the animation file.
    PHP Code:
    [mother]set(6:600,7:600,8:400
    this code will just animate once the sequence of frames 6,7,8. With this system its quite easy to animate specific stuff. What misses right now is a blend system that will blend between different sequences like between a walk cycle and a picking up animation so that it generally feels even more smooth.


    the xml I used for the demo: (so you can see some of my structure)
    PHP Code:
    <level title="animation test">
        <
    assets>
            <
    tex tex="tex/checker2.jpg"/>
            <
    obj id="mother" url="3d/3d_test_mother.3d" tex="tex/3d_test/3d_test_mother_tiny.png" ani="ani/mother.ani"/>
            
            <
    obj url="3d/table2.3d" tex="tex/crate_1.jpg"/>
            <
    obj url="ani/animal.3d" tex="ani/animal.png" ani="ani/animal.ani" />
        </
    assets>
        <
    scene>
            <
    obj id="mother" pos="0,0,0" rot="0,0,0"/>
            <
    obj id="animal" pos="0,0,0" rot="0,0,0"/>
            <
    obj id="table2" pos="0,54,0" rot="0,0,0"/>

            <
    cam pos="-161.407,-238.335,252.669" rot="57.5,0.0,-34.5001" fov="45.0" dim="700,420" tex="checker2" filter="*"/>
            <
    cam pos="41.8764,-158.188,216.902" rot="46.9986,-0.0019,18.0001" fov="45.0" dim="700,420" tex="checker2" filter="*"/>
            <
    cam pos="-32.1218,-123.423,324.713" rot="25.9986,-0.0019,-7.9999" fov="45.0" dim="500,320" tex="checker2" filter="*"/>
            <
    cam pos="52.5253,-120.152,161.507" rot="40.999,0.0,34.0" fov="45.0" dim="700,420" tex="checker2" filter="*"/>
        </
    scene>
    </
    level
    like I mentioned earlier,- the assets part defines the elements to be loaded and instanced later,- while the 2nd part 'scene' defines the objects in the scene space.
    A filter variable on the cameras can define wich objects to include or exclude '*' as wildcard includes everything.


    here is another screenshot how I saved the frames of the mother character:

    she has 11 frames out of the timeline that are saved each frame as a vertex object snapshot. The numbers 0,10,20,30,40,50,60,65,... are the frame numbers of the max timeline.

    I am looking forward for some walking and pathfinding stuff to be done next
    Last edited by renderhjs; 05-24-2008 at 01:30 AM.

  3. #63
    Senior Member
    Join Date
    Jun 2007
    Location
    Planet Earth
    Posts
    358
    Hey man, are you going to rewrite your engine once flashplayer 10 comes out? I'm actually almost disappointed, because you have all of this brilliant, excellent work, but now it just got a whole lot easier with z-rotation and graphics support for bitmapdata.
    America!

  4. #64
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    the z-rotation is just for designers - but they included a polygon drawing method (with texture coordinates) wich will be most likely hardware accelerated with the full release of FP 10 or 10.5- it shouldn´t be hard to switch to that method.
    In general I am however not so hyped about Flash player 10 (hated AS3 in the beginning as well), this already runs almost close to what I wanted from the beginning.

  5. #65
    Zombie Coder EvilKris's Avatar
    Join Date
    Jun 2006
    Location
    Fukuoka, Japan.
    Posts
    796
    Just want you to know the only reason I haven't commented on how admirable this current project of yours is simply because I don't want to brown tongue you too much. I'm pretty sure you're aware of how awesome your work is and as such it doesn't really need to be said. Great stuff though, I love the creepy little gremlin, really feeling the Alone in The Dark vibe from it all.

  6. #66
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    Quote Originally Posted by EvilKris
    Just want you to know the only reason I haven't commented on how admirable this current project of yours is simply because I don't want to brown tongue you too much.
    Seconded. I've checked the thread every day since it was made, so any updates are appreciated.
    http://www.birchlabs.co.uk/
    You know you want to.

  7. #67
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    thx guys,- will update more & more, if i´d have the time even with some sample code

    little progress with the pathfinding- or to say I am in the middle of writing the core stuff for it. No demo for now instead hopefully a little bit of insight:


    My approach basicly follows what I discovered back in this older project of mine . It´s about finding automaticly the perimetric points (corner turning points) of the vector slopes so that later on those points are used in my actual pathfinding algorithm as node points to connect possible path´s.
    My orthographic engine used an xtra editor for placing those points semi- automatic but in the end still by hand.
    This time I want to automate everything so that I dont need any Xtra setup beforehead for the pathfinding- just a spline-path from within 3dsmax exported.


    because the vector slopes also define my screen hit area of where i can possibly walk to I use them as somewhat buttons as well (maybe that will be my first time using actually hitTest).
    The red areas are of course not accessable and because of that in another layer and prompted by click as not accessable.
    Anyway I have my click area with this but in fact it looks odd if the character moves to close around the corners (the character has some volume or radius) wich is the reason why I need to offset them from their tangent direction.

  8. #68
    Senior Member rachil0's Avatar
    Join Date
    Jul 2007
    Location
    Columbus, OH.
    Posts
    465
    Just took a look at that animation demo, it's super man! I think you did a great job on the texturing.

  9. #69
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    added 3 display modes to better debug and check my invisible level elements:

    pathfiding programming is going fine just need the time to finish. The pink squares are the node points for the pathfinding network. White squares are markers for the edges that are visible for the camera and thus should be included in the calculation.

  10. #70
    President PhobiK's Avatar
    Join Date
    Jan 2005
    Location
    Guatemala
    Posts
    918
    Wow man! I'm really impressed by all the work I've seen in this thread. Really awesome!!! Keep it up man, this is something great!
    This is MC. His _parents sent him to stop() by the super market to buy some _root beer if he wanted to gotoAndPlay() with his friends at the park later.

    This is my Blog!... The gaming Process
    Please check out my site: Giddel Creations

  11. #71
    Feeling adventurous? T1ger's Avatar
    Join Date
    Mar 2004
    Posts
    850
    Great work as always Render I hope this project will be finished, as I cant wait to play it

    (Flash is so much funnier than accounting! Oh.. maybe I can combine the two.. Note to self: next flash project could be a flash accounting program..)
    I don't have a photograph, but you can have my footprints. They're upstairs in my socks.

  12. #72
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    a new update with a demo

    online demo

    I disabled the pathfinding because it still causes some errors in my code (seems to be connected with certain camera objects and their number values). But I´ll include that in the next demo for sure.
    What I wanted to show however in this demo is the walk path and the automatic switch of animations (2 for now).
    Keys:
    - [d] = debug mode
    - [1]...[3] = switch between camera A,B and C

    additional nodes:
    If you loose focus of the flash movie,- it will switch to a idle mode,- to undo this click on the flash movie once to enable it again.

    If the character should seem to slide rather than walk it means that your Computer or Browser (Firefox RC 3 [no 30 FPS limit] or Opera 9.5 recomended) doesn´t reach the optimal framerate of 37-40 fps. This is because the movement is not yet timed but rather framerate depending wich will be fixed of course.

    I reduced the texture of the mother character in the demo simply because her texture was way to big (170 KB before, 36 KB now). All in all the whole demo takes about 353 KB alltogether (14 files: htm, xml, mesh, animation, textures)- wich is pretty much for what I targeted for a demo like this.

    Pathfinding:

    Like mentioned before if you hit the [d] key you can switch between the 3 display modes and see some of the debugging functionality,- like the path nodes.
    The node network is calculated each time you switch the camera. Nodes are only taken into account if they are visible on screen mainly for performance reasons.
    More updates with demos specificly regarding pathfinding are up next

    //edit: stupid me forgot to include the url of the demo X)
    Last edited by renderhjs; 06-16-2008 at 08:42 AM.

  13. #73
    Senior Member rachil0's Avatar
    Join Date
    Jul 2007
    Location
    Columbus, OH.
    Posts
    465
    Very nice I was wondering, how does the model self-occlude? I'm guessing a z-sort by face centroid?

  14. #74
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    yes face center,- anything else would be way over my head for now and to complex to archive anytime soon.

  15. #75
    Senior Member
    Join Date
    Mar 2000
    Location
    highlands, scotland
    Posts
    223
    very nice indeed!

    heh, its been a while since ive been on the flash scene, but i am way impressed by what ive been reading and looking at by everyone.

    some very nice work, just be sure to keep it up.

    ah.. minds me of the old days of 'alone in the dark'

  16. #76
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    the pathfinding is now as good as done
    same url:
    online demo
    updates:
    - propper pause mode: hover outside the flash container to pause,- hover back to gain focus and un-pause the game (no keys needed).
    - pathfinding cursor: if you see a yellow crosshair it means you can click on that area to walk to it- any other area will be ignored.
    - more detailed floor area (46 spline vertecies ), if you hit [d] you can see the details esspecially in camera A

    some xtra info about the pathfinding,
    even though I roughly explained it before, here is another attempt:

    Nodes are calculated automaticly on each camera switch. If you click somewhere on the clickable area,
    it tries to do the following:
    1.) check if a direct path is possible (e.g no border crosses the direct path)
    2.) if not find the closest entry and exit node
    3.) if not, no path. If so find the closest path between entry node and exit node
    4.) if pathes are found (returns multple soloutions, sort them by pixeldistance to be moved,- take the shortest one
    5.) if that shortest one is found try to reduce nodes in the path at the end while still not crossing with any of the border vectors
    6.) do the same for the beginning,- remove those nodes in the path result that can be skipped from the start
    7.) return the path and unshift the start position at the beginning of the path array and push the target position at the end of the path array.

    8.) execute the path : move the character from path point to path point till it reached the last point.

    with about 92 path vectors it takes at maximum here (39 fps) about 190 miliseconds to find the quickest path (usually it then already found ~500 possible paths to be sorted) - but the average search time is about 30-80 miliseconds.
    To reach these fast results I had to cheat a little bit by excluding on each new possible search those who would return a longer path (in terms of nodes stops) as what the shortest result used so far.

    Wich means:
    Once a possible path is found,- the next possible result can´t have more than the previous amount of node stops.
    The advantage:
    - really fast and quick on close distances
    the con:
    - can be a little bit slow with a hell lot nodes and a very long distance
    - in some very rare cases not always resulting in the real shortest path,- but even then it´s not that much noticeable

  17. #77
    Elvis...who tha f**k is Elvis? phreax's Avatar
    Join Date
    Feb 2001
    Posts
    1,836
    Looks good Render! She did turn the "long way" at one point, when she should change, so if she had turned clockwise it would have been 30 degrees but she turned ccw and it was like 330 degrees. Of course this happened just when I switched camera, so that might have interfered too! Besides from that it looks pretty smooth, and when the masks get into work, it's gonna be fun to poke around
    Streets Of Poker - Heads-Up Texas Hold'em Poker Game

  18. #78
    Custom User Title Incrue's Avatar
    Join Date
    Feb 2004
    Posts
    973
    In the final version there will be just 3 cameras?I was thinking it would rotate like your portfolio
    If its just 3, you could also do this with a lot of pre rendered images, inst it?I mean, it would be a hell of a big file but you could use copyPixels, it would be faster to get done,you should not worry about the 3d speed and other things...but i see that as you are doing that to learn 3d things that can be used in other things...

  19. #79
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,139
    Quote Originally Posted by renderhjs
    4.) if pathes are found (returns multple soloutions, sort them by pixeldistance to be moved,- take the shortest one
    I think this should be path distance, as phreax pointed out, sometimes she walks in the wrong direction to get to the first node.

    you could also maybe abstract your map, so you only check nodes in the same quadrant that you're in.

    it might be possible to automate it, just thinking outloud a quadrant should contain at least 4 nodes, on each "edge" nodes, link to the adjacent quadrants edge nodes. I did this in my RTS pathfinder and it worked very well. Only nodes within the start and end quadrant need to be checked.

    I also dont know why you need to recalculate the paths on every camera switch? aren't the nodes in 3D space? you should only have to calculate once.

    anyway, top stuff as usual, keep it going
    lather yourself up with soap - soap arcade

  20. #80
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    @phreax: regarding the rotation,- I know its because it was dirty implemented, like
    PHP Code:
    rotation+= (targetRotation rotation)/smoothness
    that way it gets interpolated quickly in a decimal system,- but that doesn´t work for the 360° shortest distance. Will be taken care of soon.

    @Incrue: these are technology demo shots,- dont take anything you see here as final. Lots of cameras will be used in the end,- so lots of automatic switching.
    The whole idea of this engine was to use static cameras,- and I dont intend to do otherwise.

    @mr_malee: yes I rethought it might change that,- its just the way my code now is written comparing by array length was way easier- might fix that.

    regarding quadrant,- dont think that will work for me,- what if the possible path exceeds the quadrant?,- this gets even more difficult with perspective absolutely varying cameras - each time you´ll get a different frustrum.

    about recalculating: for now I implemented it like that,- thought in the beginning that there might be some dynamic stuff like door switching or some changes in the environment so that I need to recalulate it on demand. It´s not really slowing down right now - if it gets I´l might store them in a array.

    updates
    been fixing some of the pathfinding, there was a nasty spot (a friend spotted it for me) in the demo where the flash player would freeze for 15 seconds (infinity loop).
    Today I have been trying to find a way to smooth my path´s to be taken so that it looks more natural.
    So I made a concept of how it would be ideally:
    the idea is to make a curve in every corner using only certain percentage amount of the seperate strokes.
    I what I discovered ended into a little demo:

    inside my engine it looks like this:



    I have some ideas about improvements,- but first let me show you how I did it:

    I´ve been playing with B-Splines and Subdevisions before but honestly never really understood the math of them- so usually I depended on some forumulas other already broken up already into usefull AS pieces.
    But from analyzing some illustration like this and this, I managed to find a visual solloution myself, the way I usually solve math problems: by drawing them in flash or on paper and trying to solve them step by step.
    here is how I did it:
    I hope that explains it pretty well. I did that basicly with every corner- so that my edgy pathfinding curve ended up into a curvy one.


    as for improvements:
    I do think that the percentage of each stroke should have a limited in real size units instead of percentage values of any stroke. This is because if you have a very long stroke followed by a rather smal but cornering one its very likely that my character will walk into walls or areas she shouldn´t supposed to be.
    So in the end I´d check if the certage of a stroke would exceed the radius of the character and if so,- reset the corner side length to the character radius

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