Questions tagged [webgl]

WebGL is a Javascript API for rendering interactive 3D / 2D graphics on the HTML5 canvas element. It is based on OpenGL ES 2.0.

Filter by
Sorted by
Tagged with
1 vote
1 answer
81 views

Character walks too fast when browser's hardware acceleration is turned off

I have posted a project on itch.io (here). My character walks with the speed I intended when Chrome's hardware acceleration is turned on but walks much faster when it is turned off. First, my friend ...
vmrfreitas's user avatar
1 vote
1 answer
1k views

File writing or scriptable object editing in unity webgl

I am using a scriptable object for saving data. I know that scriptable objects are unchangeable means we can't change and save data after runtime but is there any workaround available to update it? Or ...
Muhammad Faizan Khan's user avatar
1 vote
1 answer
882 views

The rightmost part of the game screen is truncated in HTML

I created a game that, when I play it in Unity, looks like this: But when I build it in WebGL, the rightmost part of the screen (with the red player character in it) is truncated: Play it in-browser ...
Erel Segal-Halevi's user avatar
1 vote
1 answer
5k views

"RENDER WARNING: there is no texture bound to the unit 0" When not Rendering Texture

I have a webgl program that sometimes renders textures, but mostly renders triangles or lines. When I am not rendering a texture, webgl gives the warning, "...
lmat - Reinstate Monica's user avatar
1 vote
1 answer
7k views

unity webgl scale page on different sizes of internet browsers on pc or phone

unity only has a fixed resolution for building webgl. how can I make it changebale on users browser size change. there are some tutorials on the internet that doesn't match. there is only ...
virtouso's user avatar
  • 2,608
1 vote
1 answer
458 views

Viewport for pixelart (WebGL)

I'm trying to display 16x16 pixel art textures (all textures have 16x16), but they are not displayed how I expected (they are ...
greedsin's user avatar
  • 118
1 vote
1 answer
1k views

Unpacking Sprite Sheet Into 2D Texture Array

I am using WebGL 2. A tag for it does not exist but it should. I have a 10x10 sprite sheet of squares that are 16x16 pixels in size (all in one PNG image). I'd like to create a 2D texture array out ...
Lucien's user avatar
  • 1,176
1 vote
1 answer
2k views

How can I center a WebGL window in Unity?

I have a WebGL build for my game, however, I'm getting frequent requests to center the image. Right now it is left justified. How can I center the WebGL game window?
PearsonArtPhoto's user avatar
1 vote
1 answer
1k views

How to display a lot of small objects using WebGL?

Introduction The game scene contains a lot of 10x10 pixel elements: for 1980x1200 px. screen the number of elements on the scene can vary from 0 to 23760 (elements cannot intersect). The live ...
pavelkolodin's user avatar
1 vote
1 answer
848 views

WebGL techniques for normal mapping on morph targets?

I'm currently morphing some meshes by interpolating their positions and normals between target arrays, on the GPU, in WebGL. Now I need to apply normal maps to those morphs. For normal maps on ...
xeolabs's user avatar
  • 147
1 vote
1 answer
318 views

How are CSS and WebGL coordinates related? [closed]

I'd like to build a simple framework which rendering combines web page DOM elements with WebGL, such that they're manipulable in the same coordinate space. How does the plain CSS coordinate system ...
John Heroic's user avatar
1 vote
1 answer
1k views

WebGL (three.js) - rendering object behind camera far plane

I need to have one object that is always visible/rendered (a lens flare, to be exact). I don't want to set the camera far plane to the maximum possible distance between camera and the sun (performance ...
tomi.lee.jones's user avatar
1 vote
2 answers
4k views

Three.js: Lighting not calculating correctly on THREE.Geometry objects

I have a three.js (REVISION: '68') issue with the lighting of THREE.Geometry objects: I'm using the THREE.Geometry class to build up objects using vertices and faces, then I computeFaceNormals() and ...
DavidWaugh's user avatar
1 vote
1 answer
1k views

How to manage frustum culling

I have a spherical clipmap based planet terrain. The entire planet is made from a ring geometry of 1 unit which the vertex shader moves to cover the entire planet of 6 million unit radius. But the ...
RodgerDodger's user avatar
1 vote
2 answers
208 views

How to publish WebXR game on Quest or Steam stores?

I would like to develop a simple and small game for WebXR so that Quest, Index, etc. can play it. I would eventually like to be able to put it on the Quest store and Steam. Is there a way to publish a ...
Imperial A's user avatar
1 vote
1 answer
5k views

How to copy text from an InputField to the clipboard in WebGL?

I would like to know if there is a solution to copy/paste the text from/to an InputField in a WebGL Unity app. For security reasons, Unity WebGL doesn't allow text copy and paste in/from browser.
stighy's user avatar
  • 417
1 vote
1 answer
1k views

Why is depth test not working properly in my code?

http://jsfiddle.net/w9WqJ/31/ When rotating the camera, some pieces that are supposed to be hidden are displayed. Should I create more triangles or what did I do wrong here?
for1096's user avatar
  • 13
1 vote
1 answer
416 views

How to adapt a webgl shader using mouse position to have symmetrical behaviour

I'm trying to create a particular kind of effect for the background of my SpriteKit game, and I've found some shaders on shadertoy that are close to what I want, but I'm struggling to adapt them to do ...
Sam Woolf's user avatar
1 vote
1 answer
392 views

Removing/Updating Spritebatch

I am designing a Spritebatch class, for static and dynamic objects with WebGL. A problem I'm facing is that I have read several different opinions on sprite batching but with one goal. Put all ...
greedsin's user avatar
  • 118
1 vote
1 answer
345 views

How to calculate a projection of 360° equirectangular slides?

My goal is to have a light source inside of a transparent sphere that has an equirectangular texture to act as a 360°-slide. I want to get the projection on arbitrary objects as a texture image on ...
Vitalis Hommel's user avatar
1 vote
1 answer
335 views

Offsetting ground texture doesn't work in WebGL

so I've created a 2D sidescroller game, the technique I used is to keep the player on the same place, and move the obstacles towards him. I also offset the ground and backdrop constantly to create the ...
John Smith's user avatar
  • 1,255
1 vote
1 answer
73 views

How to keep triangles from connecting across voxel mesh

I am working on a voxel engine and have just started learning webgl. I have generated a list of Vertices and Indices by using Array.concat() on a template array and adding a value based on my position ...
Clayton's user avatar
  • 21
1 vote
2 answers
2k views

In WebGL, how can I efficiently render a mesh many times per frame, without instancing?

I'm using WebGL and I want to render a single mesh many times at different locations. I know about WebGL 2's drawArraysInstanced() and ...
EnhancedElegance's user avatar
1 vote
1 answer
100 views

2D World Mouse Coordinates - Matrices

I'm trying to get the world coordinates out of a mouse click. Currently I'm doing the following: ...
João Alves's user avatar
1 vote
1 answer
77 views

How to map control key to a specific angle or orientation?

At the moment, I basically have built out a large hash table of various angles and what direction they map to, if the user would press right, up, down, left. This is needed, in my case, as I have a ...
Detuned's user avatar
  • 111
1 vote
1 answer
276 views

Unexpected quaternion rotation behavior

First off let me apologize for the vague title but I really couldn't think of a more descriptive one (maybe after reading this a more advanced user might be able to edit it). Alright, so I have been ...
whitwhoa's user avatar
  • 201
1 vote
1 answer
689 views

Unity -- custom shader behaves differently on WebGL deployment (correct) and editor view (incorrect)

I started working on shaders and lighting on Unity3D 5.2.1f1. I set up a scene where the sun object rotates the directional light (the only light in the scene) based on its position to simulate a ...
Varaquilex's user avatar
1 vote
2 answers
2k views

Applicaton.ExternalEval(String script)

I was wondering, if Application.ExternalEval(String script); in Unity3D can return something. Like:...
user avatar
1 vote
2 answers
655 views

Fragment shader compiling in webGL but not in OpenGL

I am programming in Haxe (language compiling to multiple platforms) and I have written some shaders. My fragment shader runs fine in html5, but when I try to ...
nialna2's user avatar
  • 920
1 vote
1 answer
1k views

Techniques for drawing lines, with mouse, on 3D objects in WebGL or OpenGL?

Can anyone point me to techniques for drawing lines, with the mouse, on 3D objects in WebGL or OpenGL? Here's the effect I'm looking for, using WebGL: http://www.spacegoo.com/cadillac/ I can imagine ...
xeolabs's user avatar
  • 147
1 vote
1 answer
3k views

Is HTML5/WebGL performance unreliable on low-end Android tablets and phones?

I've developed a couple of WebGL games, and am trying them out on Android. I found that they run very slowly on my tablet, however. For example, a game with 10 sprites or so runs as 5fps. I tried ...
Boris van Schooten's user avatar
1 vote
1 answer
2k views

How to draw many identical quads in WebGL efficiently?

I have recently been trying to develop a more basic one of those 'falling sand'/'powder game' style games (See here) the past few months, and after prototyping on a plain canvas, then trying PIXI.js, ...
Milo Mordaunt's user avatar
1 vote
1 answer
1k views

WebGL immediate mode

I know that WebGL is based on OpenGL ES 2.0 and that glBegin and glEnd have been removed and replaced with vertex buffer objects....
user avatar
1 vote
1 answer
875 views

Problem when animating MD5 model (GPU Skinning)

I'm trying to implement a GPU skinning version of the md5mesh.js by @tojiro (demo with CPU skinning) in WebGL (live demo of the project here, use WASD to move the camera around). The main concept is ...
mikidelux's user avatar
  • 304
1 vote
1 answer
189 views

How do I draw a multi-object mesh at once?

This is a very elementary question. At the moment I am drawing lots of faces separately by setting a location uniform separately for each one of them. This is very slow. As I understand it, the ...
NotRoyal's user avatar
1 vote
0 answers
1k views

BuildFailedException: Incremental Player build failed!

I'm trying to build simple project with only one shape in WebGL, and I get these 4 errors. I tried to install again and it's still not working. ...
tommymordhi goroh's user avatar
1 vote
0 answers
35 views

WebGL 2.0: Attaching a shader object to a game object

I'm making a 2d game engine using Java Script and WebGL, both of which I am new to, and was wondering if it was a good idea to use a shader object to initialize the fragment and vertex shader and then ...
Myrkgard's user avatar
1 vote
0 answers
354 views

Cursor trail with fragment shader

I wish to draw a simple mouse trail using fragment shaders, similar in appearance to drawing the following in processing (omitting the step of clearing the canvas). I cannot wrap my head around the ...
msalla's user avatar
  • 111
1 vote
0 answers
243 views

Techniques for cursor snap-to-vertex in WebGL or OpenGL?

What's a technique for snapping the mouse pointer to vertices in WebGL or OpenGL? All I need is the vertex position, no other info. Ideally, I'd like to do this without needing to keep positions and ...
xeolabs's user avatar
  • 147
1 vote
0 answers
279 views

Why would running WebGL app in Edge improve performance in Firefox?

I have a WebGL app (built using Unity 2019) which I'm testing locally in Firefox and Edge. If the app is only running in a tab in Firefox, it runs at 25 - 50 fps and has noticeable stutter. If I run ...
Kevin's user avatar
  • 5,644
1 vote
0 answers
264 views

Unity WebGL Responsive content

I was trying to develop a simple drag and drop items for Web. What I was trying to do is to make the UI elements from web view to mobile view when the aspect ratio is changes. I need this web view ...
Sakuna Madushanka's user avatar
1 vote
0 answers
964 views

Input.GetAxisRaw not returning zero after releasing the key

In my WebGL Project here is the way for camera navigation (Movement/Rotation) on Update event: ...
Muhammad Faizan Khan's user avatar
1 vote
0 answers
169 views

The gist of tweening with WebGL / OpenGL

I am trying to wrap my head around how to take advantage of shaders for things like tweening. For example, there are these simple easing equations, which we can use like this: ...
user10869858's user avatar
1 vote
0 answers
177 views

How to use model matrix with integer coordinates

I'm trying to generate a real-sized planet with WebGL. After researching, I came to the conclusion that the best way to get around 32-bit float precision issues (since GPUs don't support double ...
EnhancedElegance's user avatar
1 vote
0 answers
707 views

Setting relative anchor point via matrix

The page at https://webglfundamentals.org/webgl/lessons/webgl-2d-matrices.html provides an example for rotating around the center of the image: ...
davidkomer's user avatar
1 vote
0 answers
431 views

Texture mapping artifacts at triangle edge (for thin triangles?)

I'm working on generating programmatic textures for 3d models and showing them in WebGL using Threejs. To do this I generate a texture image (PNG) that contains per-triangle textures (a rectangle on ...
Adrian Muresan's user avatar
1 vote
0 answers
756 views

How do I correctly unload an additive Scene in WebGL?

I am creating an app in WebGL. I have a loading scene that I am loading additively: SceneManager.LoadScene("Loading Scene", LoadSceneMode.Additive); It loads ...
Evorlor's user avatar
  • 5,793
1 vote
0 answers
58 views

Asymetric Perspectiv View

I am building a addon component that will show synthesized 3D view of the world (kind of FLIR camera simulation). The problem I am facing is that currently I am using Symmetric Perspective View with ...
Zbychus's user avatar
  • 11
1 vote
0 answers
106 views

WebGL frame rate slows down after triggering javascript event

I am using Unity WebGL to host my game on a flask server and trying to throw a warning to the user whenever he tries to navigate away from the tab or mistakenly click browser's back button. Each time ...
MetaRs's user avatar
  • 11
1 vote
0 answers
2k views

Lighting doesn't work properly in WebGL build only at one place

So I have a 2d game where a player walks around the level (top view) with a flashlight in front of him. Everything works fine in the editor, however whenever I build it for WebGL and test it in my ...
John Smith's user avatar
  • 1,255