Code Monkey home page Code Monkey logo

threejs-sandbox's Introduction

threejs-sandbox

build twitter sponsors

Set of experiments and extensions to THREE.js. These pages are a sandbox of examples and not necessarily ready to include in projects and may require some work to properly and performantly integrate.

If any classes are used in a project or application credit is appreciated (though not required) and let me know! I love seeing my work used in practice.

Potential Projects

Next

threejs-sandbox's People

Contributors

dependabot[bot] avatar gkjohnson avatar jane-pm 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

threejs-sandbox's Issues

BVH for InstancedMesh culling

Hey,

not sure this is the right Place to ask, but hope to brainstorm some ideas
for my OpenWorld i use InstancedMesh with vertex wind animation, next step is to implement some culling for this to reduce the triangles.

read some forum threads like https://discourse.threejs.org/t/ridiculous-number-of-boxes/6862/11
the idea is to generate the frustum on cpu side with BVH and update the InstancedBuffer

do you know any Technics how this could be done on GPU side too?

Motion Blur Bug on Skinning

motionBlurPass/webgl_postprocessing_perobjectmotionblur.html

Bug: Double skinned mesh object breaks velocity buffer.
Probability: 100%
OS: Windows/MacOSX
GPU: 3090 and M1
Browser: Chrome(93.0.4577.82), Electron(14.0.0), Edge(93.0.961.52)
Threejs Version: this repos version and r131.
Reproduce:

  • Just copy loading point.
  • Or load other skinned mesh object. (FBX/GLTF/PMX and so on)
  • Static mesh does not reproduce. Its just skinned mesh.

`

			loader.load( 'https://rawgit.com/mrdoob/three.js/r106/examples/models/fbx/Samba%20Dancing.fbx', res => {

				scene.add( res );
				res.scale.multiplyScalar( 0.05 );
				res.traverse( c => {

					if ( c.type === 'SkinnedMesh' ) {

						c.castShadow = true;
						c.receiveShadow = true;
						c.motionBlur = { expandGeometry: 0, interpolateGeometry: 0 }

					}

				});
				res.position.y = -5;
				mixer = new THREE.AnimationMixer( res );
				mixer.clipAction( res.animations[ 0 ] ).play();

			});

			loader.load( 'https://rawgit.com/mrdoob/three.js/r106/examples/models/fbx/Samba%20Dancing.fbx', res => {

				scene.add( res );
				res.scale.multiplyScalar( 0.05 );
				res.traverse( c => {

					if ( c.type === 'SkinnedMesh' ) {

						c.castShadow = true;
						c.receiveShadow = true;
						c.motionBlur = { expandGeometry: 0, interpolateGeometry: 0 }

					}

				});
				res.position.y = -5;
				mixer = new THREE.AnimationMixer( res );
				mixer.clipAction( res.animations[ 0 ] ).play();

			});

`

test

Motion blur

The motion blur sandbox is perobject-motionblur but is it possible to make a camera movement motion blur?

MotionBlurPass doesn't work with three v0.131.1 or above

Thanks for putting this repo together, really helpful to see some example code!

I ran into an issue with the motionBlurPass example that I think boils down to the these lines.

// TODO: This is getting called just to set 'currentRenderState' in the renderer
// NOTE -- why do we need this?
renderer.compile( scene, camera );

Based on the comment, the call to renderer.compile is used to set currentRenderState in the renderer because it's then subsequently used in renderer.renderBufferDirect. However this three PR (mrdoob/three.js#22220) now sets currentRenderState = null at the end of the renderer.compile call.

Totally understand that renderer.renderBufferDirect isn't supposed to be part of the public API so a quick solution might not be feasible, but wondering if you (or people stumbling into this issue) have any thoughts.

The ultimate error I'm seeing is Cannot read properties of null (reading 'state') from setProgram inside WebGLRenderer on this line:

const lights = currentRenderState.state.lights;

Conditional lines & SkinnedMesh

I have looked, tried and implemented a dozen solutions to get outlines, but none look as amazing as your conditional lines.

I would really like to use it in my project, but unfortunately it doesn't work for skinned meshes.

Do you think it would be possible to get it to work with a skinned mesh? I'm quite new to three.js and shader development, but if you say that it would be possible, I'd try to figure it out.

Any input would be much appreciated.

gtaoPass issue with version 118 and later

Hello everyone,

I wanted to test the "gtaoPass" example and then integrate it into my project.

I managed to get it to work with the three.js version 114 to 117.
But in versions after 117, if one of the mesh has a diffuse color map, the error below is displayed:
image

image

Removing the diffuse map from all materials solves the problem.

I tried to solve the problem by looking in the code but I do not have the knowledge required to fully understand the functionality of "gtaoPass".

Does anyone have any idea where the problem might be?

No more updates?

I was very surprised at how well this library worked, but it hasn't been updated in a while. I saw your example in the three.js example, but I think this one is even better

Motion blur error

Error

three.module.js:26832 Uncaught TypeError: Cannot read properties of null (reading 'state')
    at setProgram (three.module.js:26832)
    at WebGLRenderer.renderBufferDirect (three.module.js:26052)
    at MotionBlurPass._drawMesh (MotionBlurPass.js:382)
    at eval (MotionBlurPass.js:310)
    at traverseVisibleMeshes (utils.js:12)
    at traverseVisibleMeshes (utils.js:19)
    at traverseVisibleMeshes (utils.js:19)
    at MotionBlurPass._drawAllMeshes (MotionBlurPass.js:308)
    at MotionBlurPass.render (MotionBlurPass.js:193)
    at EffectComposer.render (EffectComposer.js:149)

MotionBlurPass.js

image

Threejs Version

0.132.2

My Script

image

image

How do i fix this issue please.

TEXTURE SPLATTING?

Hi @gkjohnson! First off, I'd like to say BEAUTIFUL job! Please keep up the EXCELLENT work! <3 Secondly, can you please add texture splatting for terrain with a GUI to control the different texture's qualities, also with the ability to save the terrain with the new texture on it?

Once again, please keep up the WONDERFUL work! <3

GTAOPass: Exclude helpers from render pass.

First, thanks a lot for a many really awesome examples in your sandbox!

GTAO looks much better than SSAO in THREE.js and I wonder if you have an idea how I could exclude Helpers (e.g. CameraHelpers / GridLines / TransformControls / ...) from being included in the GTAOPass.

I'd like to render a room scene with GTAOPass but the additional helpers should be rendered as usual.
Would be great if you have an idea or could give me any pointers if this is possible.

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.