Hi all

Everyone knows here that Cycles shaders can’t be exported. Apparently, it is not entirely true : Indeed, if we consider that the Godot shading language is (very) close to GLSL, maybe it is possible to export Cycles shaders to this shading language. So I found this Python script for Blender:

https://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Game_Engine/Export_GLSL

Seems to works perfectly in Blender and the script export 2 files from the material: - a .frag file - a .vert file

I tried to copy/paste the content of both files into the Godot shader editor, but it did not work (not surprised, It would have been too nice). In my case, it displays:

Unknow identifier in epression: uv1_scale

It is linked to this line of code:

UV=UV*uv1_scale.xy+uv1_offset.xy;

(I’m almost sure it is just a first error among others)

Is there someone who could explain a method (for noobs) for it to work?

Edit: And as this script is under GPLv3 license, I hope it will be usefull for Godot coders to implement a proper import/export in future versions :smiley:

Thas not exporting cycles shaders but the blender internal game engine materials. ;)

Also: define uniforms: uniform float uv1_scale; uniform vec2 uv1_offset;

in fragment: UV1 *= uv1_scale UV1 += uv1_offset

Might want to experiment with the order of operations, though.

Alriiiiight ! Many thanks to you for clarifying Indeed, I was very stupid to think that this trick could be solved with a simple Python script. And of course, I was also stupid to think a Python script dedicated to Blender 2.6 could suit to Cycles shaders. To be honnest, my purpose was to simplify the whole thing for beginners. Well, I was wrong, sorry. (Just a dreamer talking :D) Once again many thank for the heads up ! … and yes, I have to trully learn GLSL… On it right now !

5 years later