axmolengine / axmol

Axmol Engine – A Multi-platform Engine for Desktop, XBOX (UWP) and Mobile games. (A fork of Cocos2d-x-4.0)
https://axmol.dev
MIT License
868 stars 195 forks source link

Opportunity to create Texture2D with GL_FLOAT internal type #971

Closed solan-solan closed 1 year ago

solan-solan commented 1 year ago

TextureGL::_textureInfo::type is set to GL_UNSIGNED_BYTE by default, and there is no opportunity to influence on texture created type. By the way GL_UNSIGNED_BYTE textures will be clumped to range [0.0 .. 1.0] for each one byte channel in the vertex/fragment shader. There are many different techniques that require passing of the not clumped big float array's to shaders, like deffered lighting or batched skin objects. I believe, some of that can be implemented (with a little restrictions) using gles 2.0. GLES 2.0 itself does not support GL_FLOAT textures, but there is _ARB_texturefloat extension which targeted gles2.0 and enable's this option. https://registry.khronos.org/OpenGL/extensions/OES/OES_texture_float.txt

Could you please to consider of including this type of textures to axmol

solan-solan commented 1 year ago

I added pull request to support this feature with GL backend;

Check please the usage of this opportunity here: https://github.com/solan-solan/HeightMap smooth_lod_passing branch

There is SkinBatch class that allows to render statically batched skinned objects, which have corresponding batch number in the VERTEX_ATTRIB_TEX_COORD1 attribute. New commits include create_batch.py for blender to simplify creating of these objects.

Example repesents 100 animated skined hens which are drawn with 2 drawcalls:

hens