Code Monkey home page Code Monkey logo

cubicvr.js's People

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

cubicvr.js's Issues

Number of lights check extends init time by 2000ms

This line below (in CubicVR.js) makes initializing CubicVR much slower. What should be done about it?

      var lc = 1;

      while (1) {
          if (!lightTest.use(enums.light.type.POINT,lc) || lc === 8) {
            base.MAX_LIGHTS=lc;
            break;
          }
          lc++;
      }

mat4.multiply fix parameter order to be logical, matR,matL -> matL,matR

Now that the math library is in a much better state it's probably a good time to fix up the logically reversed order on the mat4.multiply function that was carried over from my old C++ software rendering stack -- it's origin isn't CubicVR C++ since it used the OpenGL matrix stack exclusively at the time which is why I needed to quickly grab an old implementation I had available for porting :)

Update documentation for 0.2.1

Any minor patches for 0.2.0 should be wrapped up during API documentation and review and ready to align with the 0.2.1 tag release.

Firefox Nightly/Aurora Crashing using <video> for CanvasTexture source

I've just tried this on two machines:

In CanvasTexture, change the init to this to let

    function CanvasTexture(options) {
        var gl = CubicVR.GLCore.gl;

        if (options.nodeName === 'VIDEO' || options.nodeName === 'CANVAS' || options.nodeName === 'IMG') {
            this.canvasSource = options;
        } else {
            this.canvasSource = document.createElement('CANVAS');
            if (options.width === undefined || options.height === undefined) {
                throw new Error('Width and height must be specified for generating a new CanvasTexture.');
            } //if
            this.canvasSource.width = options.width;
            this.canvasSource.height = options.height;
            this.canvasContext = this.canvasSource.getContext('2d');
        } //if

        this.updateFunction = options.update;

        this.texture = new CubicVR.Texture();

Trying to load a webm from localhost explodes my computers. Two different machines. Two different gfx cards. Two different gfx drivers. Same linux distro. :/

Buh?

Crashy double-canvas action

This bit of code breaks CubicVR all over and smashes Firefox in the face. Like violent joint-aches on a rainy day.

        function Scene( canvas ) {
          var gl = CubicVR.init( canvas ),
              boxMesh = new CubicVR.Mesh({ 
                primitive: {
                  type: "box",
                  size: 1.0,
                  material: {
                    textures: {
                      color: "../images/6583-diffuse.jpg"
                    }
                  },
                  uv: {
                    projectionMode: "cubic",
                    scale: [1, 1, 1]
                  }
                },
                compile: true
              }),
              boxObj = new CubicVR.SceneObject( boxMesh ),
              scene = new CubicVR.Scene( canvas.width, canvas.height, 60 ),
              ml = new CubicVR.MainLoop( function( timer, gl ) {
                scene.render();
              });

            scene.bind(boxObj);
            scene.camera.position = [1, 1, 1];
            scene.camera.target = [0, 0, 0];
            CubicVR.addResizeable(scene);
            var mvc = new CubicVR.MouseViewController( canvas, scene.camera );

        } //Scene

        var scene1 = new Scene( document.getElementById( "canvas1" ) ),
            scene2 = new Scene( document.getElementById( "canvas2" ) );

The problem occurs almost right away, initializing boxMesh. I'm going to take a stab at guessing what the problem might be: buffer compiling?

Create More Comprehensive Particle System

Particle system framework should be as such:

  • particleSystems have several base types
  • creating a particleSystem will create corresponding particleEmitters
  • emitters will create particles in accordance with their particleSystem's emission policy (buckets/linked-lists)
  • update() runs particle update function, updates particle array
  • draw() only draws particle array (no updates)

Automated Ref Tests

We need automated ref tests (e.g., tests against a reference image) so we can write regression tests for CubicVR.js' drawing code. There is a bunch of prior-art here in the processing.js project:

Test Runner: https://github.com/jbuck/processing-js/blob/develop/test/ref/index.html

Test Builder: https://github.com/jbuck/processing-js/blob/develop/test/ref/ref-test-builder.html

A bunch of work has been done to generalize this by another student: https://github.com/cwdesautels/sundae.js Using this might be a good start.

Basically what we want is the following:

  • A simple way to write a small .js file which renders a canvas. Initially this might be static (e.g., only drawing one frame).
  • From this page, a way to save a PNG of the canvas (e.g., dataurl). NOTE: we will have to strip the color profile info from these PNGs or they will fail on different platforms with Firefox (talk to jbuck).
  • Next we need a manifest that holds our list of tests (tests.js, a json file). It will indicate which test file to run, and which image to compare against.
  • Finally, a page that can load tests + images, run the test, and compare the canvas for the live run to the reference image. This is complicated by the fact that perfect pixel comparisons are impossible across browser/platforms. We need to blur the images first, then compare the pixel values (r,g,b,a) with an epsilon value (e.g., a "fudge factor" which says, "as long as it's the same or within 0.07 or something).

The processing.js team (humph, jbuck, pomax) can help you understand how the ref test stuff should work, and ccliffe can answer questions related to CubicVR.js itself.

Replace !== tests with false-y equivalents

Replace redundant tests such as:

if (SceneObject.morphWeight !== null) ..
if (SceneObject.morphTarget !== -1) ..
if (SceneObject.morphSource !== -1) ..

with simple flags such as:

if (SceneObject.morphInstance) {
.. assume stuff has been set elsewhere appropriately ..
}

which can be toggled by relevant getters/setters for morph weights.

this should improve performance in key areas as suggested by @secretrobotron and @humphd

Is loading large COLLADA files supported?

Hi,
I have two files with a bunny model. One has 22999 faces and the second one has 20999 faces. Here are the screenshots of the rendered models: 23k faces, 21k faces
The code can be tested on this address:http://www.fi.muni.cz/~xhracho1/cubicvr_issue/
Both of the files were simplified from ply_models/bun_zipper.ply using MeshLab. Position and material were modified in Blender.
I am using Chromium 17, Ubuntu 11.10., NVIDIA GeForce GT 520M with proprietary drivers.

Wireframes

Having wireframes for select meshes would be great, especially for showing physics meshes (e.g. debug mode).

cclffe and I discussed doing this in a separate pass:

scene.render();
scene.renderWireframes();

Ambient texture not working

The Ambient texture has broken again, samples/cubicvrxml/cubicvr_mesh.html is rendering black.

Not to be completed for this issue but we should probably add a test that can iterate all the common material types and ensure the combinations are producing a correct result.

Dynamic VBO buffer segmented updates

We need to add support for just updating specific tagged face segments (already supported for visibility and buffer packed in linear order). This will allow updates to specific portions of the mesh data quickly such as localized deformations.

This should wait until the VBO buffering code stabilizes so we're not re-inventing it multiple times.

UV Offset context issue

The UV offset parameter doesn't respect shader masks, pooled shaders with instances are having issues with values from other UV offsets bleeding into their context.

Object Pools for storing reusable CubicVR objects

Creating meshes, sceneobject, textures, materials, etc. usually requires keeping a variable around, and passing into functional bodies that require it.

It would be beneficial to have simple pools to store objects explicitly by name.

var meshPool = new MeshPool();
meshPool.add( "cow", cowMesh );

var scene = new Scene();
scene.addPool( "mesh", meshPool );

assert( meshPool.get( "cow" ) === scene.getMesh( "cow" ) );

Fix the Worker Situation

There's a lot of Worker work that's happened, including some effort in require.js to get nice event-handling.

Shadows are broken on ATI HD on iMac

Shadows in 0.2.x are broken on ATI HD on iMac, this applies to Mozilla and Chrome so it should be driver/GLSL related.

I've had to make a few patches before due to shoddy ATI drivers so it's not surprising, most likely something that's changed in the GLSL is too much for it to comprehend...

Would be interested to know if any other platforms than Mac are having shadow issues with ATI, please check out the examples and demos in the wiki and see if any of the shadowed ones work.

Fog?

Ive hacked my version of the core fragment shader to include fog, liner and exponential, and working on introducing noise. is this something of interest to the overall project? if so, how best to share (I'm a new kid on the block here)?

Octree light partitioning

Need a way to calculate the lights that apply to each sceneObject so that when rendering we're not doing excessive drawing of objects that are outside the range of a particular light.

Perhaps having an .active_lights array for each sceneObject with two lists in it, one for dynamic and one for static lights (so we can splice them together on render). If the octree can somehow fill these lists on each pass we'd have a forward-run of just visible objects with their active lighting set.

We'll need a static/dynamic flag for objects and lights and hopefully the static stuff can be computed when a light/object is added and the dynamic can be a slightly more efficient system that uses object tracking like we have now.

Convert COLLADA loader into COLLADA class

Now that the COLLADA loader is matured a bit it's time to start dividing it up further into a class that can initialize itself from a COLLADA file and then be used as more of a resource than just a one-shot scene.

Right now we parse and load all the scenes from a COLLADA file but just return the default one and can't extract individual resources without loading the whole thing; this won't be sufficient moving forward.

Evaluate CubicVR.js for beginner use

Someone without any prior experience should evaluate the learning curve required to become proficient in basic CubicVR.js use, based on this information prepare suggestions for API fixes, documentation and sample projects.

Integrate octree.js

I've rewritten most of the octree business in a another lib, which is self-contained and testable in isolation.

CubicVR should use it instead. The code is far less awful than my Java-based Octree implementation. :D

Add AABB-AABB intersection test

Add an AABB-AABB intersection test. Does anyone have a preference of how to return values, since there are 4 cases?

A is inside B
B is inside A
A and B intersect
A and B are disjoint

Use strings as a short-hand for long enum types

new CubicVR.Light({type:cubicvr.light.type.DIRECTIONAL,direction:[0.5,-1,0.5]})

can be shortened to look like this:

new CubicVR.Light({type:"directional",direction:[0.5,-1,0.5]})

Lights aren't the only part of CubicVR which would benefit from this syntactical optimization.

Camera with parent producing incorrect rotation

A camera positioned at [1,1,1] and targeting [0,0,0] seems to produce a different viewpoint from a camera with position [0,0,0], rotation [0,0,0] bound to a parent object with position [1,1,1] and rotation [-45,45,0]. Why is this?

Sample:

http://pastebin.ca/2257846

Run Instructions:

  1. Place the sample in the cubicvr samples/basic folder.
  2. cd into the cubicvr root directory and execute python -m SimpleHTTPServer
  3. Navigate to localhost:8000 then navigate to samples/basic and execute the script.
  4. Open up the console and type fix() or unfix() to view the two viewpoints.

Scene.render() parameters

While discussing another issue with @secretrobotron it came to my attention the possibility of user parameters to the Scene.render() function. Currently it accepts none so this github issue is for possible ideas.

Transparent material flag, systematic material regeneration issue?

Currently to change the opacity of a material it must initially start at something less than 1.0, such as opacity 0.999, if the opacity is changed the shader does not adapt to support it. This will require a flag check or bitmask to re-initialize the shader when alpha conditions have changed.

This however might attest to a more systematic problem of the lack of a material 'dirty' flag. The ideal here might be to add a general flag to the material to force it to flush it's pool cache and regenerate or reassign on the next draw.

Investigate support for IFC file format

Investigate adding support for the IFC file format:

  • The IFC represents a data model structure for sharing construction and facility management data across various applications used in the building domain.
  • The IFC data model is an object-oriented data model based on class definitions representing the things (elements, processes, shapes, etc.) that are used by software applications during a construction or facility management project.
  • The IFC data model focusses on those classes that are needed to share information (rather then processing it in a particular proprietory software).
  • The IFC data model is a neutral and open specification that is not controlled by a singular vendor or group of vendors.

Examples:

http://www.ifcwiki.org/index.php/Examples

Too Dark on Win7

Lighting appears very dark (almost completely invisible) on most of the demos.

Specs:

Win7
Firefox 4
Nvidia GeForce GTX 470

However, looks great on a MacBook Pro.

Add loaders for remaining class constructors

Need to fix up the constructors so they can all support the #id and myfile.js / myfile.json / myfile.xml passed in place of relevant objects.

  • Review constructors and ensure CubicVR.get() has been implemented where necessary
  • Add support for converting simple XML into JSON on the fly like xml2bfjson
  • Add a simple CubicVR.get pool where you can pass class type for loading to prevent duplicating assets

Mesh.setSegment() sample

setSegment() examples were lost when we removed some tests from the repository. Need to make up or resurrect a sample project.

Automated tests

Rather than running through the manual tests in the tests directory, devs should be able to open a page in their browser and have it run a bunch of reference tests to make sure that a patch doesn't cause a regression.

[Light.js] set dir is not working

Hi!

I'm testing your framework and I think I have discovered a bug. In the following function:

    set dir(value){
        this.direction = vec3.normalize(value.slice(0));
    },

You need to define vec3 before or just change it to: base.vec3

Automated shader testing

In reference to the problem that occurs frequently in #29, add a test that can iterate all the common material types and ensure the combinations are producing a correct result.

If we wish to do a complete test it will likely need to be automated given that the possible shader permutations already exceed half a million (and billions if you include the lighting count per shader) so we may just want to stick to a set of realistic pre-defined parameters.

Ray-traced rendering accuracy comparison test

Here's a thought that came to mind:

  1. Use a tool like Blender, 3DSMax or Maya to create material, camera and lighting setups of varying complexity.
  2. Render each scene to an image at varying levels of quality from the modeler, Blender may be ideal since you can script the process with Python.
  3. Export the scenes in COLLADA format.
  4. Create a loader that loads the scene via CubicVR.js and can compare to the rendered images.
  5. Instead of pass or fail, instead attempt to evaluate the difference with a level of accuracy % and visualize the result.

Must note that various raytracers will produce different results as well as light choices etc. so we'd need to pick a set of base settings and just use one for comparison or handle it via separate 'profiles' for each renderer.

If this was able to help us produce more accurate images and perhaps core GLSL rendering profiles for various setups it would make fine-tuning materials very simple and advanced production such as integrating rendered video content would be more seamless.

`samples/polygon/tessellate.html` broken in Chrome

I set up a local server to run http://localhost:9898/samples/polygon/tessellate.html, which runs fine in Firefox, but not in Chrome.

Uncaught TypeError: Cannot read property 'length' of null CubicVR.Polygon.js:157

var triangles = CubicVR.util.repackArray(triangulated,3,triangulated.length/3);

Before running the sample, I did a fresh pull from this repo.

Browser data:

Google Chrome   22.0.1229.79 (Official Build 158531)
OS  Mac OS X
WebKit  537.4 (@129177)
JavaScript  V8 3.12.19.11
Flash   11.4.402.265
User Agent  Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.79 Safari/537.4

Multi-Canvas Support

Recently I decided to dive into trying to get Cubic to render to two separate canvases. It didn't work so well.

There are a few things that I think stood in my way:

  • You must do CubicVR.init( canvas ) before anything. If Cubic is being used as more of a library, there's a bit of a problem. You may want to collect a bunch of objects before initializing a canvas. This seems like the biggest hurdle, and simply hiding the canvas while it's not in use isn't such a huge deal. We don't have to constantly render to it.
  • MainLoop only supports one gl. Rendering to multiple canvases requires ignoring the gl context that's passed in, and doing the gl.clear yourself.
  • GLCore is assumed to be pervasive and global everywhere, so it's hard to tease things out. I believe that some classes/functions have saved pointers to `GLCore.gl`` , so even able to switch gl contexts dynamically requires some clean up work.

After some thought, I attempted to use a state-minded approach and settled on GLCore.switchContext which will alleviate some of the problem by letting the user switch between gl contexts explicitly. Regardless, this solution was suboptimal. I think it makes a lot more sense to try to enclose GLCore within a scope that can be passed to objects when they need it, or have objects spawned out of some closure that has a less-than-globally available GLCore.

Some initial work was done here, but it's far from complete: 716cfd8#commitcomment-638203

Landscape and other SceneObject sub-classes, Landscape constructor

Need to change how these work so that they hold a SceneObject like the RigidBody adapter but are not the SceneObject themselves. Also the landscape constructor is currently a list of parameters which doesn't fit with the rest of the API as well as it's currently immovable, wrapping a SceneObject would make performing orient/height calls much easier as we could use it as an inverse transform to make operations relative to the SceneObject.

Limitations on CustomShader

Right now, it is not possible to specify a file for your shader source for 'CustomShader'. For example:

< script id="vs" src="lib/Shader.vs" type="x-shader/x-vertex">
</ script>
< script id="fs" src="lib/Shader.fs" type="x-shader/x-fragment">
</ script>"

So, it is necessary to put the code on the html page, inside the script tags, like the demos available.

PS: One work around I have made:

On CubicVr.Utility.js, on the 'get' method, after it checks if '(idOrUrl[0] == '#')', I put:

if (url !== null) {
return util.getScriptContents(id);
}

So, if the tag has a 'src' defined, it will load the script from the file :P

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.