Giter Club home page Giter Club logo

learning-threejs's Introduction

learning-threejs

Second edition learning Three.js

The examples in this branch are based on r63 and correspond to the second edition of "Learning Three.js"

Third edition Learning Three.js

The examples for the third edition of this book can be found in the following repo

https://github.com/josdirksen/learning-threejs-third

learning-threejs's People

Contributors

jenkins-malmberg avatar josdirksen 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  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

learning-threejs's Issues

how to extrude multi path in one svg by d3,three.js,d3-threeD

Error is Uncaught TypeError: Cannot read property 'amount' of undefined !!
I update chapter-06\05-extrude-svg.html. you can see below
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1152px" height="1152px" xml:space="preserve"> <g id="landmarks"> <path id="batman-path" style="fill:rgb(0,0,0);" d="M 261.135 114.535 C 254.906 116.662 247.491 ,,,,,"/> <path id="batman-path2" style="fill:rgb(0,0,0)" d="M550.1 163.4 L576.5 170.5 L579.4 174.8 L606 169.6 L641.3 181.3 L669 220.2 L593.7 236.1 L584.9 222.6 L595.2 220.5 L586.2 206.7 L539.8 216.1 L524.8 239.1 L471.9 250.1 L461.4 231.3 L471.1 229.4 L464.8 218.1 L455.1 220.1 L435.6 185.1 Z"/> </g> </svg>

But It can't run. I am boring so that I can't make progress in this week. I hope you can help me.

All code are below:
`
var shapearr=[];
var shape, svgString;
var paths=document.querySelectorAll("svg > path[id]")
for(var i = 0; i < paths.length; i++) {
var path = paths[i];
svgString=path.getAttribute('d');
console.log(svgString);
//shape = transformSVGPathExposed(svgString);
shape=createMesh(new THREE.ShapeGeometry(drawShape2(svgString)));
scene.add(shape);
shapearr.push(shape);
}
.....
var controls = new function () {
this.amount =6; //2;
this.bevelThickness = 2;
this.bevelSize = 0.5;
this.bevelEnabled = true;
this.bevelSegments = 3;
this.bevelEnabled = true;
this.curveSegments = 12;
this.steps = 1;
this.asGeom = function () {
scene.remove(shape);
var options = {
amount: controls.amount,
bevelThickness: controls.bevelThickness,
bevelSize: controls.bevelSize,
bevelSegments: controls.bevelSegments,
bevelEnabled: controls.bevelEnabled,
curveSegments: controls.curveSegments,
steps: controls.steps
};

            var paths=document.querySelectorAll("svg > path[id]")
            console.log(shapearr);
            for(var i = 0; i < paths.length; i++) {
                var path = paths[i];
                svgString=path.getAttribute('d');
                console.log(svgString);
               // shape = transformSVGPathExposed(svgString);
                shape=createMesh(new THREE.ExtrudeGeometry(drawShape2(svgString)),options);
                scene.add(shape);
            }
        };

    };

   ``

sample chapter-09 16-animation-from-gltf, can not read "match" of undefined

This problem prevents me from opening this example, I have tried to replace the model with different glTF 2.0 files, but the same error exists. I'm using npm and python simple server to open the example.

error message here.

Uncaught TypeError: Cannot read property 'match' of undefined
at Object.value (glTF-parser.js:91)
at Object.value (glTF-parser.js:97)
at Object. (glTF-parser.js:113)
at Array.forEach ()
at Object. (glTF-parser.js:111)
at Array.forEach ()
at Object.value (glTF-parser.js:107)
at Object.set [as json] (glTF-parser.js:133)
at XMLHttpRequest. (glTF-parser.js:276)

this is a question

When I use DeviceOrientationControls, the orientation angle data obtained by different mobile phones are inconsistent. What is the problem?

Typos in Chapter 1

I've come across two typos in Chapter 1 so far.

  1. On page 26
  var spotLight = new THREE.SpotLight(0xFFFFFF);
  spotLight.position.set(-40, 40, -15);
  spotLight.castShadow = true;
  spotLight.shadow.mapSize = new THREE.Vector2(1024, 1024);
  spotLight.shadow.camera.far = 130;
  spotLight.shadow.camera.near = 40;

This won't work without scene.add(spotLight);

  1. On page 27
  renderer.setClearColor(new THREE.Color(0x000000));
  renderer.setSize(window.innerWidth, window.innerHeight);
  renderer.shadowMap.Enabled = true;

should be renderer.shadowMap.enabled

Bug in 09-05.js

flyControls.domElement = document.querySelector("webgl-output");
should be:
flyControls.domElement = document.querySelector("#webgl-output");

Creating circle..

am newbie to three js and learning now. i need to create a circle geometry and faceVertexUvs.

var radius = 3,
segments = 32,
material = new THREE.LineBasicMaterial({color: 0xFF0000}),
geometry = new THREE.CircleGeometry(radius, segments);
var circle = new THREE.Line(geometry, material);
circle.position.set(5, 6, 0);
scene.add(circle);

This is creating an eclipse but not circle. Please help me where am wrong..?

demo chapter-09/16-animation-from-gltf.html,it doesnot work well..

Uncaught TypeError: Cannot read property 'match' of undefined
Object.create._isAbsolutePath.value @ glTF-parser.js:91
Object.create.resolvePathIfNeeded.value @ glTF-parser.js:97
(anonymous function) @ glTF-parser.js:113
(anonymous function) @ glTF-parser.js:111
Object.create._resolvePathsForCategories.value @ glTF-parser.js:107
Object.create.json.set @ glTF-parser.js:133
(anonymous function) @ glTF-parser.js:276

PathControls Code?

Hello,
The book refers to PathControl code in example 09-path-controls.html.
However, it is not in the code I see here online. Also did a search of "This repository" for "PathControl" and nothing turned up.

Thanks

Particles have jagged edge or black border...

When running chapter 7-10 particle system from model, with the recent version of THREE.js I get a defined edge or visible bounding box around the gradients. Is there something that needs to be changed to make it look smooth as it does in the previous version or the version used in the book?

Code doesn't work

Tried to use the SceneExporter code to export a scene to a JSON object. Got this error.

Uncaught TypeError: Expecting a function in instanceof check, but got undefined

Question- how to get noise from FilmPass() like in Chapter Eleven 02-post-processing-simple-passes.html?

From Chapter Eleven 02-post-processing-simple-passes.html, where is the noise coming from in var effectFilm = new THREE.FilmPass(0.8, 0.325, 256, false);?

The orbiting is not causing the noise effect, because when I remove the orbit animation, it is still there.
It's not coming from the textures, because when I remove them, the noise effect is still there.

I've tried using THREE.FilmPass() in my own experiment and I can not make the noise effect. Instead, I just get the normal scan line effect without the noise.

    var renderPass = new THREE.RenderPass(scene, camera);
    var effectFilm = new THREE.FilmPass();
    effectFilm.uniforms.grayscale.value = false;
    effectFilm.uniforms.nIntensity.value = 3;
    effectFilm.uniforms.sIntensity.value = .3;
    effectFilm.uniforms.sCount.value = 2048;

    effectFilm.renderToScreen = true;

    var composer = new THREE.EffectComposer(renderer);
    composer.addPass(renderPass);
    composer.addPass(effectFilm);

Chapter 08- 04-load-save-json-scene

Codes don't work since THREE.SceneExporter isn't supported.

"Attempted import error: 'SceneExporter' is not exported from 'three' (imported as 'THREE')"

Is there any way to replace THREE.SceneExoprter? Thanks

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.