mainequin Posted July 25, 2017 Share Posted July 25, 2017 Hey Folks! For my custom Shader I want to use the object's normals in view space. Therefor I need the gl_NormalMatrix. I know how to construct it (inverted and transposed MVMatrix) but I don't want to construct it manually for each object. I found this thread [SOLVED] - Shader Programs Attributes And Uniforms, but there was no hint on how the gl_NormalMatrix is called in babylon. I also searched the babylon git-repository, but could not find where the shader attributes and such are declared. Can anyone please point me in the right direction? Thank you for your time -Mainequin Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 25, 2017 Share Posted July 25, 2017 If you are using the ShaderMaterial you only need to declare a normal attribute (vec3) and a view uniform (Matrix). The ShaderMaterial will then provide required data for you Do you have a Playground of your current shader? julien-moreau 1 Quote Link to comment Share on other sites More sharing options...
mainequin Posted July 26, 2017 Author Share Posted July 26, 2017 Dear Deltakosh, I cannot offer the original code, since it is relevant to the company I work in. So as an alternative, here is a prepared playground with the respective code. I am trying to follow this tutorial. Thank you for your time -Mainequin Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 26, 2017 Share Posted July 26, 2017 https://www.babylonjs-playground.com/#VZKI0U#11 JohnK 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.