Author Topic: Texture with Alpha from Blender  (Read 2916 times)

Offline Varanda

  • byte
  • *
  • Posts: 29
    • View Profile
Texture with Alpha from Blender
« on: March 23, 2016, 02:37:05 am »
Hello All,

I am having some problems with a texture with some transparent areas. The building model have its balconies with a glass fence. It seems to work fine. However, the opaque regions where alpha are 1 are also transparent. My scene is created based on Blender Importer project (JPCTBlendScene). Has anyone experienced similar issue?

Left side: rendered in Blender, Right side: Rendered in JPCt on Nexus 7





Settings:




 
Thanks,
Varanda

« Last Edit: March 23, 2016, 12:38:56 pm by Varanda »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Texture with Alpha from Blender
« Reply #1 on: March 24, 2016, 02:33:45 pm »
Transparent and opaque parts should be contained in at least two different objects. Is that the case? Try to set the transparency of the building to -1.
Sometimes, some exporters invent transparency where there actually is none...I don't know why.

Offline Varanda

  • byte
  • *
  • Posts: 29
    • View Profile
Re: Texture with Alpha from Blender
« Reply #2 on: March 24, 2016, 03:37:03 pm »
I have the texture with mixed opaque and transparent areas applied the the same mesh (building).
Interesting that seems to be working as the areas with alpha=0 are indeed 100% transparent. The opaque (alpha = 1) seem to be rendered with an alpha <100%.

anyways, thanks a lot, I will try the suggested transparency set to -1 tonight.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Texture with Alpha from Blender
« Reply #3 on: March 24, 2016, 05:03:00 pm »
That depends on the transparency setting. The texture's alpha is just one component. You can try to increase the transparency value...BUT: Transparent objects don't write into the depth buffer. So for a complex model like this, you'll most likely end up with some unwanted overlapping. Opaque parts should be rendered as opaque objects whenever possible. It's faster as well.

Offline Varanda

  • byte
  • *
  • Posts: 29
    • View Profile
Re: Texture with Alpha from Blender
« Reply #4 on: March 24, 2016, 05:09:26 pm »
Thanks. I will make the building 100% opaque and cut off the geometry and so making the "glasses" 100% transparent.

Offline Varanda

  • byte
  • *
  • Posts: 29
    • View Profile
Re: Texture with Alpha from Blender
« Reply #5 on: March 25, 2016, 12:56:13 am »
Something else is going on. The base of the building is an independent mesh. It does not have transparency settings. However, it shows transparent. The pictures above (first post) had already the following settings:

« Last Edit: March 25, 2016, 01:08:16 am by Varanda »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Texture with Alpha from Blender
« Reply #6 on: March 25, 2016, 09:32:58 am »
Try to set it to -1 in code. As said, some exporters add transparency where it doesn't belong.

Offline Varanda

  • byte
  • *
  • Posts: 29
    • View Profile
Re: Texture with Alpha from Blender
« Reply #7 on: March 25, 2016, 11:42:11 pm »
Solution for now (override transparency after loading scene):
Code: [Select]
Enumeration<Object3D> objs = world.getObjects();
Object3D obj;
while (objs.hasMoreElements()) {
obj = objs.nextElement();
obj.setTransparency(-1);
}

A couple tips for those willing to use jpct Blender exporter addon:

- Even for meshes with Materials without file textures you need to unwrapp and add an image as texture. Make sure you load the image in UV Editor (only in material/texture property tab is not enough).
- Make sure that you do not have any mesh in edit mode when running the exporter. Otherwise, the exporter crashes.
- MOST IMPORTANT OF ALL: Always give a destination folder other than your project root. The first thing that the exporter does in to delete the destination directory (entire content). I lost my entire project when I run the exporter first time. JUST IN CASE MAKE A BACKUP before using this exporter.

Despite the problem I got so far this exporter and JPCt integration is VERY HANDY.