Vortex2 beta released - 3D module

Started by JaviCervera, August 31, 2017, 14:03:24

Previous topic - Next topic

RonTek

#15
I decided to give it another go and the converter to MonkeyX is awesome btw as I got to build the latest and run the demos on desktop and web again without any problems.

Here's the CatLog for the android build filtered out with Errors only if you're curious to find out this issue that I am having. This is running the simple triangle demo just to test out the very basics of this module for android.


10-06 11:40:54.082 E/AndroidRuntime(4110): in writeCrashedAppName, pkgName :com.monkeycoder.monkeygame
10-06 11:40:54.082 E/AndroidRuntime(4110): FATAL EXCEPTION: GLThread 188
10-06 11:40:54.082 E/AndroidRuntime(4110): Process: com.monkeycoder.monkeygame, PID: 4110
10-06 11:40:54.082 E/AndroidRuntime(4110): java.lang.NumberFormatException: Invalid float: "OpenGL"
10-06 11:40:54.082 E/AndroidRuntime(4110): at java.lang.StringToReal.invalidReal(StringToReal.java:63)
10-06 11:40:54.082 E/AndroidRuntime(4110): at java.lang.StringToReal.initialParse(StringToReal.java:114)
10-06 11:40:54.082 E/AndroidRuntime(4110): at java.lang.StringToReal.parseFloat(StringToReal.java:304)
10-06 11:40:54.082 E/AndroidRuntime(4110): at java.lang.Float.parseFloat(Float.java:300)
10-06 11:40:54.082 E/AndroidRuntime(4110): at com.monkeycoder.monkeygame.c_Renderer.m_Init(MonkeyGame.java:5068)
10-06 11:40:54.082 E/AndroidRuntime(4110): at com.monkeycoder.monkeygame.c_World.m_Init(MonkeyGame.java:4599)
10-06 11:40:54.082 E/AndroidRuntime(4110): at com.monkeycoder.monkeygame.c_TestApp.p_OnCreate(MonkeyGame.java:3427)
10-06 11:40:54.082 E/AndroidRuntime(4110): at com.monkeycoder.monkeygame.c_GameDelegate.StartGame(MonkeyGame.java:3549)
10-06 11:40:54.082 E/AndroidRuntime(4110): at com.monkeycoder.monkeygame.BBGame.StartGame(MonkeyGame.java:558)
10-06 11:40:54.082 E/AndroidRuntime(4110): at com.monkeycoder.monkeygame.BBAndroidGame.onDrawFrame(MonkeyGame.java:1367)
10-06 11:40:54.082 E/AndroidRuntime(4110): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1523)
10-06 11:40:54.082 E/AndroidRuntime(4110): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)



Thanks.

Derron

Seems something is trying to read a value which is no valid float (parseFloat()).


The "Init()" method of the Renderer-class is calling it - so I think it should be possible to debug that out properly (eg. do some debug-outputs (Log.i("yourapp", "here i am")).


Also you could check line :5068 if your created MonkeyGame.java-file and check what is happening there, and which line it "might" be in your original code.




bye
Ron

JaviCervera

I'd bet the error is happening when trying to retrieve the supported GL version. I will make a fix for that. I'm out of home this weekend, but I will definitely fix it next week.

RonTek

#18
Thanks Derron. I did not bother to check and debug it further at first by following those error trails as I would assume that the crash was a bigger issue than expected, which now seems to be the case (see below).

Thanks Javi, I did a quick fix by having a simple value for those version floats and that error went away. I'm now getting a force stop without errors |E| but just an info |I| with an error message

[Monkey] Error: Vertex shader active uniforms exceed MAX_VERTEX_UNIFORM_VECTORS (253)


JaviCervera

Sorry for the delay in replying.

You could reduce the number of uniforms needed by decreasing the number of maximum lights and bones supported in World.Init. The function has the following signature:

Function Init:Bool(numLights:Int = 4, numBones:Int = 75)

So if you don't need lights or animation, you should reduce those numbers, for example:

World.Init(1, 0) 'One light supported, no bones

RonTek

Quote from: JaviCervera on November 07, 2017, 12:11:53
Sorry for the delay in replying.

You could reduce the number of uniforms needed by decreasing the number of maximum lights and bones supported in World.Init. The function has the following signature:

Function Init:Bool(numLights:Int = 4, numBones:Int = 75)

So if you don't need lights or animation, you should reduce those numbers, for example:

World.Init(1, 0) 'One light supported, no bones

No worries Javi. I tried this again earlier without any bones and lights and I got this error.

Error: Could not pack varying fcubeCoords

Technically the device is not that outdated to not handle lights. I can run other 3D engine stuff like minib3d with multiple lights and bone animation, and other mobile 3d games with shaders and so this is quite surprising. I'm just guessing that this has something to do with the GLES implementation or related to that.


RonTek

Btw, with those new shadows features, are those stencil or textured?

JaviCervera

They are texture shadows.

BTW, I will take a further look at the problem you comment. It seems like the varying vars used have also reached the maximum available on your device.

RonTek

Quote from: JaviCervera on November 08, 2017, 14:37:57
They are texture shadows.

BTW, I will take a further look at the problem you comment. It seems like the varying vars used have also reached the maximum available on your device.

Thanks, always nice to have textured shadows.

JaviCervera

I have commited a few changes to Github, basically now Vortex supports specular textures, so a surface does not need to have uniform shininess anymore. The robot demo has been updated to use a specular texture, and I think it looks much better now.

Here are some of the changes I want to make before beta2, which should be released by the end of the year:

- Add Lighting and ReceiveShadows properties to Material
- Add Shader property to Material
- Add picking test
- Add Texture.SetPixels method
- Add fixes for Android

RonTek

#25
Awesome update, cool stuff and big thanks to SLotman for the mobile fix!

@Javi

As I have posted in the CX forums, it would be nice to toggle some shader "varying" in case you prefer to use specific shaders on mobiles.

BTW, how would I enable a basic car paint effect on Vortex2? would that just be using reflection and refraction with some specular on the side?

cheers.

JaviCervera

@RonTek: I am working on it. Check the Cerberus-X forums :)

For a car paint effect, you should use a reflection map with specular (which in beta2 can be defined in a texture also). I'll make a demo for beta2 with this :)

RonTek

Quote from: JaviCervera on December 01, 2017, 11:53:27
@RonTek: I am working on it. Check the Cerberus-X forums :)

For a car paint effect, you should use a reflection map with specular (which in beta2 can be defined in a texture also).

Thanks Javi. :) Yes, I would suggest something like setting up a custom profile and some short guide on how to enable each of these settings.

Example:
#OPENGLES_SHADER_PROFILE = "Minimal"

and of course you can also create your own and set it up. For example, I would just like to have a basic diffuse and cube map for basic car paint for mobile or other reflective or shiny stuff. How would I go about this if it is currently not even an option? ..and so I think creating custom profiles or having flags for each could help with shader preference.

QuoteI'll make a demo for beta2 with this :)

That would be awesome, thanks.

JaviCervera

I have been playing with a model from Sketchfab:

RonTek

Quote from: JaviCervera on December 04, 2017, 00:39:56
I have been playing with a model from Sketchfab:

Looks good. Is this with the environment mapping?

Btw, I was wondering how it would be easy to integrate 2D frameworks or standard mojo 2D commands on top. Does it need some refactoring or I could just use it directly? thanks.