Issues porting Blender to Android tablets

Yes, I have thought about it.

But I still want to port the rendering part to be similar, at least for simple models, the rendering effect is similar to that of the PC side.

Now the problem is that once you switch to material or rendering mode, there will be rendering problems.

After troubleshooting, it was found that the three samples as targets, probeHdr, probeDepth, and probeCubes, always have no content, resulting in black rendering effect.

Hello everyone, I have a question. When I was debugging Blender, I found that after switching to the shading page, the first material ball in the lower right corner can only display a small area, and the rest of the area is black.

After debugging, I sorted out the process, but I don’t know if this understanding is correct. In this process, what methods, tools, and testing methods can be used to modify this problem?

Thanks.

1)Create 【equirect_radiance_gputexture】 2d texture from 
【city.exr】 
ImBuf *ibuf = sl->equirect_radiance_buffer;
sl->equirect_radiance_gputexture = 
GPU_texture_create_2d("studiolight_radiance",
 ibuf->x,
ibuf->y,
 1,
GPU_RGBA16F,								 
GPU_TEXTURE_USAGE_SHADER_READ,
 ibuf->float_buffer.data);


2)Create 【rt_color】 cube texture from 
【equirect_radiance_gputexture】
via 【studioLight】
EEVEE_lightprobes_cache_init
	EEVEE_lookdev_cache_init(vedata, 
sldata, psl->probe_background, pinfo, &grp);
      DRW_shgroup_uniform_texture_ex(grp, 
"studioLight", sl->equirect_radiance_gputexture, state);
			
eevee_lightbake_create_render_target(&lbake, 
scene->eevee.gi_cubemap_resolution);
EEVEE_lightbake_cache_init(sldata, vedata, 
lbake.rt_color, lbake.rt_depth);			
EEVEE_lightbake_render_world(sldata, vedata, 
lbake.rt_fb);
	lookdev_world_frag.glsl
	background_color = 
node_tex_environment_equirectangular(
worldvec, studioLight).rgb;
	
	
3)Create 【cube_tx】 cubeArray texture from 【rt_color】
 via 【probeHdr】
EEVEE_lightbake_filter_glossy(sldata,
                                vedata,
                                lbake.rt_color,
                                lbake.store_fb,
                                0,
                                1.0f,
                                lcache->mips_len,
                                filter_quality,
                                clamp);
								
void EEVEE_lightcache_create{
	light_cache->cube_tx.tex =
 DRW_texture_create_cube_array_ex(cube_size, 
cube_len,
GPU_R11F_G11F_B10F, 
usage, 
cube_texflag, 
nullptr);
}

DRW_shgroup_uniform_texture(grp, "probeHdr", rt_color);

lightprobe_filter_glossy_frag.glsl
vec3 l_col = textureLod(probeHdr, L, lod).rgb;
void EEVEE_lightbake_filter_glossy{
	GPU_framebuffer_ensure_config(&fb,{GPU_ATTACHMENT_NONE,
GPU_ATTACHMENT_TEXTURE_MIP(light_cache->cube_tx.tex, i),});
	DRW_draw_pass(psl->probe_glossy_compute);
}
		
txl->lookdev_cube_tx = stl->lookdev_lightcache->cube_tx.tex;

4)【Principled BSDF】: sample from 【cube_tx】 via 【probeCubes】 
		
DRW_shgroup_uniform_texture(grp, "probeCubes", txl->lookdev_cube_tx);

closure_PrincipledBSDF_eval
	closure_eval
	closure_GlossyBSDF_eval
		Closure closure_eval(ClosureReflection reflection,
 const bool do_output_ssr)
			closure_Glossy_indirect_end	
				vec3 probe_evaluate_world_spec(vec3 R,
 float roughness)
				{
				  float lod = fast_sqrt(roughness) * prbLodCubeMax;
				  return textureLod_cubemapArray(probeCubes, 
vec4(R, 0.0), load).rgb;
				}

AFAIR RenderDoc supports Android.

But the question is also is the current approach is actually the way to go? The plan on Blender side is to switch from OpenGL to Vulkan. It is already available for users testing in Blender 4.3 Beta. In the longer term we’d like to remove OpenGL.

I am not sure what is the exact cutting point for the hardware support due to driver requirements, but we’d much rather have a single backend, and not be constrained by the current state of the mobile.

1 Like

Yes, I saw the information about blender’s development path in the forum. But it doesn’t matter, I just try it.

In addition to trying to port version 4.0.0, I also tried to port version 4.2.0, and found that it requires more opengl. After porting, I couldn’t see the rendering effect even in view port render mode. So in the end I kept trying version 4.0.0. I feel that 4.0.0 is the last version that may run on Android tablets.

I have done Vulkan development on Android tablets before. If blender switches to Vulkan in the future, I will try to port it again.

Thank you for your reply.

Blender is currently in the process of switching to Vulkan, with users able to switch to the Vulkan backend right now in Blender 4.3 and above.

Although the Vulkan backend is still “experimental” and there may be a few more Blender versions before it’s considered stable and enabled by default on modern hardware.

1 Like

From what I’ve heard Vulkan support is often better on Android than OpenGL ES.
I might be wrong of course, but it seems like it would be easier to try to port Blender with Vulkan to android than trying to port our OpenGL calls into OpenGL ES.

Hello everyone, I have a question.

In eevee, there is a geometry shader eevee_legacy_lightprobe_vert,
the input is lightprobe_vert.glsl,
and the output is eevee_legacy_lightprobe_vert_geom_iface.

123

and part of the two shader source is:

lightprobe_vert:

4444

lightprobe_geom:

There is a line of code in lightprobe_vert.glsl:
vert_iface.face = gl_InstanceID;

I don’t understand the function of this geometry shader, and why the built-in variable gl_InstanceID is called here.

After testing, it was found that if the gl_InstanceID here is changed to a fixed value, such as 0, then

1)only one face of the background cube has content.

2)The first material ball in the shading page also has only a small area with content.

456

But if I keep gl_InstanceID, the final effect is the same as changing it to 0.

Thank you so much.

I think this code has changed quite a bit with the Eevee Next. What it seems to be doing is minimize amount of data transferred to the GPU for vertex shader, and generates faces on the GPU.

gl_InstanceID is an index of primitive within an indexed draw call. Replacing it with 0 would not work correctly.

Keep in mind, you’re dealing with GL ES, which has a lot of limitations. We can not be efficiently helping with that, as it is not the platform we are planning to support. It will be much more productive and feature proof to align to Vulkan.

2 Likes

Hello everyone, I am very happy that there is new progress in porting blender to Android tablets.

After a long period of debugging and modification, finally, after porting blender to my
Android phone, the rendering module effect reached the expected effect.

After the next step of interaction has made progress, I can upload the relevant code to github and package the apk installation package for everyone to try.

The video link below is a demonstration of the relevant operations of the rendering module.

27 Likes

More about rendering module testing

19 Likes

Just wanted to pop in here to say this is bonkers, kudus to you, man! I can’t wait to use Blender on my phone someday😁

4 Likes

You’re truly making a very important step in the development of Blender and expanding the possibilities for working on Android systems! Much respect to you and a huge thank you! It seems like this is more of a technical discussion, so I won’t clutter the chat with my gratitude, but I’ll do my best to spread the word about the port among my colleagues. Really looking forward to the port!

3 Likes

Please upload apk file, I can’t wait to test it on my tablet

2 Likes

So I am by no means close to your level and frankly i cant call myself a rookie developer or even close to being one, i am trying to and wont quit till i can one day, I digress. The main reason is that i am posting is, if this would help, theres an addon i came across that i think you should look at regarding your navigation and mouse functions. Its stylus pen addon that its code i think would greatly help with the touch screen navigation. I forget the developer, if you would like to know ill check back in a day or so to see if you do with the name. Sorry i just really want
your port to android to work and work perfectly. ive found myself having ideas and thoughts about a project when im out and to be able to open my fold5 and implement those thoughts with out having to wait and or hoefully being able to remember them later, and just doing them at that moment would be epic and could open up a new workflow that doesnt just stop when u step away from u desk. You would have brought a game changer.

1 Like

Thank you very much for your reply.

Yes, I am adding input, shortcut keys, and interaction related content, and I am also trying to create models and animations with the ported APP.

The input, shortcut keys, and interactions added so far are relatively rough and simple. The plug-in you mentioned is very helpful. If you can find it, I hope you can send me a link. Thank you.

4 Likes

Thank you! Finally, we’ve been waiting for this!) On the Galaxy Tab S9, the app freezes when trying to connect a mouse.

In general, the app works great with a keyboard and recognizes key combinations (I have something like a Magic Keyboard, but for Android). Of course, it’s your port, and it’s up to you to decide, but I think it’s sometimes convenient to take a small tablet (and the keyboard also serves as a case), a small mouse, and go on business trips or vacations with a compact work machine. If the controls are adapted for use with fingers and a stylus, that would be awesome, although I think it might be quite challenging to implement. As for finger or gesture controls, I think they are implemented quite well in Nomad Sculpt.

The app installed without issues, I tried it with touch controls, explored it, and it works very smoothly and pleasantly. However, if minimized, the app crashes, and add-ons like Node Wrangler throw an error when I try to enable them. I will definitely report any bugs or issues I encounter. I hope this helps!

I can record a video if it helps, but it just shows everything described above.

1 Like

Super stoked!!! Before all else, thank you so much for your hard work. Having Blender on mobile has always been something I wanted, especially with the release of grease pencil. Even if it may not work perfectly, I am happy enough to have a working copy of Blender on my phone. Hopefully the community picks this up and make it wholly complete.

I haven’t tested the app very much yet, but I am able to do basic mouse functions well with my finger. Unfortunately, I can’t seem to get my S22 stylus to interact with anything, not even the UI buttons. Is there a workaround to this?

For Grease Pencil, I cannot see the stroke I am drawing. It only appears once I lift my finger.

My S-Pen is an inductive stylus. I think there’s probably more code stuff involved in how it interacts with the screen. A pity. I’ll try to figure it out.

Appreciate the tip on keyboard functions. That would help a lot.

Update: It’s a bit finnicky to get the menu to open, but I’m glad you added it. Interestingly enough, the S-Pen works with your keys widget but not Blender itself.

From what I found elsewhere online regarding the stylus issue, I think stylus support has not been enabled for your app, and possibly the same applies for pointers which may be why mouse usage is affected too. Or something. I’m waffling. I barely know what I am talking about. My source:
https://xdaforums.com/t/can-you-force-an-app-to-accept-stylus-s-pen-input.3315036/

1 Like

I really need mouse support, because I use my tablet as laptop on Android. On my Poco x6 pro app crushed after gray screen on start, on my tablet everything is ok.