Hi,
I'm at the point of implementing alpha blending (shader) to be able to use transparant/translucent textures, grass etc.
For now I didn't use any object/ mesh sorting because I didn't see the advantage yet.
But.. when using alpha blending, I've learned that I have to render objects (or better triangles?) from back to front for the expected result.
A few questions I'd like to hear your opinion on;
- is it worthwhile to render meshes/ objects based on world positition Z (initial worldpos vector * actual world matrix)?
(by the CPU, finding an efficient way of looping through objects, materials, effects, entities)
- what would you suggest to sort objects on when it comes to alpha blending?
The direction I'm following now is:
- update worldmatrix of each mesh each frame
- multiply by initial worldpos, resulting in a vector with 'Z' value
- use Z value to render 'regular' objects, front to back (increase performance on rasterization/ pixel shader)
- use Z value to render 'blended' objects, back to front
Any hints or pointers are really appreciated.
Will also be quite a challenge too find the best way to combine the 'loops' (materials, effects, effects, subobjecs/entities).