Diff of threejs to standard gl and glsl implementation

Hi, i made a melty shader using this framework:

The example:
https://tinyurl.com/y64k3h43

Now i wanted to port my code into the spring-engine, to use the melt shader on a lava-level. Which results in the fNormal not beeing calculated as in the threejs implementation.

fNormal = normalize(normalMatrix * normal);  != fNormal = normalize(gl_NormalMatrix  * gl_Normal.xyz);

I tryied several other variants and variations- and to be honest, i forgot quite a bit on what i was doing back then with the shadder.
So if anyone could give me a pointer to where three js normal calculations deviates from glsl normals, i woudl be glad.

Thanks and have a wonderful evening

Do you even have access to these two variables? Which version of OpenGL is this?

As far as shaders are concerned these are just simple uniforms that take data in. The way the normal matrix is calculated is probably exactly the same in every engine. There are many many different ways to compute and average normals. For this it might be best to read/port threes vertex normal generation code.

1 Like

@pailhead
Current version is
#define SDL_VIDEO_RENDER_OGL 1 according to config.


There is a rewrite in progress for a more recent version of ogl.

Okay, will try to port this. I shall post results . Thanks for the fast reply.