Page 1 of 1

Bug: Leafs from Mesh Layers are not exported double sided

PostPosted: Sat May 01, 2021 5:30 pm
by nlcoaster
When a tree that contains mesh layers is exported, the leafs from mesh layers are single sided only in the exported files, even if the mesh layers are supposed to be double sided.

They are displayed double sided in Tree It, but are exported single sided, only.

I tested exporting .DBO files and .OBJ files where the mesh layers came from .TRE files.

When there are no mesh layers, the leafs are exported fine with triangles for front and back sides.

Re: Bug: Leafs from Mesh Layers are not exported double side

PostPosted: Mon May 03, 2021 11:18 am
by EVOLVED
I did some messing about and it seems to be working as it should.

just be aware that double sided when checked is referring to the use of double sided rendering when only one side of the leaf face is created with back faces then drawn with culling mode disabled.

Re: Bug: Leafs from Mesh Layers are not exported double side

PostPosted: Mon May 03, 2021 2:08 pm
by nlcoaster
I understand, I misinterpreted what the double sided option is supposed to mean. Thanks for clearing it up.

Is that double sided or cull information somehow exported in the .DBO files?

I wrote my own .DBO file importer and there seems to be a Cull flag for each mesh (DBOBLOCK_MESH_CULL). Unfortunately, it is always exported from Tree It with a value of 1=TRUE, no matter what the double sided option in Tree It is set to. If the double sided/culling information is not exported, yet, I suggest that maybe that CuLL flag should be used for it, so that .DBO importers could automatically know if back face culling should be used or not.

Re: Bug: Leafs from Mesh Layers are not exported double side

PostPosted: Fri May 07, 2021 8:39 am
by EVOLVED
This is a good idea to actually have the correct cull flag for exported dbo objects, so in the next update I shall see if I can get this in.

Re: Bug: Leafs from Mesh Layers are not exported double side

PostPosted: Fri May 07, 2021 12:51 pm
by nlcoaster
Excellent, that would help to improve importing .dbo files and conversion a lot.

My .dbo importer, right now, is also not able to detect automatically if a mesh should be shaded with a leaf shader or tree shader. It would be great if the material bytes in the .dbo file could also include that information, somehow.

I noticed an issue/bug that makes some trees to not export correctly. It happens for exporting the 'Old.tre' tree. This tree makes use of the same diffuse texture for both leafs and stems, and both parts will be exported as one single material and mesh only. I checked .dbo and .obj exports. This is problematic, because the leaf material and stem material are most likely shaded with two different shaders. I suggest that when there are shared textures between stems and leafs, that those should be exported as separate materials.

Re: Bug: Leafs from Mesh Layers are not exported double side

PostPosted: Sun May 09, 2021 7:42 pm
by EVOLVED
Just made an updated, the cull flag should now be set on dbo exports. Also set the transparency flag for leaf and meshes with alpha testing, hope you can some how make use of this as a means to differentiate between leaf or tree shader.

The Old.tre sample has an atlas map applied (not sure why, must of used the sample at some point to test atlas on export and forgot to remove it). there is now a clear texture atlas button under "tree" that becomes enabled when texture atlasing is in use, if you remove the texturing atls the exported model should now be separated and constructed of 3 submeshes.

Re: Bug: Leafs from Mesh Layers are not exported double side

PostPosted: Thu May 13, 2021 12:33 pm
by nlcoaster
Nice! The cull and transparency flags work perfectly in the new version. The .DBO files can now be imported into my engine without the need of supplying any additional info manually. This helps a lot streamlining the work flow.

Thank you very much!