Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add initial GLES2 3D renderer #20512

Merged
merged 1 commit into from
Jul 27, 2018
Merged

Conversation

karroffel
Copy link
Contributor

This PR adds basic 3D rendering to the GLES2 backend. Many things are still buggy (directional shadows, normalmaps, some internal culling settings) and some things are ugly and need a refactor (light rendering and texture unit assignment). Other things are not yet implemented (Reflection probes, light maps).

Those things will be added in later PRs, this PR is just there to get some more people to test the backend.

Sooooo ~ happy testing! 💙

@BastiaanOlij
Copy link
Contributor

Too cool man!

From earlier today:
image

You already mentioned the issue with shadows and the wheels are inside out. Other then that my vehicle demo project (https://github.com/BastiaanOlij/vehicle-demo) is working amazingly well using the GLES2 renderer (the trees aren't in the demo yet, just my copy).

@volzhs
Copy link
Contributor

volzhs commented Jul 27, 2018

I got some error message with GLES 2.0 driver while running on Android (Galaxy S8+) which supports gles 2.0 and 3.0.

**ERROR**: SceneShaderGLES2: Fragment shader compilation failed:
1:1: P0003: Extension 'GL_ARB_shader_texture_lod' not supported
1:54: L0002: No matching function for call to 'texture2DLod'
   At: drivers/gles2/shader_gles2.cpp:457:get_current_version() - SceneShaderGLES2: Fragment shader compilation failed:
1:1: P0003: Extension 'GL_ARB_shader_texture_lod' not supported
1:54: L0002: No matching function for call to 'texture2DLod'
**ERROR**: Method/Function Failed, returning: __null
   At: drivers/gles2/shader_gles2.cpp:466:get_current_version() - Method/Function Failed, returning: __null
**ERROR**: Condition ' !version ' is true. returned: false
   At: drivers/gles2/shader_gles2.cpp:133:bind() - Condition ' !version ' is true. returned: false
**ERROR**: SceneShaderGLES2: Fragment shader compilation failed:
1:1: P0003: Extension 'GL_ARB_shader_texture_lod' not supported
1:54: L0002: No matching function for call to 'texture2DLod'
   At: drivers/gles2/shader_gles2.cpp:457:get_current_version() - SceneShaderGLES2: Fragment shader compilation failed:
1:1: P0003: Extension 'GL_ARB_shader_texture_lod' not supported
1:54: L0002: No matching function for call to 'texture2DLod'
**ERROR**: Method/Function Failed, returning: __null
   At: drivers/gles2/shader_gles2.cpp:466:get_current_version() - Method/Function Failed, returning: __null
**ERROR**: Condition ' !version ' is true. returned: false
   At: drivers/gles2/shader_gles2.cpp:133:bind() - Condition ' !version ' is true. returned: false

as result, some texture is not shown with shader.

shader_type canvas_item;

render_mode blend_mix;
uniform float fattyness = 1.0;

void fragment(){
	vec2 ruv = UV - vec2(0.5,0.5);
	vec2 dir = normalize(ruv);
	float len = length(ruv);	
	
	len = pow(len*2.0, fattyness)*0.5;
	ruv = len*dir;
	
	vec4 col = texture(TEXTURE, ruv + vec2(0.5, 0.5));
	
	COLOR = col;
}

@karroffel
Copy link
Contributor Author

@volzhs The problem is not your shader, if you look at the error log, it says it's SceneShaderGLES2.

It is weird that it makes the textures not show up, are you embedding things in a 3D world by any chance?

Unfortunately there is not a good way around that, since GLSL ES 1.0 doesn't allow texture2DLod in fragment shaders. I could wrap it in a preprocessor define if the object is unshaded.

But yeah, for now there is no way around that that I know of.

@volzhs
Copy link
Contributor

volzhs commented Jul 27, 2018

I'm only using 2D.

@karroffel
Copy link
Contributor Author

Let's merge this thing and move bugs into separate issue trackers 😉

@karroffel karroffel merged commit c7dc066 into godotengine:master Jul 27, 2018
@volzhs
Copy link
Contributor

volzhs commented Jul 27, 2018

the shader codes I posted came from https://github.com/godotengine/godot-demo-projects/tree/master/2d/sprite_shaders
so, yes, need a way to workaround.

ok, then let me create an issue about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants