PDA

View Full Version : Tree object


sleiN13
09-15-2011, 06:51 AM
I've got a tree object in my scene with multiple polygons with transparent textures. These polygons aren't all drawn in the correct order causing the front leaves to draw the sky in their transparent parts instead of the leaves behind it.

Is there a way to solve this problem in vizard or during export?

I had this problem before with scene object consisting out of multiple transparent faces where they weren't drawn in the correct order (depth test style) I resolved that by separating the different faces into multiple scene object and let the depth test resolve the draw order problems. But for this tree it going to be to much work.

farshizzo
09-27-2011, 11:09 AM
Try enabling viz.SAMPLE_ALPHA_TO_COVERAGE on the tree model. You will need to enable multisampling in order for this to work.
viz.setMultiSample(8)
viz.go()

model = viz.add('tree.osgb')
model.enable(viz.SAMPLE_ALPHA_TO_COVERAGE)

sleiN13
10-04-2011, 12:13 AM
That worked nicely. Still have a little bit of light corners on the leafs but atleast it looks like a actual tree now.

farshizzo
10-04-2011, 08:45 AM
I forgot to mention, you should also disable blending when using alpha to coverage. This might fix the issue with the corners:
model.disable(viz.BLEND)