FarazzShaikh / THREE-CustomShaderMaterial

🧩 Extend Three.js standard materials with your own shaders!
https://farazzshaikh.github.io/THREE-CustomShaderMaterial/
MIT License
890 stars 56 forks source link

Can you disable projection in the vertex shader? #28

Closed itsdouges closed 1 year ago

itsdouges commented 2 years ago

Hello! I'm trying to implement a billboard effect for trees (example video of the effect below) and am running into issues with how Three handles custom shaders (in essence: all or nothing!) which makes things way harder than they need to be. Your library looks great but I'm unable to use it currently because of the "projection happening down the line" part.

https://user-images.githubusercontent.com/6801309/198984210-db7d9874-f4ca-4a4e-98bd-4265af838299.mov

In my vertex shader I project into MV space to then apply the offset. Is it possible to do the projection ourselves?

itsdouges commented 2 years ago

Oh! I was digging through source and found csm_PositionRaw - seems promising! I can raise a PR to get this added to the README?

image
FarazzShaikh commented 2 years ago

If you find it to be stable then feel free to PR 🙌

FarazzShaikh commented 1 year ago

Closing as solved. Will review the PR if you make it!