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
0answers
387 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: ...
3
votes
1answer
5k views

lookAt with orthographic camera (gl-matrix)

Technically this is a webgl question though I think it's generic enough to get some opengl, erm, perspective on it too... If I setup an orthographic camera (perspective matrix) like this: ...
0
votes
2answers
210 views

Rendering a 2D tree in WebGL

Assume a tree of objects that need to be rendered, each with their own x/y coordinates. Now let's say I could crawl through the tree and give each element a "z" coordinate, before rendering. Is ...
1
vote
1answer
234 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 ...
1
vote
1answer
582 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 ...
1
vote
1answer
265 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 ...
0
votes
1answer
299 views

Efficient Dynamic Memory Management

My world is procedurally generated. As the player moves, chunks behind them are unloaded and chunks in front of them are loaded. Each chunk has a mesh of triangles. At the moment, I create two VBOs ...
1
vote
1answer
225 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 ...
3
votes
1answer
225 views

GLSL ES 2.0 alternative for dFdxFine

I'm trying to generate normal map on the fly in fragment shader. The implementation I've found is using dFdxFine function, which can't be used in WebGL, is there any alternative for dFdxFine in GLSL ...
0
votes
1answer
63 views

Are there any math limitations on the near plane in a perspective matrix?

I've noted that if in the perspective camera I put near plane to a low number like 0.000001 and far plane to 1000 my render has ...
0
votes
1answer
1k views

WebGL .NETCoreApp 1.1 - UnityLoader.js - SyntaxError: expected expression, got end of script

After creating a release build of my game using Unity 5.6, I could navigate to the created folder and open the 'index.html' file and my game would load and play normally. However, when trying to ...
0
votes
1answer
447 views

How to display full website in Unity WebGL?

I want to display the complete website within the WebGL in Unity. I have tried Awesomium plugin but it doesn't work in WebGL. Please tell me is there any way to display the webpage. Thank you.
1
vote
1answer
233 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 ...
0
votes
3answers
280 views

Unstable sampled color in GLSL shader

It looks like that sampling the same exact color data from different areas of a texture atlas results in different vec4 in the GLSL fragment shader. In other words,...
1
vote
0answers
211 views

Clipping drawn mesh by arbitrary volume

I'm trying to create a visual effect where an arbitrary part of the main scene is either clipped out by or cropped to an arbitrary volume. That is to say, I might want to draw just the area of the ...
8
votes
3answers
1k views

Noisy edges, smoothing out edges between faces via fragment shader

I have a generated terrain, with hexagonal geometry, as per screenshot below: I then generate biomes, but as you can see the borders between them are really ugly and straight. To hide that hexagonal ...
0
votes
2answers
4k views

How to rotate something around a fixed point WebGL

I have created a simple robot in webgl with cubes and now i want to rotate one "leg" around a point. But the leg is rotating around its origin. I want to rotate it around the point that connects with ...
1
vote
1answer
561 views

2D Websocket WebGL game

Inspired by BrowserQuest, I want to try my hand at making my own kind of game like this but I don't really know anything about game development other than the basics, like how the game loop works. ...
1
vote
0answers
275 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 ...
2
votes
1answer
1k views

2d game with 3d js. game engine

I'm trying to understand if it's possible to create a game where the player can switch between 2d (strategic/bird view) and 3d (actual gameplay) using only the 3d supported JS/HTML5 game engine, like ...
1
vote
0answers
446 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 ...
0
votes
1answer
198 views

WebGLRenderingContext.texImage2D does not implement interface ArrayBufferViewOrNull

I'm working on a WebGL project and all my textures render fine. When i wanted to implement a cubemap i started getting this type error. ...
0
votes
0answers
326 views

Unity build error: “Could not find file…build.asm.js ”

I made a WebGL game and the first few times it built well, then I continued working on it a bit and when I build it it gives me an error (and does not generate the build files), error: ...
1
vote
1answer
218 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 ...
1
vote
1answer
62 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 ...
1
vote
1answer
830 views

Javascript game engine that can work 'seamlessly' with react-native [closed]

I have experience with Unity, but I don't like the fact that Unity compiles your game directly into APK (or IOS equivalent). I want to modify the game to provide chat interface for multiplayer mode ...
0
votes
1answer
86 views

What's wrong with this camera implementation?

I'm using WebGL and glMatrix and I implemented a camera. When a move backward, no problem. But when I move to the side and particularly forward, the camera becomes all glitchy. I implemented almost ...
1
vote
0answers
51 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 ...
1
vote
2answers
1k 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 ...
1
vote
0answers
71 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 ...
0
votes
0answers
495 views

real time lights and high quality shadows in webgl build

I have a game in which there are a lot of objects constantly moving around and a lot of real time lights with their setting set to highest, I'm building my game as webgl and this is costing me a lot ...
1
vote
0answers
2k views

webgl draw call batching and optimizations

I'm working mostly with three.js and webgl, i have some experience with unity. I don't consider three.js a game engine, more of a "rendering library" - something that takes care of the GL ...
0
votes
1answer
339 views

Unity3D 5.5b : C# WebGL open email client Win32 exception error

I want to send an email in a WebGL build using C#. My code is as below ...
1
vote
0answers
989 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 ...
0
votes
1answer
483 views

Reset Camera view - webgl

I have camera rotating by dragging mouse. Im trying to add reset button that restart the scene to initial view. The rotating camera works as expected but I can't figure out how to reset it. The ...
0
votes
1answer
192 views

Default color for 3D scene

I have webgl 3D scene with background image and few shapes with textures. I want to add some lines and other shapes and apply on them default color which not affect the shapes with textures. How can I ...
0
votes
1answer
761 views

orbit object around another object

I am building 3D solar system containing (sun > earth > moon). I have difficult to add the part which the moon rotate around earth. I separated between "moon" and ...
2
votes
2answers
7k views

Adding multiple materials to a single mesh in three.js

I've been doing some reading and can't seem to figure out a good way to do this.. I have a simple globe with a material on it like so: ...
1
vote
0answers
330 views

rotate 3D sphere around itself - webGL

I'm trying to build 3D solar system with webGL. I have all the stars moving in a circle around the sun as sholud be, and I want them also to spin around their own Y axis. How can I add it? I tried : ...
2
votes
0answers
726 views

The importance of WebGL in the future of game development [closed]

I've recently stumbled upon some pretty impressive Babylon.js and PlayCanvas demos. Babylon.js example PlayCanvas example As a reminder: these frameworks allow 3D rendering in any (up to date) web ...
0
votes
1answer
675 views

Object outlining, stencil is not working WebGL

I can't seem to figure out my problem with stencil buffer in object outlining algo. ...
1
vote
1answer
80 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: ...
1
vote
1answer
65 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 ...
1
vote
2answers
277 views

OpenGL: Does it make sense to use an Index Buffer With GL_TRIANGLE_FAN?

When trying to draw circles in webGl (You can answer the question even in openGl terms, I'll understand both), I came across the TRIANGLE_FAN flag when calling either glDrawArrays (with only a vertex ...
1
vote
0answers
102 views

how to replace vertex buffer in webGL

I want to replace a vertex buffer with another completely different vertex buffer, different size and values, it will not get replaced every frame. ...
4
votes
2answers
1k views

how to use unity3d webgl content in a asp.net mvc view?

I asked this question in stackoverflow but no answers so I think it would fit here better. I have a unity webgl project and an asp.net mvc project. I need to show the webgl content in a view. The ...
0
votes
1answer
851 views

WebGL Redirecting URL

If player's browser don't support WebGL, I want to redirect Web Player version. I think it's possible in UnityLoader.js file but how? ...
0
votes
1answer
142 views

Webgl: is possible to use one color buffer to unsharp masking the depth buffer?

I'm noob to webgl. After reading the tutorials at webglfundamentals.org and "Introduction to Computer Graphics", i'm able to succesfully draw some stuff and the depth buffer without thirty-party ...
2
votes
0answers
592 views

Webgl: pixel perfect tilemap rendering?

The problem described below is a follow-up of Seamless tilemap rendering (borderless adjacent images). I'm not sure to fully understand the rendering issue I have, so I'll try to describe as much as ...
1
vote
0answers
337 views

Unity WebGL responsive

I am trying to embed Unity WebGL to a web page. I wonder, is it possible to make this responsive, so it will always fit whatever the screen size? How to do that? Thank you for answering.