aframevr / aframe

:a: Web framework for building virtual reality experiences.
https://aframe.io/
MIT License
16.69k stars 3.98k forks source link

lightweight vertexlit material for mobile VR / Quest #4603

Open HawkenKing opened 4 years ago

HawkenKing commented 4 years ago

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)

tripdragon commented 4 years ago

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

arpu commented 4 years ago

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

HawkenKing commented 4 years ago

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 commented 4 years ago

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.

dmarcos commented 2 years ago

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