[Huawei Developers] Freemind R:
More articles like this, you can visit HUAWEI Developer Forum​

HUAWEI Scene Kit

-Lightweight rendering engine that features high performance and low consumption.

-Provides advanced descriptive APIs for you to edit, operate, and render 3D materials.

-Adopts physically based rendering (PBR) pipelines to achieve realistic rendering effects.

-Easily load and display complicated 3D objects on Android phones.

-Can be apply on AR virtual fitting room, 3D virtual galleries for art, and VR remote teaching.

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/083/299/2640060000001083299.20200713043751.39960577914404745193293296298425:50510724015619:2800:5B06F23DD87A2649FD128AA5BC64CC5D5B9D6345C0B6326A9AC77BE948366613.jpg"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/083/299/2640060000001083299.20200713043751.39960577914404745193293296298425:50510724015619:2800:5B06F23DD87A2649FD128AA5BC64CC5D5B9D6345C0B6326A9AC77BE948366613.jpg[/IMG]

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/083/299/2640060000001083299.20200713043751.86212615083787142986708901636112:50510724015619:2800:835ADB3282C95B59E28C1D0B51F1C1C4693F7723F3E59688279608728C4667D0.jpg"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/083/299/2640060000001083299.20200713043751.86212615083787142986708901636112:50510724015619:2800:835ADB3282C95B59E28C1D0B51F1C1C4693F7723F3E59688279608728C4667D0.jpg[/IMG]

Supported Devices:

HMS Core 4.0.2.300 later

Android 8.0/EMUI 8.0 later

Suppport Vulkan graphics APIs.

Supported Formats:

1.Materials rendered:GITP,glb

2.gITF textures: png,jpeg

3.Sky box material: dds(cubeMap)

Implementation Process

1. Add build dependencies in the dependencies section.

implementation 'com.huawei.scenekit:sdk:1.5.0.300'

2.Create a SampleView that inherits from SceneView

(SceneView inherits from surfaceView and overrides methods including surfaceCreated,surfaceChanged, surfaceDestroyed, onTouchEvent, and onDraw)

public class SampleView extends SceneView {

public SampleView(Context context) {
super(context);
}

public SampleView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}

}

3.Override the surfaceCreated method in SampleView and call the super method and load 3D scene materials, skybox materials, and lighting maps.

@Override
public void surfaceCreated(SurfaceHolder holder) {
super.surfaceCreated(holder);
// Loads the model of a scene by reading files from assets.
loadScene("scene.gltf");
// Loads skybox materials by reading files from assets.
loadSkyBox("skyboxTexture.dds");
// Loads specular maps by reading files from assets.
loadSpecularEnvTexture("specularEnvTexture.dds");
// Loads diffuse maps by reading files from assets.
loadDiffuseEnvTexture("diffuseEnvTexture.dds");
}

(dds,gltf will be stored in assets directory and assets is inside app directory)

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/083/299/2640060000001083299.20200713060352.88687966964459877227222915015583:50510724021330:2800:2EA48B8EA12B27C14C3C2B08F92613C8C9C673019EC1051F6EA6712082A1CCD6.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/083/299/2640060000001083299.20200713060352.88687966964459877227222915015583:50510724021330:2800:2EA48B8EA12B27C14C3C2B08F92613C8C9C673019EC1051F6EA6712082A1CCD6.png[/IMG]

4.You may override other surface lifecycle methods.

@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
super.surfaceChanged(holder, format, width, height);
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
super.surfaceDestroyed(holder);
}
@Override
public boolean onTouchEvent(MotionEvent motionEvent) {
return super.onTouchEvent(motionEvent);
}
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
}

5.Create an Activity that inherits from Activity and call setContentView in the onCreate method to load the SampleView.

public class SampleActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);
}
}

6.In acitivity_sample create the SampleView

<com.huawei.huaweitextocr.huawei.SampleView
android:layout_width="match_parent"
android:layout_height="match_parent"/>

Reference Link:

https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides-V5/client-dev-0000001050162137-V5