Hi @Evgeni_Popov , I have tried these solutions, but still can’t solve my problem.
The decal solution can’t help, because its shape is not easy to control, as i will draw dots, paths and geo sections on it, and i want an accurate mouse interaction when hovering and clicking on decal meshes. The options only allowed me to set a rectangle shape, so i can only interact with rectangle mesh, not the correct shape.
The shader solution should be the correct way, but i still have these problems:
- Drawing a huge amount of elements(dots, paths and geo sections ) would bring a performance problem, because of the compilation cost and the for loop cost.
100 dots is ok: https://playground.babylonjs.com/#EVMT6Y#29
2K dots is not: https://playground.babylonjs.com/#EVMT6Y#31
And our goal is more than this, maybe 30K dots.
- So i switched to RTT solution, to use the texture buffer feature to lower the performance cost, to draw one dot or a batch of dots at one time, and draw the next batch based on current state. But when i reached here, i was confused.
To draw dots with ShaderMaterial and CostomMaterial are both ok:
ShaderMaterial: https://playground.babylonjs.com/#1OH09K#1015
CostomMaterial: https://playground.babylonjs.com/#EVMT6Y#29
But when i use the same shader code in RTT, it can’t work, seems the varying variable i calculated manually (vPositionW) has some inner problem or conflict.
PG here: https://playground.babylonjs.com/#4C900K#19, and i get this error: FRAGMENT varying vPositionW does not match any VERTEX varying
Can you give some help?
And at the end, reconsidered with performance and interaction, is this the right way?
If it is not, how can i draw a huge amount of elements(dots, paths and geo sections) on any mesh surface, and make them interactable?