zdelta | zdelta delta-compression library | Machine Learning library
kandi X-RAY | zdelta Summary
kandi X-RAY | zdelta Summary
Zdelta is a delta-compression engine. Given two data blobs, a source and a target, it computes the differences between them and encodes that into an output blob called a delta. The delta isn't human-readable (and it should be treated as opaque by client programs), but the great thing about it is that it's usually much, much smaller than the target.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of zdelta
zdelta Key Features
zdelta Examples and Code Snippets
Community Discussions
Trending Discussions on zdelta
QUESTION
I am working on a three.js prototype in which a 3d model of the train is added to the scene. My requirement is to move the camera either left / right side of the scene to view the complete train.
I tried using below code -
...ANSWER
Answered 2020-Mar-06 at 12:50Using a keydown
event listener is definitely the right approach. Try it with this code:
QUESTION
If I scroll a window using the computer mouse, I get the following Spy++ results:
...ANSWER
Answered 2020-Jan-12 at 01:24Since you don't have ByVal
for pSource
, you either shouldn't use VarPtr
for foo(0)
, or you should pass it explicitly ByVal
: CopyMemory lRet, ByVal VarPtr(foo(0))
... or CopyMemory lRet, foo(0)
...
Also, you have foo() As Integer
, but you assign Long
variables to its contents. Are you sure that's what you want?
QUESTION
I'm trying to sample from a heightmap to position the z coordinate of some points but am evidently making an elementary mistake. Here's my scene:
...ANSWER
Answered 2019-Apr-23 at 17:48The formula to calculate the index of a pixel in the 2 dimensional height map image is
QUESTION
I am working on a three.js scene that renders points and line segments. The scene renders fine if I use a LineBasicMaterial material for the lines:
...ANSWER
Answered 2019-Apr-21 at 09:37I think this happens because you are using gl_PointCoord
in the fragment shader although you are not rendering points but lines. If I remove the following two lines of code, your lines are rendered:
QUESTION
I'm working on a scene in which I'm using Points, InstancedBufferGeometry, and a RawShaderMaterial. I'd like to add raycasting to the scene, such that when a point is clicked I can figure out which point was clicked.
In previous scenes [example], I've been able to determine which point was clicked by accessing the .index
attribute of the match returned by the raycaster.intersectObject()
call. With the geometry and material below, though, the index is always 0
.
Does anyone know how I can determine which of the points was clicked in the scene below? Any help others can offer on this question would be very appreciated.
...ANSWER
Answered 2018-Aug-09 at 16:06One solution is to use the technique sometimes referred to as GPU Picking.
First study https://threejs.org/examples/webgl_interactive_cubes_gpu.html.
Once you understand the concept, study https://threejs.org/examples/webgl_interactive_instances_gpu.html.
Another solution is to replicate on the CPU the instancing logic implemented on the GPU. You would do so in your raycast()
method. Whether it is worth it depends on the complexity of your use case.
three.js r.95
QUESTION
I'm working on a Three.js scene in which I'd like to update some textures after some time. I'm finding that updating the textures is very slow, however, and drags FPS to only 1-2 FPS for several seconds (when updating just a single texture).
Is there anything one can do to expedite texture updates? Any insights others can offer on this question would be very appreciated.
To see this behavior, click the window of the example below. This will load the first texture update (another click will trigger the second texture update). If you try to zoom after one of these clicks, you'll find the screen freezes and the FPS will drop terribly. Does anyone know how to fix this problem?
...ANSWER
Answered 2018-Jul-26 at 15:26Your canvases are 16384 by 16384. That's basically insanely large.
For RGBA format, that is 1073741824 bytes.. a gigabyte of texture data that is getting sent to your GPU from the CPU when you set that texture.needsUpdate = true
You will definitely notice this getting uploaded to the card.
If your use case absolutely requires textures that large.. then you may need to consider doing incremental updates via gl.texSubImage2D, or using a bunch of smaller textures and only updating one of the per frame, or only updating those textures at the start of your app, and not thereafter.
For reference, there are very few cases i've seen where textures > 4k per side are needed.
And that is about 1/16th the size of your textures.
This has nothing to do with three.js btw. It's a fundamental characteristic of GPU/CPU interaction. Uploads and state changes are slow and have to be carefully orchestrated and monitored.
QUESTION
I have a Three.js scene that passes a canvas as a uniform to a RawShaderMaterial. After the initial scene renders, I alter the canvas (in the case below, I just paint the canvas red). I then indicate that the shaderMaterial .needsUpdate = true;
but no color appears on the points.
Color does appear on the points if I move the ctx.fill();
loop above the var material =
declaration.
Does anyone know what one must do to update a canvas after the initial render when using the RawShaderMaterial? Any help others can offer would be hugely helpful!
...ANSWER
Answered 2018-Jul-26 at 14:03Ah, one must reassign the value of the uniform (stored in the material) and then mark the material as needing an update:
QUESTION
I have a Three.js scene that passes a few attributes to a RawShaderMaterial
. After the initial render, I'd like to update some attributes, but haven't been able to figure out how to do so.
Here's a sample scene (fiddle):
...ANSWER
Answered 2018-Jul-25 at 22:56It seems to update a buffer attribute (or indexed buffer attribute) one can set the .dynamic
property of that buffer to true
, manually mutate the buffer, then set the .needsUpdate
attribute of the buffer to true
.
In this updated demo, after clicking the scene, the buffer attribute texIdx
is updated such that all points have texIdx
== 0:
QUESTION
I am working on a Three.js scene in which I'd like to use many points with different textures. However, so far I haven't been able to change textures in my fragment shader. Despite the fact that the points in the following scene should alternate between texture 0 (a cat) and 1 (a dog), all points show the same texture:
...ANSWER
Answered 2018-Jul-10 at 20:18In case others end up here facing the same trouble I had, I wanted to say that the above example was a simplified version of a larger scene. In that other scene, I was passing in an attribute texture
but I was initializing the attribute as textureIndex
inside the vertex shader. I then passed the textureIndex to the fragment shader as a varying, where it always equalled 0. So the moral of the story is -- if you try to read from an attribute that isn't passed to the vertex shader, that value evidently equates to zero. It would be great if this threw an error instead.
In the silly example above I had commented out the varying declaration in the fragment shader. This is fixed:
QUESTION
I am working on a scene (easier to see on bl.ocks.org than below) in Three.js that would benefit greatly from using points as the rendering primitive, as there are ~200,000 quads to represent, and representing those quads with points would take 4 times fewer vertices, which means fewer draw calls and higher FPS.
Now I'm trying to make the points larger as the camera gets closer to a given point. If you zoom straight in within the scene below, you should see this works fine. But if you drag the camera to the left or right, the points gradually grow smaller, despite the fact that the camera's proximity to the points seems constant. My intuition says the problem must be in the vertex shader, which sets gl_PointSize
:
ANSWER
Answered 2018-Jul-06 at 16:43This is due to the distortion caused by rectilinear projection, which takes the depth value of each point (the "proximity distance" you were referring to) to be its Z (or Y) coordinate in camera space; you are instead taking this to be the Euclidean distance from the camera's position.
The diagram illustrates that, as you move the camera's axis away from the point, the distance delta
increases (the point shrinks) while the depth value (the "apparent proximity") stays constant. To fix this, just replace delta
with the depth value project[2]
(or [1]
- I forgot which one OpenGL uses).
Note that if your modelViewMatrix
is set up correctly according to convention, you shouldn't subtract by cameraPosition
.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install zdelta
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page