A Flash Developer Resource Site

Page 3 of 6 FirstFirst 123456 LastLast
Results 41 to 60 of 108

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

  1. #41
    Ich lerne jede Tag etwas Neues Evaman's Avatar
    Join Date
    Nov 2006
    Location
    Die Welt
    Posts
    236
    I didn´t even botherd to look at their code because:
    - to complex to understand at first and bloated with function I dont need
    - most of them are universal packages and they try to do anything (phng shading, normal mapping, bump mapping,...) 90% of those features are things I dont want for my project- they are more oriented to the masses who use it and dont know all the math behind it.
    - trying to understand it myself instead of depending on a framework/ package. That way I might be able to port knowledge gained here to other projects with perhaps other technologies. This happend already many times in my past
    - add special features for wich I need more expierence and be able to understand everything I have so far.
    So if you had advice to tell somebody on building their own 3d engine with Flash, what would you suggest of how to peruse codding?
    I agree; I have a Flash book about this stuff that is complicated to the absolute maximum boundary. I have such trouble interpreting it.

    I noticed with the Link model (Gut Arbeit) that there were two skins; one for night and for day. I assume that there is not going to be any lighting with this engine, or so far.

    I look forward to achieving your level with this one day.

    -Evaman

  2. #42
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    @Evaman: I am someone who learns most stuff by trying and through expierence in close areas. In my case I guess I have the advantage that I know pretty well 3dsmax and have a understanding what it needs for a 3d visulisation- so having knowledge in a 3d software might be usefull imo.

    I am no math genius but I know some decent trigonometry (and in case I fail wich happens from time to time I always draw illustrations to better understand the problem environment) and its a fundamental base for how I think and what I can do at least- so some good references on that are very helpfull.

    If you want to start a 3d engine: always worth recomending:
    http://www.kirupa.com/developer/acti...pt/3dindex.htm
    it´s not yet about texturing, lighting, and all the other complex stuff but it gets you already quite far and a very good start.

    little update:
    no visual progress this time but I made some progress with the scene files (xml file) wich describes the objects, textures and scripts to be used in a level.
    This is a example level (my way of working with xml projects) that I am about to read into AS3:
    PHP Code:
    <level title="insde the catacombs">
        
        <!-- 
    define the entities-->
        <
    assets>
            <
    tex tex="background1.jpg"/>
            <
    tex tex="background2.jpg"/>
            
            <
    obj url="obj/player.obj"    tex="uvlayout.jpg"/>
            <
    obj url="obj/table.obj"    tex="wood.jpg"/>
            <
    obj url="obj/key.obj"    tex="tools.jpg"/>
            
            <
    ani url="ani/player_ani.ani"/>
            
            <
    script id="testScript">
                [
    player].moveTo(320,116,0);
                [
    key].visible(1);
                
    wait(click);
                
    wait(500);
                [
    key].say('welcome to the demo room',500);
                
    setCam(cam1);
            </
    script>
            <
    script id="interAction">
                
    setCam(cam1);
                [
    key].tween([player],[player_ani],3,500);
            </
    script>
            
        </
    assets>
        
        <!-- 
    read only the assets and place them-->
        <
    scene>
            <
    cam pos="0,0,0" rot="90,0,0" fov="90" dim="320,240" tex="background1"/>
            <
    cam pos="110,22,55" rot="90,0,135" fov="90" tex="background2"/>
            
            <
    obj update="1" id="player" pos="0,0,0" rot="0,0,15"/>
            <
    obj update="1" id="key" pos="50,25,0" rot="0,0,270"/>
            
            <
    path>0,0,0/13,75,0/128,75,0/166,800,0/512,800,0</path>
            
            <
    grid pos="160,32" dim="64,48" click="testScript"/>
            <
    grid pos="160,32" dim="64,48" over="wait(400);setCam(cam1);[clip1].visible(0);" out="setCam(cam2);"/>
            
            <
    point pos="240,220,64" dim="32,32,32" click="[player].say('I wonder what this button does')"/>
        </
    scene>
    </
    level
    the most import decission is I guess that I have a assets and scene node. The asset node holds the instances to be loaded (even check if certain files are already adressed and then only load once). In the scene node all placements and assignments are made.
    As for scripting I plan to write a custom script engine that lets me write simple enough scripts (not to complex but also not to limited) directly in the xml. The scumn engine is a great inspiration here and I´ll propably borrow some methods from that language.

    So after I have the file manegement done wich needs some restructuring of my code I can optimize way again to know in the end what I can run at once.

  3. #43
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    almost finished my first editor tools for 3dsmax:

    everything works except for file loading- and writing animation files is on my tasklist.
    This interface is a collection of bunch of scripts that makes level editing for my future engine easier. For example I can quickly apply camera UV´s on objects, set their material identical to how it looks in flash, set Visibility for rendering and so on.
    Aside from that the classic binary writing script wich writes a binary smal file that I can read in AS3 and use as 3d format for my engine.
    The last part generates the XML level file wich I currently use (the one I introduced in my previous post). It automaticly detects the object type (mesh, path, camera,...) and even reads out the texture path associated with the object ect. very usefull. Right now I copy/paste alot into existing XML files I can read in AS3.

    The AS3 development looks rather boring but I wrote new classes to manage the file loading and to autmaticly recognize ID and their contents- and some cancel mechanics because in the past AS3 sometimes crashed while it was still loading files ect. A preloader for all dynamic objects (textures and meshes so far) in the scene works as well.

  4. #44
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    the as3 side has now developed a little bit as well:
    this is my current demo level. Note: in previous demos I posted here only 1 object could be loaded, wich now is about to change next to beeing able to load other kind objects as well (collision slopes, cages,...)

    I made a screenshot collection that better illustrates how everything works together (xml, flash, 3dsmax, maxscript):


    on the as3 side I fixed error events that occoured with wrong file names, corrupted files ect. and if something like that happens a default bitmap and mesh will be placed instead- that´s nicer as having flash itself puking 2 pages of errors.

  5. #45
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    new demo:

    online demo
    - handles multiple mesh instances and texture instances
    - camera switch (5 cameras in the demo, 3 with rendered backgrounds)

    for the ones that dont notice it right away- the brown- greenish rendering is static, the blue & red framed object and the character are flash 3d.

    for some reason the browsers (firefox & Opera) do not like when errors occour on file loading (e.g wrong url of a texture) for wich I created a fallback mechanism and it works perfectly offline but not in the browser- wich is something I need to find to fix.
    Also the camera matching has a little glitch wich you propably wont notice but I do if I compare it each time with the 3dsmax viewport wich needs to be fixed as well- it causes the perspective to shift a little bit on the z-Axis in some cases
    Last edited by renderhjs; 04-04-2008 at 04:27 AM.

  6. #46
    When you know are. Son of Bryce's Avatar
    Join Date
    Aug 2002
    Location
    Los Angeles
    Posts
    838
    Another impressive update. Do have have any IK system for your meshes? And do you have a way to take keyframe data from Max to Flash?

    Are you planning to release any of these tools you're developing? I know you've been giving bits and pieces of source here and there, but I imagined that you could release a whole development package if you wanted.

  7. #47
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    recenly I finished writing the maxscript part for reading back my mesh data so now I can write and read my custom *.3d files (with UV-data) wich are extremely tiny files compared to almost anything else there is available (3ds,obj,dae,ase,...). For simple objects like tables or chairs it takes usually below 1000 bytes.
    So I thought about releasing that together with a simple AS3 code on how to read and use the 3d data.

    Animation is planned to be solved via vertex animation wich means that I will create another filetype (*.ani perhaps) that will store the relative positions of the vertex points of the mesh that changed (motion wise) so it would be like storing the movements vectors of the vertex´s that moved. With that data I can of course transform the mesh file to that pose (like morphing). And with a tween function blend between them.
    So for a walkcylce for example I´d capture perhaps 4 frames of the animation in 3dsmax and tween in Flash between those 4 captured states so it would look smooth. Older games like Quake 2 did it that way.

    A bone IK system with Vertex Skinning (technique so that each vertex knows how much it is influenced by wich bones) is not only complicated to program but also veery cpu Intense I dont think that flash will handle it.
    ---
    a complete package release is rather unlikely - I am not a fan of others frameworks (in 99% of the cases) of very personal reasons- I´d rather write some tutorials or simplified code snippets so others would understand it and improve it rather than just copying and using it without thinking much about it.

  8. #48
    Senior Member
    Join Date
    Jun 2002
    Location
    Manchester, UK
    Posts
    2,357
    Great work on all this stuff render...been watching you run with this for a few weeks and it all looks great!

    RipX

  9. #49
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    while I still want to keep design and coding matters thread related here is something that is again a rather technical related progress.
    As pointed out before in the other design related thread
    http://www.renderhjs.net/bbs/polycou...h_tricks_1.jpg
    I managed to find a way to block out overlapping geometry and use it as texture with camera mapping on simplified geometry to overlap in the engine complex parts of the rendering over the character.
    Now the earlier image was rather a concept,- I hadn´t tested it yet- but I did now.
    So for this test I rendered 2 images:

    one with a alpha channel (PNG) and the other one without- booth will be loaded in the engine but only the one with alpha channel used as texture on objects,- the other one is the general background image for that particular camera.

    here are some shots from 3dsmax to perhaps better show the camera mapping model:

    as you can see on the last 2 pics it gets distorted on the texture because the UV- texture coordinates dont match the new view from where it´s been watched. I´d have to render in that case another Image of the view and build propably different lowPoly clipping objects.

    this last part are current shots from the flash player:

    it doesn´t look that different,- other than perhaps some tiny issues with depth sorting yet. I need to rewrite some loop stuff so that it propper sorts such things in particular so that all triangles are ditched into 1 array and not by objects seperately.


    I made also some progress with the animations for the engine,- the fileformat is already somewhat stable and soon I´ll try to read it into flash and first do some simple stuff like gotoAndStop to a particular animation state.

    The animations are vertex animations meaning that defined frames are stored for a object by storing all vertex positions of the model at the given time. For now those files are luckily very smal. I expect that a character with 300 triangles and lets say 16 frame states that can be tweened into stores below 15 KB. Within those 16 frames I could add states such as for the walk cycle, idle movements or actions such as picking something up.


    I plan on releasing sometime soon a code and explaination (with some illustrations) on how to use 3d package (max,maya,blender,...) camera into flash projects. So that a point in 3d[x,y,z] space matches the excact 2d[x,y] position on screen on booth sides: the 3d software and flash.
    That would include angle based FOV (not as in most tutorials with just a length value), the rotation axis and some principles about camera models in engines and applications (target camera, free camera, z-axis engine,..).

  10. #50
    Senior Member fil_razorback's Avatar
    Join Date
    Jul 2005
    Location
    Paris, France
    Posts
    607
    I've been reading this thread since you opened it and you never cease to impress me.
    Both your artistic and coding skills are very impressive, and you seem to work very fast too.

    Keep up the good work (and the eye candy !).

  11. #51
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    thx guys,
    another shot from the engine:

    been fixing the texture manager that displays either a default bitmapData fill or a generic undefined texture if I mess up the url in the XML or the ID in it. AS3 is extremely strict,- so now Flash displays less errors in the console if I make mistakes in the XML file.
    just so that you guys know a little bit what I am loading in the screenshot:
    PHP Code:
    <level title="Rheta">
        <
    assets>
            <
    tex tex="tex/_null.png"/>
            <
    obj url="3d/3d_test_girl.3d" tex="tex/girl.png"/>
            <
    obj url="3d/3d_test_rheta_house.3d" tex="tex/3d_test/3d_test_alpha.png"/>
            <
    obj url="3d/table2.3d" tex="tex/__.png"/>
            <
    tex tex="tex/3d_test/3d_test_bkg.jpg"/>
            <
    tex tex="tex/3d_test/3d_test_bkg_viewport.jpg"/>
            <
    tex tex="tex/3d_test/3d_test_bkg_viewport2.jpg"/>
        </
    assets>
        <
    scene>
            <
    obj id="table2" pos="850,336,0" rot="0,0,79"/>
            <
    obj id="3d_test_rheta_house" pos="810,367,272" rot="0,0,0"/>
            <
    cam pos="1291.69,57.6776,876.85" rot="42.7322,0.0,51.1842" fov="79.3" dim="500,300" tex="_3d_test_bkg_viewport"/>
            <
    cam pos="1291.69,57.6776,876.85" rot="42.7322,0.0,51.1842" fov="79.3" dim="700,420" tex="3d_test_bkg"/>    
        </
    scene>
    </
    level
    this is important for me at least because usually I copy paste the xml code from my maxscript tool without thinking,- often resulting into wrong texture urls or folder names.

  12. #52
    Ich lerne jede Tag etwas Neues Evaman's Avatar
    Join Date
    Nov 2006
    Location
    Die Welt
    Posts
    236
    I have a question for you Render; does the mesh of the fire allow it to move lively in a smooth animation through AS3? So far from what you are showing if I am not mistaking, that the AS3 scripting is rendering nice results. The character models that you have shared previously were nicely skinned, but seemed a little choppy, but I am also aware that you are not finished yet.

  13. #53
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    @Evaman: no realtime fire effects in flash,- I could render an animation from 3dsmax load it as SWF into the engine (most likely as little cropped sprite instead of the full resolution screen- After Effects will help there). But I am not sure if I like the idea of hammering on each Frame per second changing the Video of texture surfaces - because I worked all the way with sprites and as such in AS3 they are static,- instead I´d have to go for movieClip or something like that.
    What right now is far more important are vertex animations or scriptable textures, pathfinding and some other stuff.

    new demo

    online demo
    what changed (mostly intern):
    - new rendering model,- loops through 1 loop now,- no hierarchical array loops anymore (should make it faster)
    - camera filter can enable/ disable meshes per camera
    - new transform class for basic move & rotate transformations as well as vertex animations or morphing - so animations are on their way

    what this demo basicly shows is how the camera mapping technique works,- you can stand behind the door or infront of it and likewise the other spots.

  14. #54
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    cool, I made a movie
    Last edited by realMakc; 08-21-2009 at 07:06 AM.
    who is this? a word of friendly advice: FFS stop using AS2

  15. #55
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    you are nasty

  16. #56
    Senior Member
    Join Date
    Mar 2008
    Posts
    301
    You're just lucky your character only rotates around the one axis. Otherwise there's no telling what depths of depravity he could have sunk to.

  17. #57
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    update with 2 major breakthroughs:



    - animation system: Its pretty basic yet but it can already blend between 2 frame states of the 3d mesh. I´ll add scripting ability soon so that animations can be triggered from certain events like the walk loop or perhaps a run loop,- pick up animations ect.
    - Screen:2d to world:3d conversion: As you can see in the demo the Character gets placed in the 3d space based on the Screen X/Y Mouse coordinates- and this resolution independent and from any camera angle.

    online demo

    about the animations:
    As I mentioned earlier I save the animations from 3dsmax as vertex animations in a custom binary file. This is done using maxscript,- here is a screenshot of the usuage:

    I can animate whatever style I want (rig, modifiers, plugins, scripts,...)- what gets exported at the end are the vertex positions of the mesh at each defined frame.
    In flash then I can morph between 2 of those key-frames like this code in my frame loop:
    PHP Code:
    var p:Number = (getTimer()%1000)/1000;
    render.morph("mother",1,2,p); 
    wich will tween between frame 1 and 2 of the file where p is the percentage e.g 0.5 is just between them. In this case the precentage repeats each second from 0 till 1.

    Just on a sidenote:
    the filesize of this demo is 285 KB of wich 205 KB are already the texture of the mother (PNG with alpha channel) meaning that just the engine and the 3d + animation files are together just 43 KB wich is already quite smal.

  18. #58
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,139
    excellent work
    lather yourself up with soap - soap arcade

  19. #59
    Senior Member
    Join Date
    Nov 2003
    Location
    Las Vegas
    Posts
    770
    I am truly amazed at how well it runs on my old test box (533mhz 98SE with no graphics card and only 95mb ram) !!!

    And on my other machines, it's a dream

  20. #60
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    thx guys
    changed her textures now without alpha channel but smaler filesize (53 KB for the texture

    I am truly amazed at how well it runs on my old test box (533mhz 98SE with no graphics card and only 95mb ram)
    what framerate do you have with that machine? above 15 fps?

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