Questions tagged [javascript]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
38 views

Ray tracing of a diffuse material sphere doesn't work, the sphere just shades black

I made this ray tracer in javascript to run on html with imageData. I have been using the book "Ray Tracing in One Weekend" as a reference (https://raytracing.github.io/books/...
user avatar
0 votes
0 answers
12 views

Improve Performance Of Bouncy Blob Simulation

I created this project (feel free to look at the source code), where I tried to model some kind lava-like blobs in 2D which move around and don't touch each other. The gray lines just represent the ...
user avatar
  • 113
0 votes
1 answer
35 views

Is it possible to get recording device from meta data?

Im not sure if this is the right section to ask this question but i figured its worth a shot. Is it possible to take metadata from a video and use that data to identify what phone model was used to ...
user avatar
  • 1
0 votes
0 answers
19 views

How to add a second calculation to an already working transform feedback webgl2 code?

I'm doing a project that involves transform feedback and WebGL2. I was able to make a transform feedback work using two buffers, to calculate an update in 3d positions of particles. But now I'd like ...
user avatar
  • 111
0 votes
1 answer
64 views

Fastest Simulation Of Mass Spring Systems

I'd like to simulate a 4-dimensional cloth in the web browser, since browsers don't offer great ressources for numerical computation, I'd like to know which algorithm uses the least amount of ...
user avatar
  • 113
1 vote
1 answer
360 views

Rotating a Bitmap

I would like to rotate an bitmap image using math. I have two issues with my current implementation: the pixel-by-pixel rotation of the copied bitmap is extremely slow and it is leaving gaps between ...
user avatar
3 votes
1 answer
148 views

Non jagged line algorithm for javascript canvas

I'm trying to draw a line between two specified points, by updating values in an array which is heightxWidth with each element a set of four bytes (r,g,b,a). In my naive implementation I get the top ...
user avatar
-2 votes
1 answer
512 views

How can I make a cube with faces of different colors? Webgl

I have to draw cubes with faces of different colors (each per face), but I don't know how to accomplish this task: I draw cubes using CPU and GPU meshes (no vertexBuffer or three.js "style") and I don'...
user avatar
1 vote
1 answer
406 views

Flood-Fill and scanLine algorithms are line-based floods but I want square based floods

I have a flood-fill algorithm (Flood-fill) to fill a 24x24 matrix as follows (matrix is 24x24 here but will be much bigger in production): ...
user avatar
2 votes
0 answers
56 views

Binary representation of Pascal's triangle [closed]

I recently learnt about the binary representation of Pascal's triangle. Here is what it looks like I am a java learner. Is there a way for me to find the java source code to graph this binary ...
user avatar
  • 121
1 vote
0 answers
206 views

How can I convert a shape made out of pixels to vertices

I'm trying to implement the solution to get the minimum dissection into rectangles of a rectilinear polygon. My shape is made out of pseudo-pixels (different width/height) but for the moment let's ...
user avatar
  • 173
1 vote
1 answer
2k views

How can I draw a filled circle on a grid with the less rectangle as possible?

I have a grid with a variable width/height spacing. Let's say 100 horizontal lines separated by 80 pixels and 100 hundred vertical lines separated by 50 pixels. Each cell of the grid in my logic have ...
user avatar
  • 173
1 vote
0 answers
443 views

3D model outline using stencil buffer

I'm trying to outline a 3D model in WebGL. I've tried using a stencil buffer techique with glLineWidth and glPolygonMode. However, Mozilla's WebGL reference says that the minimum and maximum widths of ...
user avatar
0 votes
2 answers
270 views

The distance from the cube sides to the parallel projection plane

I have asked this question on ru.stackoverflow.com and have no valid answers. Specification: Coordinate system Cube spins around its center on all three axes. Turn angle is not known previously. ...
user avatar
5 votes
1 answer
957 views

How can I verify if a selection area is over a shape in SVG?

I'm creating an SVG editor. I have a simple selection tool that appears when I click and move my mouse from a blank area in my SVG. My SVG is populated with rectangles that can have a rotation ...
user avatar
  • 173
3 votes
1 answer
90 views

Need help reasoning about video oscillation >60hz

I want to make a basic video oscillator for the web. What I want to do is basically illustrated in a tutorial for Lumen: essentially, I want to define an oscillator to turn on and off a color signal ...
user avatar
  • 31
3 votes
1 answer
144 views

Image regeneration with nearest neighbor search

So what I would like to achieve is this: User submits Image 1 - this image is then broken down into X by X sized blocks User submits Image 2 - then the program/algorithm takes all the blocks ...
user avatar
3 votes
1 answer
2k views

WebGL: Why are my textures black?

I am trying to write a simple WebGL script to display a pyramid with a brick texture and Phong lighting. The lighting works fine but when I incorporate the texture, the pyramid turns black. I've ...
user avatar
3 votes
1 answer
426 views

Russian Roulette - Maximum call stack size exceeded

I am trying to write my own path tracer in JavaScript, but I have a problem with the implementation of russian roulette. First, let me describe how my path tracer works. I have a function called ...
user avatar
2 votes
1 answer
329 views

Easing curves on the GPU?

I was thinking that I could pass a timestamp in (from requestAnimationFrame) to the vert shader, and just have my easing curves in the GPU instead of using (for example) Tween.js from the outside. Is ...
user avatar
  • 245
1 vote
0 answers
176 views

How To Generate High Quality Bitmap From Canvas For WebGL Texture

I would like to generate a bitmap for use with a webgl texture generated from a 2d canvas, but I don't think I am doing it correctly. I know how to display the contents of one canvas into another by ...
user avatar
  • 31
2 votes
1 answer
547 views

Inverse Kinematics with more than 2 segments

I'm building a 2D inverse kinematics system and can't figure out how to find all the joint positions. I have the math to make a typical IK set up with a single bend (e.g. arm, leg), but I get stuck ...
user avatar
4 votes
2 answers
503 views

Can a scene graph be stored in the GPU?

I am starting to learn WebGL. Can a scene graph be stored in the GPU? Or is that type of thing more for the main thread (or webworker)? For example, I want to calculate some layout, and apply it as a ...
user avatar
  • 245
2 votes
0 answers
492 views

Creating Signed Distance Fields Images On The Fly For WebGL Application

I am working on a "CAD" like program in HTML5 that requires drawing many thousands (700,000+) of images on the screen. I think, "fortunately" the many images are replicated uses of a unique set of ...
user avatar
  • 31
1 vote
0 answers
43 views

View / print index values?

So i'm currently trying to draw a 3D cube, and from what I understand everything should be working right, but It's coming out weird and I believe it's because the ordering of my indexes is wrong. Is ...
user avatar
  • 19
2 votes
1 answer
51 views

Successive lineTo(x, y) in JavaScript

When I was doing some graphic designing with JavaScript, I saw this strange behaviour. When I ran the following code (with proper HTML and JavaScript of course), ...
user avatar
  • 121
4 votes
1 answer
969 views

Can we use PhysX in WebGL?

I'm new to GL stuff (coming in via WebGL, with no direct OpenGL experience). Can we use PhysX with WebGL?
user avatar
  • 245
4 votes
1 answer
967 views

draw a chord in three.js as in d3.js

I'm starting to learn three.js and want to create a chord diagram as possible in d3.js, but from ground up. I've created a scene and have circle segments on xz axes. But I got stuck on the chords. I ...
user avatar
1 vote
0 answers
46 views

Trouble using java connectivity and data transmition on libgdx [closed]

Hello everybody i have a trouble making datatransmition with mine program just to give the idea im trying to move this blocks when i move mine cars Here I leave the encoding of mine server/client ...
user avatar
1 vote
1 answer
85 views

Get data from javascript

There is an web-interface that load geometric models and show it inside the bounding volume. WebGL is used to generate it. So far no scene graph technique is used to organize the elements in the scene....
user avatar
  • 1,029
3 votes
1 answer
184 views

Javascript color extraction library

I have a small project that needs to extract the perceptually-salient colors of an image, in javascript. There are a few libraries out there (color-thief.js, vibrant.js). The trouble is, I'm finding ...
user avatar
  • 373
8 votes
1 answer
223 views

Can I determine the pixel geometry programmatically?

Different screens can have different pixel geometry, so that the red, green and blue components are arranged in different patterns. Using sub-pixel rendering to give a higher apparent resolution is ...
user avatar
  • 5,872