Alpha textures on mesh not showing correctly (No alpha present when rendering)

Started by wiccy, July 03, 2022, 03:36:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


ok so,  im new here,  and so far,  fantastic API.   However i have a question - i have a mesh im able to load and display using the geexlab api (tweaked the d07 meshes demo for this) and have successfully loaded the textures using the gh_model load_textures function but i notice theres no parameter to specify the pixel format (all the textures use an RGBA pixel format), and it doesnt seem to detect this automatically,  leading to no alpha being present on the textures when displayed.

So my question is this:

Is there an alternative function which supports specifying the pixel format or is there a way to access the materials and their info so i could do it myself?   I used Blender to create these meshes,  and exported using the built-in collada exporter.


Thanks for your feedback.

Indeed, the specification of the pixel format in gh_model.load_textures() is missing.
I added in the next GeeXLab, a new function gh_model.load_textures_v2() that allows you to set the pixel format.

gh_model.load_textures() uses the RGBA_U8 pixel format for all textures and you should have the correct alpha value in your shader.

I will add some functions in the next update to improve the rendering of opaque and transparent sub-meshes of a model.
Mabye Something like:


If you want to do some tests now, you can loop through a model like this:

num_children = gh_node.get_num_children(model)
for i=0, num_children-1 do
  mesh = gh_node.get_child_by_index(model, i)
  num_materials = gh_object.get_num_materials(mesh)
  for k=0, num_materials-1 do
    matid = gh_object.get_material(mesh, k)
    material_name = gh_node.get_name(matid)
    num_tex = gh_material.get_num_textures()
    for t=0, num_tex-1 do
      tex = gh_material.get_texture(matid, t)


Next GeeXLab will be available with better opaque and transparent material support.