[WIP] Triplanar Terrain Shader – working on Mac

hi there,

lately, i have found some basic code for a triplanar shader, fixed some issues and made a terrain shader out of it.
finally i got it working on my machine [mac book pro, nvidia geforce 9400M] which is quite exciting as all other triplanar terrain shaders that can be found here on forum do not work on my system.

version 1
the first version of the shader is based on solution provided by nvidia and first mentioned by virror here on the forums. it support forward and deferred rendering and lightmaps, but produces some strange artifacts on bump mapping:

updated link
webplayer: http://bit.ly/QgNqZg

version 2
the second version of the shader is based on farfarer’s approach has much nicer bump mapping, but only supports forward rendering and no lightmaps:

updated link
webplayer: http://bit.ly/QqIGhp
shader code can be found here: http://forum.unity3d.com/threads/113956-Farfarer-is-a-genius-triplanar-projection-on-built-in-terrain?p=1035595&viewfull=1#post1035595

any feedback is highly appreciated!

lars

Works fine for me.

MacBook Pro with Mountain Lion and a Geforce GT 650M.

thanks!

Works well in my iMac with snow leopard and my ATI Radeon HD 4670

works on Intel i7 CPU with NVIDIA Quadro 600

Could you please tell me where you found the triplanar shader code? I only need one for regular meshes ( which will be used for terrain eventually, but a custom solution :smile: )

Looking good btw :wink:

the code is from gpu gems 3:
http://http.developer.nvidia.com/GPUGems3/gpugems3_ch01.html

lars

To anyone interested in the triplanar shader thats working on Mac, original source to larsbertram1s demo (by me) can be downloaded here: triplanar shader

There is bumpmapping support as well, but not 100% sure if its working or not though.

That’s beautiful!
At some point…I’ve -got- to get an understanding of shaders, so I can use something like this for my terrains.

hi there,

if just added support for multi uv mixing and updated the webplayer.

for those of you are not sure what kind of advantages a triplanar shader offers, here is a quick comparison:

lars

How do you know he’s using your code?

hi there,

after having a closer look at the bump mapping i turned to farfarer’s approach and made his shader work on os x.
unfortunately it does not support lightmapping or deferred rendering… but bump maps look much nicer:

updated link
webplayer: http://bit.ly/QqIGhp

lars

Looks amazing! :smile:

hi primederektive,

i have been “talking” to virror lately about triplanar shaders and his solution based on a paper by nvidia which was my starting point.
unfortunately this simple an dclean solution does not work well with the bulit in terrain as it does not come with any tangents and the general tangent estimation first provided by chris morris and his bump map shader for terrains is not as accurate as i would need it.
so i switched to farfarer’s approach who has implemented his own lighting function to support nice bumpmapping. i made some tweaks to make it run on mac and it looks really nice but unfortunately it does not support deferred rendering and lightmapping as it out of unity’s lighting pipline…
have a look at my last post. there you will see my implementation of farfarer’s approach.

lars

Works great on my system. You, sir, are a genius; would you plan on releasing the code like your other free shaders? I’ve been scrawling my own system for months been it seems you’ve fixed the bugs I’ve been having. Having your code instead would be a blessing.

hi sevenbits,

i have added the shader code to the original thread:
http://forum.unity3d.com/threads/113956-Farfarer-is-a-genius-triplanar-projection-on-built-in-terrain?p=1035595#post1035595

i hope it works for you.

lars

Very nice!
But its sad it wont work on deferred since that makes it useless for me : (

well – it works in deferred rendering, but you won’t get nicely fading real time shadows…

lars


What?

Wolfos: Works for me

larsbertram1: Ok, but i use real time shadows a lot in my game, might give it a try anyway if you release something : )