WebGL Errors with 3d Rendering in HTML5 Builds (SOLVED)

I’ve run into an issue with HTML5 builds when trying to render 3d model. They output only a black screen and produce this error in web browser

It is using using the render script in the manual for 3d rendering and the built-in model.material with associated .vp and .fp files.

It works on all other builds(that I have been able to test) just not HTML5

Anyone with ideas?

(Using editor version 1.2.100)

Hmm, no idea I’m afraid. @sven, any ideas?

That’s ok! Thank you for the thought about it.

I actually just figured it out!(after googling since yesterday :grin:)

Working HTML5 Defold 3d BatMan Thing!

It works by making a copy of the model.material and shaders, for editing. Then changing line-8 in the fragment shader(model.fp) to this:

uniform mediump vec4 light;

That way, the uniforms are matching in both shaders. Both being set as mediump, or whatever(lowp, highp). It seems to work with any, as long as they match.

That was a good exercise for me to learn a bunch about render and shaders in Defold :slight_smile:
Credits to this thread at stack overflow, and the Shader Compilation section of the khronos.org wiki

5 Likes

Is this difference in precision intentional? The built-in model material has the uniform light as lowp in the fragment shader and mediump in the vertex shader, which makes web builds crash.

4 Likes

Hm, no, that sounds wrong! We should fix so they are the same in both vert and frag shaders, nice find!

5 Likes