Forum

Custom OpenGLES shader

14 October 2016 15:31 #12717
Hi,
Kindly suggest how to write and apply custom OpenGLES shader (vertex, fragment) for any object e.g. cube or plane.

with regards
Raja W. Husain
14 October 2016 15:54 #12718
Hello and welcome to the forum!

Our shaders have very close bond with Blender materials setups. Probably the best way will be to create materials using Node Editor? With it you don't need any coding, it will be converted automatically :)

You can read about it here
3D Generalist, contests administrator,
Blend4Web team.
art blog: http://contret-art.tumblr.com/
14 October 2016 16:30 #12723
Hi,
Thank you very much for quick reply.

Sometimes we need to write custom shaders e.g. plasma shader or something else which can't be achieved using Node Editor all the times. I assume in Blend4Web there must be some ways especially via "scripting" to use custom hand written vertex/fragment shader.

Could you please explain how to apply custom shader to any object e.g. cube or plane via scripting as I could not find any example or tutorial for that.

I assume I need to use some APIs for that (set_material_params etc.) but not sure how to use them for fragment shader.

with regards
Raja W. Husain
14 October 2016 18:59 #12731
Hi,

Unfortunately Blend4Web doesn't support applying hand-coded shaders. The node editor, however, is very powerful tool which can be used for creating really sophisticated materials.
Development Lead | Twitter
17 October 2016 13:05 #12771
Hi,
Thanks for quick reply.

I am not sure whether I asked you the right question and I am bit confused as I read in blend4web manual document b4w_manual_en.pdf page 12 that Blend4Web support GLSL shader via scripting. On page 402 it's mentioned that support for GLSL 3.0 shaders is available for custom shader.

Or does it mean that GLSL shaders are used by Blend4Web engine internally and users are supposed to access them via Node Editor only.

with regards
Raja W. Husain
17 October 2016 18:46 #12791
Or does it mean that GLSL shaders are used by Blend4Web engine internally and users are supposed to access them via Node Editor only.
This is correct. I didn't mention though that it is possible to access node values in node materials via JavaScript API. See here an example
https://www.blend4web.com/apps/code_snippets/code_snippets.html?scene=material_api
Development Lead | Twitter
18 October 2016 08:49 #12805
Thanks a lot!!!
 
Please register or log in to leave a reply.