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
0 votes
1 answer
40 views

Why is this shader using multiple render targets not working?

I have a webgl shader that uses multiple render targets. This one only renders to one texture for now. However, I plan that this shader shall render more. However, as soon as I add layout qualifiers, ...
user avatar
0 votes
0 answers
28 views

How to decompose a GLSL mat4 to original RTS values within vertex shader?

I need to get the rotation differences between the model and the camera. convert the values to radians/degrees and pass it to the fragment shader. for that I need to decompose and the Model rotation ...
user avatar
0 votes
0 answers
52 views

Unity using python 2 on webgl build

When exporting my game for web-gl with unity(2020.3.31f1) on osx (Monterey 12.2.1) I get a warning that python 2 was sunsetted in January 2020. What should I do? Wait for the next Unity LTS release ...
user avatar
0 votes
1 answer
27 views

How to add a texture that follows the movement?

I would like to move my landscape to simulate a world moving on the x-axis. I use createPattern() to add an image inside my path, but the pattern draws the image at ...
user avatar
  • 11
1 vote
0 answers
98 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 ...
user avatar
  • 111
0 votes
0 answers
155 views

Error when opening a minimal Unity WebGL game on itch.io

I created a very simple game in Unity 2020, built it to WebGL, and uploaded it to itch.io. When I open the game, I see the following error: ...
user avatar
2 votes
0 answers
10 views

UV interpolation gets distorted on a trapezoid [duplicate]

I'm experiencing an interesting distortion in the UV mapping of a trapezoid. When I map a square plane and tilt it backwards, the perspective-correct interpolation gives it the expected pinching at ...
user avatar
  • 121
0 votes
0 answers
40 views

Shader from urp shader graph turns gray on webgl1 build

When I build my game while graphics API is set to webgl1 the shader is just a gray texture. It works fine if graphics API is set to webgl2 but I need it to work on webgl1. Can shader graph shader ...
user avatar
  • 127
11 votes
3 answers
4k views

Performance degrading when resolution increases for a 4k screen

I am new to Unity. I have a problem where my game has good performance on my non-4k screen. Bur when I play it on my 4k screen, the performance gets really bad. It looks like the resolution is ...
user avatar
  • 219
0 votes
2 answers
203 views

Convert Byte[] to GameObject in webgl

Currently i am using the package to download zip file which contains 3d models in obj format. The download has been completed and converted to byte[], but I am not finding any way to convert the byte ...
user avatar
0 votes
1 answer
31 views

gl.drawArrays() not rendering whole mesh

I have a mesh that is generated using the marching cubes algorithm that is drawn using gl.drawArrays(), however the whole mesh isn't rendered, only part of it. I checked if the count I was specifiying ...
user avatar
2 votes
1 answer
568 views

How can I stop the Unity Video Player on WebGL from starting each video with a frame of all black?

Description I'm working on a system to seamlessly reconstruct and play numerous segments of a continuous video stream by playing one segment on the active Video Player while loading the next on the ...
user avatar
0 votes
0 answers
19 views

handling obj file without normal [duplicate]

I am trying to build an obj file loader and I have written code to read an obj file with face f with v/vt/vn - vertex, texture coordinate, and normal. While going through the obj file, there are so ...
user avatar
0 votes
0 answers
51 views

How can I convert THREE JS Texture to WebGL texture

I am a C++ OpenGL programmer trying my hands on Web Developement. I have created Three JS Render Target and rendered my scene to it. The output is correct. Now I have a need to convert output of ...
user avatar
0 votes
0 answers
64 views

Exporting WebGL For Mobile Browsers

I was asked by a client to create a pretty simple 3D game that will be embedded on a website, a plain landing page that will contain the game and will be played on mobile devices. The game itself has ...
user avatar
1 vote
1 answer
521 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 ...
user avatar
3 votes
1 answer
197 views

Why use sprite tile maps on the GPU in WebGL?

I'm trying to figure out the best way of rendering my layered tiled maps with WebGL, and have come across this tutorial several times: https://blog.tojicode.com/2012/07/sprite-tile-maps-on-gpu.html ...
user avatar
0 votes
1 answer
960 views

How to play sound in WebGL build in Unity?

I have a project that works fine when I build for windows, but doesn't work when I switch platform to WebGL. The [SerializeField] AudioClip variables in the ...
user avatar
  • 448
0 votes
1 answer
952 views

Resizing canvas to match screen size in Unity WebGL

I'm learning how to make a browser game with Unity. I have set up the screen display dimensions to 960 x 640 (I read that it's a safe resolution to use. Feel free to correct me). I created a Canvas ...
user avatar
0 votes
0 answers
251 views

For drawing many layered 2D tiles, should one use the painter's algorithm, or Z-buffering?

Sorry if this question doesn't make sense, I'm still very new to WebGL / OpenGL. Basically, I'm trying to draw a tilemap similar to the one in Stardew Valley. Here's a screenshot from that game: https:...
user avatar
0 votes
0 answers
42 views

URP water showing Differently in on Runtime

I am using this water for my URP webgl build but the problem is it is showing differently on the editor. When I run the game then it showing correctly and when I build and run it in the browser then ...
user avatar
1 vote
2 answers
593 views

Performance of many canvas drawImage calls is very slow

I'm developing a top-down 2D tile-based canvas game. I have a single sprite sheet of all my tiles, and then a JSON tile map array of where they're placed. Previously I would render all the layers of ...
user avatar
0 votes
1 answer
171 views

What is the best rate at which to send updates to clients for a first person shooter NodeJS WebSocket server?

I developed a multiplayer FPS using WebGL, Nodejs and WebSockets. So far it is running great. I am currently using setInterval(sendPlayerPositions, 16); to send updates to WebGL clients. Ideally I ...
user avatar
  • 103
0 votes
1 answer
104 views

Removing FMOD from a Unity WebGL project causes an error about not being able to copy fmod_register_static_plugins.cpp

When I imported the FMOD plugin into a Unity WebGL project, then removed it afterwards, I wasn't able to build it due to errors about trying to copy an FMOD file: fmod_register_static_plugins.cpp ...
user avatar
0 votes
2 answers
165 views

Unity WebGL Progress bar never moves but game finishes downloading and works

Not sure why but the progress bar never moves for WebGL in Chrome, but the game downloads and works? Using Unity 2020.1.14f1 brotli WebGL builds
user avatar
  • 166
0 votes
0 answers
336 views

Unity3d FullScreen Mode Vertical Aspect Ratio in WebGl

My game has vertical aspect ratio and looks like this: When I press full screen button ...
user avatar
0 votes
1 answer
549 views

How can I import an Excel file in an Unity WebGL game?

Currently, we have a project that runs on Windows and uses an Excel spreadsheet to save/retrive some data/information. Now we want to build that project for WebGL. The problem is that file reading ...
user avatar
6 votes
1 answer
545 views

File saved to IndexedDB lost unless we change scenes

Our game includes an in-game level editor. When the user saves a custom level, the level is serialized and written to a file: ...
user avatar
  • 3,395
1 vote
1 answer
360 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 ...
user avatar
0 votes
0 answers
39 views

Unity WebGL Canvas only loads on select machines

https://herbertjoseph.com There is a WebGL build in the background of this site, and it doesn't seem to laod on my iPad. I've asked a few people to visit and check it out, and some have said that the ...
user avatar
0 votes
1 answer
336 views

How to position/transform vertices for 2D UI in shaders?

I am building a 3D engine and have a rendering abstraction that focuses on writing shaders. Most my 3D shaders have gl_Position output like: ...
user avatar
1 vote
0 answers
100 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 ...
user avatar
  • 147
0 votes
0 answers
41 views

Apply Filters to WebGL Canvas Itself

I am making a game in JavaScript and rendering it to a WebGL canvas. To give the game some extra spice, I'd like to create filters (or perhaps they're called "Shaders?") to apply directly onto the ...
user avatar
2 votes
0 answers
228 views

THREE.ShaderMaterial cannot perform antialiasing

I created a ShaderMaterial to draw a box in three.js using the following key code: ...
user avatar
  • 121
1 vote
0 answers
145 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 ...
user avatar
  • 3,395
0 votes
0 answers
69 views

Is it more performant to index in the vertex shader or fragment shader?

I have a shader that draws 2D quads from a texture atlas using instancing. I'd like to add a feature that allows me to map each of the RGBA channels in the texture using a 5x5 matrix. For example, the ...
user avatar
  • 121
0 votes
2 answers
258 views

How does lookAt matrix math work?

Can someone provide me an explanation of how the lookAt matrix works? ...
user avatar
0 votes
1 answer
367 views

How can I fix the artifacts near the shadow edges in my variance shadow map?

I'm trying to implement variance shadow mapping in my engine. I'm using WebGL 2 and now I have only one directional light source. It's working, but it has a serious issue near the shadow edges and I ...
user avatar
  • 31
0 votes
0 answers
120 views

What are the options when float textures aren't precise enough?

I am currently experimenting with rendering planetary scale terrain. I am generating the terrain on the GPU with noise, and to fix the 32 bit floating point precision problems, I generate the ...
user avatar
  • 53
0 votes
1 answer
36 views

Unity3D in WebGL the Player doesn't have animations

I using Unity 2019.2.14f1 to create a simple 3D game. I want to build the project for WebGL, but, even though the player has animations on Unity, in the web the Player doesn't have animations even ...
user avatar
0 votes
0 answers
368 views

WebGL fragment shader pixel position

I have written a fragment shader, on a shape which is a square made with gl.TRIANGLE_STRIP, and which displays a radar: To build the radar, I'm using distance from ...
user avatar
0 votes
1 answer
253 views

Stuttering when using movetowards in a coroutine

I have the following problem with a WebGL project I'm working on: I have an object which I want to zoom out and move to a specific position at the same time, for this, I've created a coroutine which ...
user avatar
0 votes
1 answer
1k views

Unexpected scaling of UI elements after build [Unity Web]

I have an unusual scaling of UI Elements after my build in unity for WebGL Game in Unity Engine: Game in Itch.io: Has anyone seen this kind of behaviour? any suggestions on what I should look into? ...
user avatar
0 votes
0 answers
51 views

Logic behind a cubic reflection

I'm creating a cube in WebGL made of mirros that have to reflect the object inside of it. At the moment I'm stuck because I don't understand the correct logic to implement to achieve the result. I ...
user avatar
-1 votes
1 answer
1k views

threejs lerp and camera the animation is not smooth

what is the problem with linear interpolation? in update() in case this is animate() and when I call zoomCamera() in update() there is lerp with smooth but when I call here ...
user avatar
1 vote
0 answers
184 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 ...
user avatar
0 votes
1 answer
1k views

Why Post-Processing v1 not works in WebGL build?

In my WebGL browser app, i've tried to add Post Processing (first version) stack. I'm using Unity 2018.4.6f1 (i started 1 years ago to develop this app). I've added Post Processing Behaviour to my ...
user avatar
  • 817
-1 votes
1 answer
300 views

WebGL-HTML5 canvas in two blogger blog posts show individually but not together?

In my blogger blog: https://cglabprojects.blogspot.com I have a newer blog post with <canvas width = "570" height = "570" id = "my_Canvas1"></canvas> ...
user avatar
  • 103
0 votes
2 answers
849 views

Unity WebGL Build: Why it shows only Empty Folder?

i'm trying to built my game, made in Unity 2018.3, and i'm trying to built it in WebGL, but the problem is this: built was succeeded, but the Folder is still Empty, and here is the problem occured: ...
user avatar
1 vote
0 answers
764 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: ...
user avatar

1
2 3 4 5 6