Coder Social home page Coder Social logo

alternativa3d's Introduction

Alternativa3D

Alternativa3D is a high-tech and high-performance 3D engine for ActionScript 3 and Adobe AIR. It supports hardware acceleration for browser-based games and applications. Initially, the engine was designed to meet our own needs but we realized that it wouldn't be fair to limit the use of the technology to just one game. That is why we decided to make it an open source engine. Since our top priorities are high performance and resource efficiency, we recommend using it for games with high-resolution graphics.

We will gladly partner with ambitious professionals to develop features that will be used in large projects.

Features:

  • Based on Flash Player technology
  • API is analagous to API Flash
  • 3ds Max compatible
  • GPU acceleration (graphic cards newer than 2005)
  • Support of own A3D object model format
  • Resource efficiency control
  • The main texture formats: JPG, PNG, ATF, GIF
  • ATF format support
  • Character and object animation with blending
  • Sprite and sprite animation
  • Materials that work with lighting, reflection and lightmaps
  • Shadows from light sources
  • Support of mouse events
  • Support of the particle system

Links

facebook twitter Blog Forum

Projects using Alternativa3D

![Play](http://alternativaplatform.github.com/Alternativa3D/images/combatsector (cover).jpg)
MMO Top-Down Shooter game based on futuristic gladiator fights
![](http://alternativaplatform.github.com/Alternativa3D/images/combatsector 1.png) ![](http://alternativaplatform.github.com/Alternativa3D/images/combatsector 2.png) ![](http://alternativaplatform.github.com/Alternativa3D/images/combatsector 3.png)
![](http://alternativaplatform.github.com/Alternativa3D/images/combatsector 4.png) ![](http://alternativaplatform.github.com/Alternativa3D/images/combatsector 5.jpg)

![Play](http://alternativaplatform.github.com/Alternativa3D/images/deadzone (cover).jpg)
MMO RPG game - post-apocalyptic survival after a virus has transformed people into zombies.
![](http://alternativaplatform.github.com/Alternativa3D/images/deadzone 1.jpg) ![](http://alternativaplatform.github.com/Alternativa3D/images/deadzone 2.jpg) ![](http://alternativaplatform.github.com/Alternativa3D/images/deadzone 3.jpg)
![](http://alternativaplatform.github.com/Alternativa3D/images/deadzone 4.jpg) ![](http://alternativaplatform.github.com/Alternativa3D/images/deadzone 5.jpg)

Videos

Play Play Play

Demos

Play Play Play Play

Repository

We offer the community not only use of the engine but involvement in its further development. If you have found a bug you can notify us about it. You can use repositories, create your own branches, experiment and recommend whatever changes you think should be made. All useful changes will be employed in the engine architecture, and your contribution will be made known to the public though facebook and twitter.

  • Alternativa3D - The current engine version.
  • Alternativa3DUtils - Add-ins and enhancers. You don't need to know the shader programming to create utilities, so feel free to experiement.
  • Alternativa3DExamples - Examples of using the engine with various features demonstrated. If we like your examples they will appear in the main repository branch.

Documentation

Articles on the use of the product

Plugin for Blender

Plugin for Autodesk 3ds Max

Literature

Our helpers

  • Davide Jones
  • redefy
    (All those who took part in the development and writing of posts, please contact us)

alternativa3d's People

Contributors

avkviring avatar chrisdenham avatar ffelini avatar fomkin avatar idkravitz avatar lanior avatar leonid-gaev avatar leonidgaev avatar makc avatar nordonoscillius avatar pecheny avatar therabbitwindfall avatar wilsonsilva avatar yaski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alternativa3d's Issues

Performance optimizations using object literals

Object literals are faster than the new operator

Strings, Numbers (including int and uint), and Boolean objects are usually instantiated using literal notation (var str:String = “text”). Objects and Arrays are often instantiated using the “new” operator – this is seldom necessary (only in the case of a fixed-length Array), and is slower.

var o:Object = {}; is faster than var o:Object = new Object();

and

var a:Array = []; is faster than var a:Array = new Array();

Blurry Sprite3D

When we use Sprite3D we don't want to scale up the bitmapdata if it is not power of two. So, we need to have something like Image in starling.

I made changes (hardcode) to reach such behavior.
Here are some changes in BitmapTextureResource.as:

            if (resizeForGPU) {
                var wLog2Num:Number = Math.log(data.width)/Math.LN2;
                var hLog2Num:Number = Math.log(data.height)/Math.LN2;
                var wLog2:int = Math.ceil(wLog2Num);
                var hLog2:int = Math.ceil(hLog2Num);
                if (wLog2 != wLog2Num || hLog2 != hLog2Num || wLog2 > 11 || hLog2 > 11) {
                    // Resize bitmap
                    wLog2 = (wLog2 > 11) ? 11 : wLog2;
                    hLog2 = (hLog2 > 11) ? 11 : hLog2;
                    source = new BitmapData(1 << wLog2, 1 << hLog2, data.transparent, 0x0);
                    source.copyPixels(data, data.rect, new Point(0, 0));
                    scaleUV = new Rectangle(0, 0, data.width / source.width, data.height / source.height);
                }
            }

So, we copy data without resizing. source.copyPixels(data, data.rect, new Point(0, 0)); Then save scaleUV to set them in Sprite3D.as:

            geometry.setAttributeValues(VertexAttributes.POSITION, Vector.<Number>([0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0]));
            geometry.setAttributeValues(VertexAttributes.NORMAL, Vector.<Number>([0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1]));
            geometry.setAttributeValues(VertexAttributes.TEXCOORDS[0], Vector.<Number>([0, 0, 0, scaleV, scaleU, scaleV, scaleU, 0]));
            geometry.setAttributeValues(VertexAttributes.TEXCOORDS[1], Vector.<Number>([0, 0, 0, scaleV, scaleU, scaleV, scaleU, 0]));
            geometry.setAttributeValues(VertexAttributes.TEXCOORDS[2], Vector.<Number>([0, 0, 0, scaleV, scaleU, scaleV, scaleU, 0]));
            geometry.setAttributeValues(VertexAttributes.TEXCOORDS[3], Vector.<Number>([0, 0, 0, scaleV, scaleU, scaleV, scaleU, 0]));
            geometry.setAttributeValues(VertexAttributes.TEXCOORDS[4], Vector.<Number>([0, 0, 0, scaleV, scaleU, scaleV, scaleU, 0]));
            geometry.setAttributeValues(VertexAttributes.TEXCOORDS[5], Vector.<Number>([0, 0, 0, scaleV, scaleU, scaleV, scaleU, 0]));
            geometry.setAttributeValues(VertexAttributes.TEXCOORDS[6], Vector.<Number>([0, 0, 0, scaleV, scaleU, scaleV, scaleU, 0]));
            geometry.setAttributeValues(VertexAttributes.TEXCOORDS[7], Vector.<Number>([0, 0, 0, scaleV, scaleU, scaleV, scaleU, 0]));

I don't know how to integrate it correct into the main code. So it would be great to see similar changes in the next releases.

Thanks.

Null pointer exception during publish 3ds

Hi

When I try to publish my 3ds file with textures in http://a3dplayer.com/ Iget error

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at alternativa.engine3d.loaders::ExporterA3D/exportGeometry()[C:\Develop\platform\clients\fp11\libraries\Alternativa3D\trunk\target\checkout\src\alternativa\engine3d\loaders\ExporterA3D.as:523]
at alternativa.engine3d.loaders::ExporterA3D/exportMesh()[C:\Develop\platform\clients\fp11\libraries\Alternativa3D\trunk\target\checkout\src\alternativa\engine3d\loaders\ExporterA3D.as:370]
at alternativa.engine3d.loaders::ExporterA3D/exportHierarchy()[C:\Develop\platform\clients\fp11\libraries\Alternativa3D\trunk\target\checkout\src\alternativa\engine3d\loaders\ExporterA3D.as:256]
at alternativa.engine3d.loaders::ExporterA3D/exportHierarchy()[C:\Develop\platform\clients\fp11\libraries\Alternativa3D\trunk\target\checkout\src\alternativa\engine3d\loaders\ExporterA3D.as:267]
at alternativa.engine3d.loaders::ExporterA3D/export()[C:\Develop\platform\clients\fp11\libraries\Alternativa3D\trunk\target\checkout\src\alternativa\engine3d\loaders\ExporterA3D.as:171]
at projects.editor.clients.fp11.Alternativa3DEditor.export.exportSWF.progressPhase::ExportProgressPhase/prepareModelSource()
at projects.editor.clients.fp11.Alternativa3DEditor.export.exportSWF.progressPhase::ExportProgressPhase()
at projects.editor.clients.fp11.Alternativa3DEditor.app::ExportController/exportToSWF()
at projects.editor.clients.fp11.Alternativa3DEditor.app.views.topPanel::TopPanel/__exportSWF_click()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at alternativa.gui.mouse::MouseManager/onClick()[C:\work\fb3\AlternativaGUI\target\checkout\src\alternativa\gui\mouse\MouseManager.as:990]
at alternativa.gui.mouse::MouseManager/onMouseUp()[C:\work\fb3\AlternativaGUI\target\checkout\src\alternativa\gui\mouse\MouseManager.as:1128]

Android and IOS wrong MouseEvent3D Z order

Only on Android and IOS if you have for example a box on a plane and click on the box, the mouseevent3D will always target the plane.

So the issue is concerning MouseEvent3D with overlapping object.

lookAt methods point in wrong y direction

I have two comments about the lookAt methods (in DirectionalLight, SpotLight, Camera3D, and possibly elsewhere):

  1. I think this method should be implemented in Object3D, not in multiple subclasses.
  2. When deltaY is non-zero, the lookAt method produces incorrect results for me. It points down when it should point up and vice versa. If you aren't able to trivially reproduce this, let me know and I'll investigate the cause further.

Thanks!

Z ordering wrong on Android

Everything works fine on Windows. However, when I take my code to Android, the Z ordering of objects is all wrong. The following code produces these outputs:

Windows 7 64 Home Premium, Adobe AIR 3.3:http://i49.tinypic.com/20jo2kg.png - Right

Android 3.2.1 Le Pan II, Adobe AIR 3.3: http://i50.tinypic.com/1z1sgtc.png - Wrong

(Flex 4.6 SDK, AIR 3.3 SDK, Alternativa3D 8.27, FlashDevelop 4.0.4 RTM with default "AIR Mobile AS3 App" profile)

package 
{
    import alternativa.engine3d.core.Camera3D;
    import alternativa.engine3d.core.Object3D;
    import alternativa.engine3d.core.View;
    import alternativa.engine3d.lights.OmniLight;
    import alternativa.engine3d.materials.StandardMaterial;
    import alternativa.engine3d.primitives.Box;
    import alternativa.engine3d.resources.BitmapTextureResource;
    import flash.display.BitmapData;
    import flash.display.Stage3D;
    import flash.events.Event;
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;

    [SWF(width = "1024", height = "720")]

    public class Main extends Sprite 
    {
        public var
            stage3D     :Stage3D = stage.stage3Ds[0],
            scene       :Object3D = new Object3D(),
            camera      :Camera3D;

        public function Main():void 
        {
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.align = StageAlign.TOP_LEFT;

            stage3D = stage.stage3Ds[0];
            stage3D.addEventListener(Event.CONTEXT3D_CREATE, onContext3dCreate);
            stage3D.requestContext3D();
        }

        private function onContext3dCreate(event:Event):void
        {
            camera = new Camera3D(1, 10000);
            camera.view = new View(stage.stageWidth, stage.stageHeight);
            camera.view.hideLogo();
            camera.rotationX = -.5;
            camera.rotationY = -1;
            scene.addChild(camera);
            addChild(camera.view);

            var light:OmniLight = new OmniLight(0xffffff, 5000, 10000);
            scene.addChild(light);

            var normalMap:BitmapTextureResource = new BitmapTextureResource(new BitmapData(1, 1, false, 0x7f7fff));
            normalMap.upload(stage3D.context3D);

            var texture:BitmapTextureResource = new BitmapTextureResource(new BitmapData(1, 1, false, 0xff0000));
            texture.upload(stage3D.context3D);
            var material:StandardMaterial = new StandardMaterial(texture, normalMap);

            var boxSize:uint = 50;
            var boxCount:int = 10;
            for (var x:int = 0; x < boxCount; x++)
                for (var z:int = 0; z < boxCount; z++)
                {
                    var box:Box = new Box(boxSize - 5, 10, boxSize - 5);
                    box.geometry.upload(stage3D.context3D);
                    box.getSurface(0).material = material;
                    box.x = (boxSize * x) - (boxCount * boxSize);
                    box.y = 50;
                    box.z = boxSize * z;
                    scene.addChild(box);
                }

            camera.render(stage3D);
        }
    }
}

Why does BitmapTextureResource have to lose _texture?

This is more like forum question, but - since it's down - here goes:

            } else {
                _texture = null;
                throw new Error("Cannot upload without data");
            }

Why does it have to do that? I could understand throw, but "= null" part is mysterious 😕

ExporterA3D doesn't export materials

Оказалось, что ExporterA3D не умеет экспортировать обычный StandartMaterial в котором находится BitmapTextureResource.

private function exportMap(source:TextureResource, channel:int, dest:A3D2):int {
            if (source == null) return -1;
            var result:A3D2Map = mapsMap[source];
            if (result != null) return result.id;
            if (source is ExternalTextureResource) {
                var resource:ExternalTextureResource = source as ExternalTextureResource;
                result = new A3D2Map(channel, mapID, exportImage(resource, dest));
                if (dest.maps == null) dest.maps = new Vector.<A3D2Map>();
                dest.maps[mapID] = result;
                mapsMap[source] = result;

                return mapID++;
            }
            return -1;
        }

Почему только if (source is ExternalTextureResource) { ???????? Невероятно!
Я бы сделал пуллреквест только у вас там бинарные библиотеки.

No Wiki?

Could we please have a wiki to post tutorials and how-tos?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.