aframe icon indicating copy to clipboard operation
aframe copied to clipboard

lightweight vertexlit material for mobile VR / Quest

Open HawkenKing opened this issue 5 years ago • 5 comments

this is a suggestion:

The standard default PBR material is too heavy for platforms such as the Oculus Quest, using it causes significant frame rate drops even on simple geometry.

shader: flat is performant but lacks shading.

Suggestion is to have another built-in a-frame material that is halfway between the two, that supports color, vertex colors and textures. It is lit by vertex only from the surrounding light sources. "shader: vertexlit"

(similarly in Unity development this is the way for Oculus Quest games)

HawkenKing avatar May 31 '20 18:05 HawkenKing

You should read through THREEJS's issues about their plannings for shader replacement work. In short right now to make your own varient of the uber Standard shader is a wild amount of work. They are working on a Nodes based workflow to produce a visual nodes based editor like desktop apps, but its still in the works for moving it to core.

This performance issue was common in Unity for the Samsung Gear VRs so we had to revert to Phong/Blinn workflow. But its gotten better cause eventually you do want the PBR so you can get the nice natural lighting effect

im not apart of core team here, just posting experience

tripdragon avatar Jun 02 '20 16:06 tripdragon

you can still overwrite the StandardMaterial with THREE maybe a simpler MobileStandardMaterial

arpu avatar Jun 02 '20 16:06 arpu

the shader docs are good, but it goes from 0 to 9000mph in one doc, the displacement shader example is far too advanced for a casual user just getting to grips with a-frame.

A useful example might be how to register THREE.MeshLambertMaterial as a shader, then users can have easy access to the other materials THREE has to offer with one example.

I have a codepen illustrating this, however it doesn't work with obj-model so it is incomplete, an example in the docs of how to get this to work as a material="shader : myshader" would be enough I think. https://codepen.io/dadako/pen/ZEQEKRQ

HawkenKing avatar Jun 03 '20 08:06 HawkenKing

This performance issue was common in Unity for the Samsung Gear VRs so we had to revert to Phong/Blinn workflow. But its gotten better cause eventually you do want the PBR so you can get the nice natural lighting effect

With unity you can use the PBR material for everything, however on compile it actually strips loads of things out and defines a shader for the platform, in essence it's not really a shader but a proxy for many shaders under the hood.

HawkenKing avatar Jun 03 '20 08:06 HawkenKing

I think this could be a good idea. Any of the built-in THREE shaders that could be a good candidate?

dmarcos avatar Jan 17 '22 11:01 dmarcos